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

Bind the new_fwd method to the model during amp.initialize #1235

Closed
wants to merge 1 commit into from
Closed

Bind the new_fwd method to the model during amp.initialize #1235

wants to merge 1 commit into from

Conversation

baijumeswani
Copy link

During amp.initialize(), the patched forward is directly assigned to the model without binding it using MethodType.
This resulted in an error while trying to access the __func__ attribute of the forward method of the model.

AttributeError: 'function' object has no attribute '__func__'

Minor change in this pull request just binds the patched forward method to the model.

@baijumeswani
Copy link
Author

Any update on this? I'm hoping to have this reviewed so we can avoid using workarounds in user code.

@baijumeswani
Copy link
Author

Hello, wanted to follow up to see if this can be reviewed or looked at?

@ptrblck
Copy link
Contributor

ptrblck commented Apr 25, 2022

Hi @baijumeswani,
thanks for creating the PR! apex.amp is deprecated and not supported anymore (see #818).
Please use the native amp implementation via torch.cuda.amp as described here.

Closing.

@ptrblck ptrblck closed this Apr 25, 2022
@baijumeswani baijumeswani deleted the bind_patch_forward_to_model branch August 12, 2022 18:35
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

Successfully merging this pull request may close these issues.

2 participants