Skip to content

Commit

Permalink
Ability to list models
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishu26 committed Dec 21, 2024
1 parent 4eaa4e8 commit a9be5bd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions rshf/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .utils import list_models
6 changes: 1 addition & 5 deletions rshf/senclip/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,4 @@ def __init__(self, config: PretrainedConfig):
self.config = PretrainedConfig().from_dict(config)

self.device = "cpu" if not torch.cuda.is_available() else self.config.device
self.clip, _ = clip.load(self.config.architecture, device=self.device)




self.clip, _ = clip.load(self.config.architecture, device=self.device)
13 changes: 13 additions & 0 deletions rshf/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from huggingface_hub import HfApi
import ssl

#HACK: Ignore SSL errors
ssl._create_default_https_context = ssl._create_unverified_context


def list_models(model_name):
model_filter = lambda model_info: "mvrl" in model_info.modelId.lower() and model_name.lower() in model_info.modelId.lower()
models = filter(model_filter, HfApi().list_models())
print(f"Available {model_name} pretrained models:")
for model_info in models:
print(model_info.modelId)
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = rshf
version = 0.1.5
version = 0.1.6
author = Srikumar Sastry
author_email = s.sastry@wustl.edu
description = RS pretrained models in huggingface style
Expand Down

0 comments on commit a9be5bd

Please sign in to comment.