mirror of
https://github.com/huggingface/pytorch-image-models.git
synced 2025-06-03 15:01:08 +08:00
🎨 write model card to enable inference
This commit is contained in:
parent
abf9d51bc3
commit
2b6ade24b3
@ -159,6 +159,13 @@ def push_to_hf_hub(
|
|||||||
)
|
)
|
||||||
|
|
||||||
with repo.commit(commit_message):
|
with repo.commit(commit_message):
|
||||||
|
# Save model weights and config
|
||||||
save_pretrained_for_hf(model, repo.local_dir, **config_kwargs)
|
save_pretrained_for_hf(model, repo.local_dir, **config_kwargs)
|
||||||
|
|
||||||
|
# Save a model card if it doesn't exist, enabling inference.
|
||||||
|
readme_path = Path(repo.local_dir) / 'README.md'
|
||||||
|
readme_txt = f'---\ntags:\n- image-classification\n- timm\nlibrary_tag: timm\n---\n# Model card for {repo_name}'
|
||||||
|
if not readme_path.exists():
|
||||||
|
readme_path.write_text(readme_txt)
|
||||||
|
|
||||||
return repo.git_remote_url()
|
return repo.git_remote_url()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user