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

weakly-referenced object no longer exists #40

Open
vsantjr opened this issue Sep 23, 2021 · 2 comments
Open

weakly-referenced object no longer exists #40

vsantjr opened this issue Sep 23, 2021 · 2 comments
Assignees

Comments

@vsantjr
Copy link

vsantjr commented Sep 23, 2021

Hello,

Firstly, congratulations for memlab. I have been trying to use it in Google Colab, but sometimes this error happens:

ReferenceError Traceback (most recent call last)
in ()
33 print('Reporter!!!!!!!')
34 reporter = MemReporter()
---> 35 reporter.report()

2 frames
/usr/local/lib/python3.7/dist-packages/pytorch_memlab/mem_reporter.py in (.0)
62 #FIXME: make the grad tensor collected by gc
63 objects = gc.get_objects()
---> 64 tensors = [obj for obj in objects if isinstance(obj, torch.Tensor)]
65 for t in tensors:
66 self.device_mapping[t.device].append(t)

ReferenceError: weakly-referenced object no longer exists

In my code, I use MemReport() just right after the training phase, i.e.:

for epoch in range(num_epochs):
net.train()
...
# end of training

print('Reporter!!!!!!!')
reporter = MemReporter()
reporter.report()

Do you know what is the problem?

Thank you and regards.

@Stonesjtu
Copy link
Owner

This error message is weird.

Could you plz post the:

  • memlab version
  • pytorch version
  • the computation devices (GPU type / CPU)

btw could you try adding a torch.cuda.synchronize before creating a reporter.

@Stonesjtu Stonesjtu self-assigned this Sep 24, 2021
@vsantjr
Copy link
Author

vsantjr commented Sep 24, 2021

Hello,

I am using Google Colab. I just ran !pip install pytorch_memlab in the notebook. The PyTorch version is the one of Colab. The GPU I guess that is K80 but I am not so sure.

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

2 participants