If idx is not None, it is returned in tensor format.
idx: None or
idx: tensor([1000000, 1000001, 1000002, ..., 1822497, 1822498, 1822499], device='cuda:0')
if idx is None or not len(idx):
iidx = torch.randint(self.coords.shape[0], (self.batch_size,))
elif not isinstance(idx, torch.Tensor):
iidx = torch.Tensor(idx)
else:
iidx = idx
i have another error
python standalone/create-initial-states.py --nsteps 5000 --device cuda:0 --output_path pretrained/frll_neutral_front_cropped experiments/initial_state_rgb_large_im.yaml data/frll_neutral_front_cropped/*.png --batchsize 1000000
Training for image: "data/frll_neutral_front_cropped/00103.png" -- Epochs: 5000 -- Batch size: 1000000 -- Steps per epoch 2 Epoch: 250 -- Loss: 0.0035432467702776194 Epoch: 500 -- Loss: 0.0024411253398284316 Epoch: 750 -- Loss: 0.0019046684610657394 Epoch: 1000 -- Loss: 0.0015376334195025265 Epoch: 1250 -- Loss: 0.0012842031428590417 Epoch: 1500 -- Loss: 0.0011257764417678118 Epoch: 1750 -- Loss: 0.0009674003231339157 Epoch: 2000 -- Loss: 0.0008773494919296354 Epoch: 2250 -- Loss: 0.0008587451884523034 Epoch: 2500 -- Loss: 0.0007761366141494364 Epoch: 2750 -- Loss: 0.000714287452865392 Epoch: 3000 -- Loss: 0.0007035472081042826 Epoch: 3250 -- Loss: 0.0006531743274535984 Epoch: 3500 -- Loss: 0.0006450842192862183 Epoch: 3750 -- Loss: 0.0006375143129844218 Epoch: 4000 -- Loss: 0.0007298113487195224 Epoch: 4250 -- Loss: 0.0005897628725506365 Epoch: 4500 -- Loss: 0.0007693315565120429 Epoch: 4750 -- Loss: 0.0006078060832805932 Best loss at epoch 4882 = 0.0005600224249064922 Traceback (most recent call last): File "/workspace/ifmorph/standalone/create-initial-states.py", line 156, in
X, , _ = img.getitem(idxslice)
File "/workspace/ifmorph/ifmorph/dataset.py", line 217, in getitem
iidx = iidx.to(self.coords.device)
UnboundLocalError: local variable 'iidx' referenced before assignment
If idx is not None, it is returned in tensor format.
idx: None
oridx: tensor([1000000, 1000001, 1000002, ..., 1822497, 1822498, 1822499], device='cuda:0')
is it okay to modify it like this?