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

Make sure Hugging Face download stats work, better discoverability #4

Open
NielsRogge opened this issue Jun 9, 2024 · 0 comments
Open

Comments

@NielsRogge
Copy link

NielsRogge commented Jun 9, 2024

Dear authors,

Thanks for this nice work! I saw the checkpoints are already pushed to the 🤗 hub which is great: https://huggingface.co/ICTNLP/StreamSpeech_Models/tree/main, however there are a few things that could be improved which will help in making more people discover your models.

To make download stats work for your models, there are a few options.

  • in case your models are regular nn.Module classes, one can leverage the PyTorchModelHubMixin which automatically adds push_to_hub and from_pretrained to your custom PyTorch models, ensuring download stats will work. This also uses safetensors by default rather than pickle to store weights, which is considered safer.
  • alternatively, you can also follow this guide to make download stats work: https://huggingface.co/docs/hub/models-download-stats. This allows you to specify a file extension (like *.pt) to track downloads.
  • lastly, we also offer some utility methods which allow to load files using a single line of code! e.g.

Usage is as follows:

from huggingface_hub import hf_hub_download
import torch

filepath = hf_hub_download(repo_id="ICTNLP/StreamSpeech_Models", filename="streamspeech.offline.de-en.pt", repo_type="model")
state_dict = torch.load(filepath, map_location="cpu")

We also offer upload_file, upload_folder for pushing to the hub.

Let me know if you need any help!

Kind regards,

Niels
ML Engineer @ HF 🤗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant