-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Add hubconf to load models without installing (#543)
* Add hubconf file * Refactor to minimise hubconf dependencies * Pin hubconf dependencies * Revert "Pin hubconf dependencies" This reverts commit bc904a9 as it didn't seem to work. * Add support for newer versions of torch * Add only the model folder to path * Remove unnecessary try-except block * Avoid duplicate definition of Hugging Face strings * Import from a more appropriate module * Add test to compare package and PyTorch Hub models * Add version number to package __init__ * Remove branch name from PyTorch Hub repo string * Check only fields from package model * Remove unnecessary zip wrap Co-authored-by: Shruthi42 <[email protected]> Co-authored-by: Shruthi42 <[email protected]>
- Loading branch information
Showing
9 changed files
with
100 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# autopep8: off | ||
dependencies = ["torch", "torchvision"] | ||
|
||
import sys | ||
from pathlib import Path | ||
repo_dir = Path(__file__).parent | ||
multimodal_src_dir = repo_dir / "hi-ml-multimodal" / "src" / "health_multimodal" / "image" | ||
sys.path.append(str(multimodal_src_dir)) | ||
|
||
from model import ImageModel | ||
from model import get_biovil_resnet as _biovil_resnet | ||
# autopep8: on | ||
|
||
|
||
def biovil_resnet(pretrained: bool = False) -> ImageModel: | ||
"""Get BioViL image encoder. | ||
:param pretrained: Load pretrained weights from a checkpoint. | ||
""" | ||
model = _biovil_resnet(pretrained=pretrained) | ||
return model |