Skip to content

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

@NielsRogge

Description

@NielsRogge

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 🤗

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions