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

Allow to access wrapped_module of exported models #623

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

frostedoyster
Copy link
Contributor

This feature would be very useful to access information about the underlying model

Contributor (creator of pull-request) checklist

  • Tests updated (for new features and bugfixes)?
  • Documentation updated (for new features)?
  • Issue referenced (for PRs that solve an issue)?

Reviewer checklist

  • CHANGELOG updated with public API or any other important changes?

@Luthaf
Copy link
Contributor

Luthaf commented May 17, 2024

This does not work unfortunately, since torch.nn.Module is not a valid TorchScript type. Can you access exported_model._module after loading an exported model? If yes, we could rename it to self.wrapped_module or something similar, and document that reading this field is fine, but writing to it is not.

@frostedoyster
Copy link
Contributor Author

Yes, I was able to access ._module. Let's do that then. Perhaps we should also remove wrapped_module() from the documentation though, since it's not accessible anymore once the model is exported

@Luthaf
Copy link
Contributor

Luthaf commented May 17, 2024

Yes, that makes sense

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.

None yet

2 participants