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

Source state dict is empty when using --amp #103

Open
jeremy-rutman opened this issue Oct 23, 2021 · 1 comment
Open

Source state dict is empty when using --amp #103

jeremy-rutman opened this issue Oct 23, 2021 · 1 comment

Comments

@jeremy-rutman
Copy link

I hit a 'source state dict is empty' error when I try using --amp.

jeremy@jeremy-Blade:$ lightweight_gan --data data --aug-prob 0.25 --aug-types [translation,cutout,color]   --save-every 200 --name lw1  --amp --batch_size 16 --gradient_accumulate-every 4 
/home/jeremy/.local/lib/python3.8/site-packages/kornia/augmentation/augmentation.py:1830: DeprecationWarning: GaussianBlur is no longer maintained and will be removed from the future versions. Please use RandomGaussianBlur instead.
  warnings.warn(
continuing from previous epoch - 0
loading from version 0.20.4
/usr/lib/python3/dist-packages/apport/report.py:13: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import fnmatch, glob, traceback, errno, sys, atexit, locale, imp, stat
Traceback (most recent call last):
  File "/home/jeremy/.local/bin/lightweight_gan", line 8, in <module>
    sys.exit(main())
  File "/home/jeremy/.local/lib/python3.8/site-packages/lightweight_gan/cli.py", line 190, in main
    fire.Fire(train_from_folder)
  File "/home/jeremy/.local/lib/python3.8/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/home/jeremy/.local/lib/python3.8/site-packages/fire/core.py", line 466, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/home/jeremy/.local/lib/python3.8/site-packages/fire/core.py", line 681, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/home/jeremy/.local/lib/python3.8/site-packages/lightweight_gan/cli.py", line 181, in train_from_folder
    run_training(0, 1, model_args, data, load_from, new, num_train_steps, name, seed)
  File "/home/jeremy/.local/lib/python3.8/site-packages/lightweight_gan/cli.py", line 59, in run_training
    model.load(load_from)
  File "/home/jeremy/.local/lib/python3.8/site-packages/lightweight_gan/lightweight_gan.py", line 1474, in load
    self.G_scaler.load_state_dict(load_data['G_scaler'])
  File "/usr/local/lib/python3.8/dist-packages/torch/cuda/amp/grad_scaler.py", line 500, in load_state_dict
    raise RuntimeError("The source state dict is empty, possibly because it was saved "
RuntimeError: The source state dict is empty, possibly because it was saved from a disabled instance of GradScaler.

I'll see if I can dig in a bit and root it out

@msglm
Copy link

msglm commented Dec 2, 2021

I ran into this error when using --amp on an already started project. I changed the --name parameter to something different, using the same data of course, and the problem went away. It might be worth it to start another named project if you're trying to use --amp.

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

2 participants