Skip to content

[package] properly handle case where we are re-packaging mocked modules #61434

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

Closed
wants to merge 2 commits into from

Conversation

suo
Copy link
Member

@suo suo commented Jul 8, 2021

Stack from ghstack:

Mocking is the only time we introduce a "special" module to a
torch.package of our own creation. This interacts poorly with
re-packaging, since if we treat _mock as a regular module and try to
package it normally we will produce a broken package.

This PR teaches PackageExporter to recognize _mock modules and treat
them specially during the dependency walking process, thus avoiding the
issue.

Differential Revision: D29638283

Mocking is the only time we introduce a "special" module to a
torch.package of our own creation. This interacts poorly with
re-packaging, since if we treat `_mock` as a regular module and try to
package it normally we will produce a broken package.

This PR teaches PackageExporter to recognize `_mock` modules and treat
them specially during the dependency walking process, thus avoiding the
issue.

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Jul 8, 2021

💊 CI failures summary and remediations

As of commit ecc8cc2 (more details on the Dr. CI page and at hud.pytorch.org/pr/61434):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


Preview docs built from this PR

This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

suo added a commit that referenced this pull request Jul 8, 2021
Mocking is the only time we introduce a "special" module to a
torch.package of our own creation. This interacts poorly with
re-packaging, since if we treat `_mock` as a regular module and try to
package it normally we will produce a broken package.

This PR teaches PackageExporter to recognize `_mock` modules and treat
them specially during the dependency walking process, thus avoiding the
issue.

ghstack-source-id: 8a42340
Pull Request resolved: #61434
…ocked modules"

Mocking is the only time we introduce a "special" module to a
torch.package of our own creation. This interacts poorly with
re-packaging, since if we treat `_mock` as a regular module and try to
package it normally we will produce a broken package.

This PR teaches PackageExporter to recognize `_mock` modules and treat
them specially during the dependency walking process, thus avoiding the
issue.

[ghstack-poisoned]
suo added a commit that referenced this pull request Jul 9, 2021
Mocking is the only time we introduce a "special" module to a
torch.package of our own creation. This interacts poorly with
re-packaging, since if we treat `_mock` as a regular module and try to
package it normally we will produce a broken package.

This PR teaches PackageExporter to recognize `_mock` modules and treat
them specially during the dependency walking process, thus avoiding the
issue.

ghstack-source-id: ff79a16
Pull Request resolved: #61434
@suo
Copy link
Member Author

suo commented Jul 9, 2021

@suo has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@suo suo requested review from SplitInfinity and Lilyjjo July 9, 2021 18:30
Copy link
Contributor

@Lilyjjo Lilyjjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@facebook-github-bot
Copy link
Contributor

@suo merged this pull request in 35b950e.

@facebook-github-bot facebook-github-bot deleted the gh/suo/443/head branch July 13, 2021 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants