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

Inference Mode Bug #9

Open
NoelVouitsis opened this issue Jan 19, 2022 · 2 comments
Open

Inference Mode Bug #9

NoelVouitsis opened this issue Jan 19, 2022 · 2 comments

Comments

@NoelVouitsis
Copy link

If I turn automatic mixed precision off, the code breaks when passing the encoded_text into txt_proj. To fix it, I think I just need to change this line

txt_memory = rearrange(encoded_text.last_hidden_state, 'b s c -> s b c')
to this txt_memory = rearrange(encoded_text.last_hidden_state.clone(), 'b s c -> s b c')

@mttr2021
Copy link
Owner

mttr2021 commented Feb 1, 2022

Hi there,
Thank you for your interest in our work! We sincerely apologize for our delayed response.
We tried to reproduce your issue as described but couldn't. Can you please elaborate more on the issue? what was the running command? what was the exact error message?
Thanks

@NoelVouitsis
Copy link
Author

Hi there,
No worries at all. If I train the model with this command python main.py -rm train -c configs/refer_youtube_vos.yaml -ws 8 -bs 1 -ng 8 and I set enable_amp: false with freeze_text_encoder: true, I get the error Inference tensors cannot be saved for backward. To work around you can make a clone to get a normal tensor and use it in autograd.

The stack traces the error to this line:

x = self.fc(encoder_features)

I believe it has to do with the inference_mode setting. But this error only occurs with automatic mixed precision turned off oddly. To fix the issue I had to clone the tensor as above.

Thanks

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