Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some errors when run main.py #6

Open
Benson722 opened this issue Dec 26, 2024 · 0 comments
Open

Some errors when run main.py #6

Benson722 opened this issue Dec 26, 2024 · 0 comments

Comments

@Benson722
Copy link

When I try to run the code, I meet some errors:

  1. "diffusion_type" error
------------------- CUDA:  True -----------------------
world size:  0
Traceback (most recent call last):
  File "/home/zhangyiqing/denoising-diffusion-pytorch/DTG/main.py", line 12, in <module>
    trainer = Trainer(cfgs=cfgs)
  File "/home/zhangyiqing/denoising-diffusion-pytorch/DTG/src/train.py", line 59, in __init__
    self.model = get_model(config=cfgs.model, device=self.device)
  File "/home/zhangyiqing/denoising-diffusion-pytorch/DTG/src/models/model.py", line 58, in get_model
    return HNav(config=config, device=device)
  File "/home/zhangyiqing/denoising-diffusion-pytorch/DTG/src/models/model.py", line 23, in __init__
    self.generator = Diffusion(self.config.diffusion)
  File "/home/zhangyiqing/denoising-diffusion-pytorch/DTG/src/models/diffusion.py", line 14, in __init__
    self.diffusion_type = cfg.diffusion_type
AttributeError: 'EasyDict' object has no attribute 'diffusion_type'. Did you mean: 'diffusion_zd'?

The initial code location:

self.diffusion_type = cfg.diffusion_type

Does "diffusion_type" is useful? After commenting out this line, it solves.

  1. ValueError: time_steps must be positive, but got 0
Training Epoch 0:   0%|                                                                                                                                                        | 0/43054 [00:00<?, ?it/s]***********self.noise_scheduler.config.num_train_timesteps: 100
***********traversable_steps: None
***********time_steps: 100
Traversable_step: 0
***********self.noise_scheduler.config.num_train_timesteps: 100
***********traversable_steps: 0
***********time_steps: 0
Training Epoch 0:   0%|                                                                                                                                                        | 0/43054 [00:01<?, ?it/s]
Traceback (most recent call last):
  File "/home/zhangyiqing/denoising-diffusion-pytorch/DTG/main.py", line 14, in <module>
    trainer.run()
  File "/home/zhangyiqing/denoising-diffusion-pytorch/DTG/src/train.py", line 374, in run
    self.run_epoch()
  File "/home/zhangyiqing/denoising-diffusion-pytorch/DTG/src/train.py", line 330, in run_epoch
    output_dict = self.step(data_dict=data_dict)
  File "/home/zhangyiqing/denoising-diffusion-pytorch/DTG/src/train.py", line 289, in step
    output_dict = self.model(data_dict, sample=False)
  File "/home/zhangyiqing/miniconda3/envs/hn/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/zhangyiqing/denoising-diffusion-pytorch/DTG/src/models/model.py", line 37, in forward
    generator_output = self.generator(observation=observation, gt_path=input_dict[DataDict.path],
  File "/home/zhangyiqing/miniconda3/envs/hn/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
    return forward_call(*input, **kwargs)
  File "/home/zhangyiqing/denoising-diffusion-pytorch/DTG/src/models/diffusion.py", line 97, in forward
    noisy_trajectory, noise, time_step = self.add_trajectory_step_noise(trajectory=gt_path, traversable_step=traversable_step)
  File "/home/zhangyiqing/denoising-diffusion-pytorch/DTG/src/models/diffusion.py", line 84, in add_trajectory_step_noise
    t_time_step = self.add_time_step_noise(trajectory=t_trajectories, traversable_steps=traversable_step)
  File "/home/zhangyiqing/denoising-diffusion-pytorch/DTG/src/models/diffusion.py", line 69, in add_time_step_noise
    raise ValueError(f"time_steps must be positive, but got {time_steps}")
ValueError: time_steps must be positive, but got 0

In train.py, the value of traversable_step is self.time_step_number, but time_step_number is default 0 in initialization. But in the second epoch, because of the func "update_traversable_time_step" is empty, the default value isn't changed into the right value.

How can I deal with the 2 problems? Thank you! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant