-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (39 loc) · 1.25 KB
/
sync-model-cards.yml
File metadata and controls
45 lines (39 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Sync Model Cards to HuggingFace
on:
push:
branches: [main]
paths:
- 'cards/model/*.md'
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Upload model cards to HuggingFace
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
pip install --quiet huggingface-hub
python3 -c "
from huggingface_hub import HfApi
from pathlib import Path
api = HfApi()
cards_dir = Path('cards/model')
variant_repos = {
'pawn-small.md': 'thomas-schweich/pawn-small',
'pawn-base.md': 'thomas-schweich/pawn-base',
'pawn-large.md': 'thomas-schweich/pawn-large',
}
for filename, repo in variant_repos.items():
card_path = cards_dir / filename
if card_path.exists():
api.upload_file(
path_or_fileobj=str(card_path),
path_in_repo='README.md',
repo_id=repo,
repo_type='model',
)
print(f'Uploaded {filename} -> {repo}')
else:
print(f'Skipped {filename} (not found)')
"