I2-Multimedia-Lab / CDFormer

86 stars 5 forks source link

Cant start Training #4

Closed Night1099 closed 3 months ago

Night1099 commented 3 months ago
python main.py
in checkpoint
Making model...
/root/anaconda3/envs/myenv/lib/python3.8/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3483.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
Preparing loss function:
1.000 * L1
/root/anaconda3/envs/myenv/lib/python3.8/site-packages/torch/optim/lr_scheduler.py:139: UserWarning: Detected call of `lr_scheduler.step()` before `optimizer.step()`. In PyTorch 1.1.0 and later, you should call them in the opposite order: `optimizer.step()` before `lr_scheduler.step()`.  Failure to do this will result in PyTorch skipping the first value of the learning rate schedule. See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate
  warnings.warn("Detected call of `lr_scheduler.step()` before `optimizer.step()`. "
/root/anaconda3/envs/myenv/lib/python3.8/site-packages/torch/optim/lr_scheduler.py:152: UserWarning: The epoch parameter in `scheduler.step()` was not necessary and is being deprecated where possible. Please use `scheduler.step()` to step the scheduler. During the deprecation, if epoch is different from None, the closed form is used instead of the new chainable form, where available. Please open an issue if you are unable to replicate your use case: https://github.com/pytorch/pytorch/issues/new/choose.
  warnings.warn(EPOCH_DEPRECATION_WARNING, UserWarning)
G_lossfn_weight
1.0

And script just stops with no errors, using same env as listed on readme and requirements.txt

Night1099 commented 3 months ago

I fixed this by doing

python main.py --start_epoch 0
Night1099 commented 3 months ago

Ive put in a pull request to provide instructions of how to do this

gdsdfn75 commented 1 month ago

Hi, I have the same problem when I run it too. I followed your instructions python main.py --start_epoch 0 and ran it and it still reported an error. Do you know how to fix it? student01@ubuntu-Precision-7920-Tower:~/CDFormer-main$ python main.py --start_epoch 0 in checkpoint Making model... /home/student01/anaconda3/envs/cdf/lib/python3.8/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3526.) return _VF.meshgrid(tensors, *kwargs) # type: ignore[attr-defined] Preparing loss function: 1.000 L1 /home/student01/anaconda3/envs/cdf/lib/python3.8/site-packages/torch/optim/lr_scheduler.py:136: UserWarning: Detected call of lr_scheduler.step() before optimizer.step(). In PyTorch 1.1.0 and later, you should call them in the opposite order: optimizer.step() before lr_scheduler.step(). Failure to do this will result in PyTorch skipping the first value of the learning rate schedule. See more details at https://pytorch.org/docs/stable/optim.html#how-to-adjust-learning-rate warnings.warn("Detected call of lr_scheduler.step() before optimizer.step(). " /home/student01/anaconda3/envs/cdf/lib/python3.8/site-packages/torch/optim/lr_scheduler.py:149: UserWarning: The epoch parameter in scheduler.step() was not necessary and is being deprecated where possible. Please use scheduler.step() to step the scheduler. During the deprecation, if epoch is different from None, the closed form is used instead of the new chainable form, where available. Please open an issue if you are unable to replicate your use case: https://github.com/pytorch/pytorch/issues/new/choose. warnings.warn(EPOCH_DEPRECATION_WARNING, UserWarning) G_lossfnweight 1.0 [Epoch 1] Learning rate: 1.00e-4 Traceback (most recent call last): File "main.py", line 30, in epoch = t.train() File "/home/student01/CDFormer-main/trainer.py", line 86, in train for batch, (hr, , idx_scale) in enumerate(self.loader_train): File "/home/student01/CDFormer-main/dataloader.py", line 397, in next return self._process_next_batch(batch) File "/home/student01/CDFormer-main/dataloader.py", line 423, in _process_next_batch raise batch.exc_type(batch.exc_msg) ValueError: Traceback (most recent call last): File "/home/student01/CDFormer-main/dataloader.py", line 519, in _ms_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/student01/CDFormer-main/dataloader.py", line 519, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/student01/CDFormer-main/data/multiscalesrdata.py", line 120, in getitem hr = self.get_patch(hr) File "/home/student01/CDFormer-main/data/multiscalesrdata.py", line 163, in get_patch hr_patch = common.get_patch( File "/home/student01/CDFormer-main/data/common.py", line 12, in get_patch tx = random.randrange(0, (tw-tp)) File "/home/student01/anaconda3/envs/cdf/lib/python3.8/random.py", line 226, in randrange raise ValueError("empty range for randrange() (%d, %d, %d)" % (istart, istop, width)) ValueError: empty range for randrange() (0, 0, 0)