File size: 615 Bytes
090ea4d
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/env python3
from huggingface_hub import hf_api
from huggingface_hub.repocard import metadata_update

hf_api = hf_api.HfApi()

all_marian_models = hf_api.list_models(filter="marian")
all_new_marian_models = [x.modelId for x in all_marian_models if x.modelId.startswith("Helsinki-NLP/opus-mt-tc")]

for repo_id in all_new_marian_models:
    print(f"Opening PR for {repo_id}")
    metadata_update(repo_id, {"tags": ["translation", "opus-mt-tc"]}, create_pr=True, pr_commit_summary="Add `opus-mt-tc` tag", pr_commit_description="Add `opus-mt-tc` tag so that this new marian models can be found more easily")