Skip to content

RuntimeError: No grad accumulator for a saved leaf! #15

@greeneggsandyaml

Description

@greeneggsandyaml

Hello, thank you for your work on this implementation (and your stylegen work), it looks great!

I'm getting a strange error:

Traceback (most recent call last):
  File "train.py", line 486, in <module>
    device,
  File "train.py", line 251, in train
    (recon_loss + g_loss + g_cooccur_loss).backward()
  File "/home/luke/.miniconda3/envs/new/lib/python3.7/site-packages/torch/tensor.py", line 227, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph)
  File "/home/luke/.miniconda3/envs/new/lib/python3.7/site-packages/torch/autograd/__init__.py", line 138, in backward
    allow_unreachable=True)  # allow_unreachable flag
RuntimeError: No grad accumulator for a saved leaf!

For context, I have not modified any of the code in the repo. I get this when I run CUDA_VISIBLE_DEVICES=4 python train.py --size 256 MY_DATA_DIR, with or without distributed training.

I have tried calling .backward() on each of the 3 losses independently, and they all give the same error.

My environment:

Python 3.7.6
PyTorch 1.8.0a0

Do you know how I might go about fixing this?

Much appreciated,
greeneggsandyaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions