Skip to content

Commit

Permalink
Mention model_info.id instead of model_info.modelId (#32106)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wauplin authored Jul 22, 2024
1 parent 0fcfc5c commit f2a1e3c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/source/en/model_doc/marian.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ from huggingface_hub import list_models

model_list = list_models()
org = "Helsinki-NLP"
model_ids = [x.modelId for x in model_list if x.modelId.startswith(org)]
model_ids = [x.id for x in model_list if x.id.startswith(org)]
suffix = [x.split("/")[1] for x in model_ids]
old_style_multi_models = [f"{org}/{s}" for s in suffix if s != s.lower()]
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def find_pretrained_model(src_lang: str, tgt_lang: str) -> List[str]:
"""Find models that can accept src_lang as input and return tgt_lang as output."""
prefix = "Helsinki-NLP/opus-mt-"
model_list = list_models()
model_ids = [x.modelId for x in model_list if x.modelId.startswith("Helsinki-NLP")]
model_ids = [x.id for x in model_list if x.id.startswith("Helsinki-NLP")]
src_and_targ = [
remove_prefix(m, prefix).lower().split("-") for m in model_ids if "+" not in m
] # + cant be loaded.
Expand Down
2 changes: 1 addition & 1 deletion tests/models/marian/test_modeling_marian.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ class ModelManagementTests(unittest.TestCase):
@require_torch
def test_model_names(self):
model_list = list_models()
model_ids = [x.modelId for x in model_list if x.modelId.startswith(ORG_NAME)]
model_ids = [x.id for x in model_list if x.id.startswith(ORG_NAME)]
bad_model_ids = [mid for mid in model_ids if "+" in model_ids]
self.assertListEqual([], bad_model_ids)
self.assertGreater(len(model_ids), 500)
Expand Down
2 changes: 1 addition & 1 deletion utils/update_tiny_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def get_tiny_model_summary_from_hub(output_path):
)
_models = set()
for x in models:
model = x.modelId
model = x.id
org, model = model.split("/")
if not model.startswith("tiny-random-"):
continue
Expand Down

0 comments on commit f2a1e3c

Please sign in to comment.