huh, torch 1.12 broke it. remove unused requirements.txt and pin torch 1.11
DELETE
requirements.txt
-numpy
-pyopencl==2020.2.2
-pillow
-# util deps
-requests
-# testing deps
---find-links https://download.pytorch.org/whl/torch_stable.html
-torch==1.6.0+cpu
-torchvision==0.7.0+cpu
-pytest
-tqdm
-protobuf~=3.19.0
-onnx
-onnx2torch

MODIFY
setup.py
setup.py
@@ -25,7 +25,7 @@ setup(name='tinygrad',
'gpu': ["pyopencl", "six"],
'testing': [
"pytest",
- "torch",
+ "torch~=1.11.0",
"tqdm",
"protobuf~=3.19.0",
"onnx",

MODIFY
tinygrad/llops/ops_torch.py
tinygrad/llops/ops_torch.py
@@ -10,14 +10,15 @@ class TorchBuffer(torch.Tensor):
return super().__new__(cls, shape)
else:
return TorchBuffer(torch.zeros(shape)).to(device)
- custompad = lambda x,padding: torch.nn.functional.pad(x, [item for sublist in padding[::-1] for item in sublist])
+
+ def custompad(x, padding): return torch.nn.functional.pad(x, [item for sublist in padding[::-1] for item in sublist])
+ def getdtype(self): return np.float32
+
@staticmethod
def fromCPU(data):
return TorchBuffer(torch.from_numpy(data).requires_grad_(False)).to(device)
def toCPU(x):
return x.cpu().numpy()
- def getdtype(self):
- return np.float32
unary_op, binary_op, reduce_op, movement_op = CPUBuffer.unary_op, CPUBuffer.binary_op, CPUBuffer.reduce_op, CPUBuffer.movement_op

huh, torch 1.12 broke it. remove unused requirements.txt and pin torch 1.11