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

Enable package import from torchbenchmark and torchbenchmark.models. #2200

Closed
wants to merge 1 commit into from

Conversation

xuzhao9
Copy link
Contributor

@xuzhao9 xuzhao9 commented Mar 16, 2024

More intuitive module import when installed as a package.
This PR adds LazyImport to all torchbenchmark models so that they will be loaded only when being used.

Test plan:

Run the following commands:

python install.py
pip install -e .
$ python -c "import torchbenchmark.models; print(torchbenchmark.models.densenet121.Model)"
<class 'torchbenchmark.models.densenet121.Model'>
$ python -c "import torchbenchmark; print(torchbenchmark.models.densenet121.Model)"
<class 'torchbenchmark.models.densenet121.Model'>

Fixes #2193

@xuzhao9 xuzhao9 requested a review from drisspg March 16, 2024 07:30
@xuzhao9 xuzhao9 removed the request for review from drisspg March 16, 2024 07:35
@xuzhao9 xuzhao9 changed the title Enable package import from torchbenchmark and torchbenchmark.models. [WIP] Enable package import from torchbenchmark and torchbenchmark.models. Mar 16, 2024
@xuzhao9 xuzhao9 changed the title [WIP] Enable package import from torchbenchmark and torchbenchmark.models. Enable package import from torchbenchmark and torchbenchmark.models. Mar 16, 2024
@xuzhao9 xuzhao9 requested a review from drisspg March 16, 2024 19:53
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@xuzhao9 merged this pull request in 3bb81e5.

@xuzhao9 xuzhao9 deleted the xz9/fix-pkg branch June 28, 2024 12:58
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.

Readme Example is broken
3 participants