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

Tokenizers: Updated huggingface_models.py to support Safetensors models as well as pytorch #2880

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions extensions/tokenizers/src/main/python/huggingface_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,20 @@ def list_models(self, args: Namespace) -> List[dict]:

api = HfApi()
if args.model_name:
models = api.list_models(filter="pytorch",
search=args.model_name,
sort="downloads",
direction=-1,
limit=args.limit)
all_models = api.list_models(search=args.model_name,
sort="downloads",
direction=-1,
limit=args.limit)
import_all = True
else:
models = api.list_models(filter=f"{args.category},pytorch",
sort="downloads",
direction=-1,
limit=args.limit)
all_models = api.list_models(filter=args.category,
sort="downloads",
direction=-1,
limit=args.limit)
models = [
model for model in all_models
if 'pytorch' in model.tags or 'safetensors' in model.tags
]
if not models:
if args.model_name:
logging.warning(f"no model found: {args.model_name}.")
Expand Down
Loading