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 download metrics work on HF, add better discoverability #78

Merged
merged 5 commits into from
Apr 8, 2024

Conversation

NielsRogge
Copy link
Contributor

@NielsRogge NielsRogge commented Apr 7, 2024

Dear authors,

I noticed your awesome repository trending on paperswithcode. I'm from Hugging Face, and I see all checkpoints are on πŸ€—
already, but present in a single repository, which means download metrics won't work. 😞

This PR resolves that by showcasing the PyTorchModelHubMixin class, which is a minimal class that allows to easily add functionalities like from_pretrained, save_pretrained, and push_to_hub to any custom nn.Module!

Similar to models in the Transformers/Diffusers library, it allows to push and reload models in the format of safetensors (for the weights) and a config.json (for the model's configuration). It also creates an automated model card, along with tags for better discoverability of your models. Usage is as follows:

from models.voicecraft import VoiceCraftHF

model = VoiceCraftHF.from_pretrained(f"nielsr/{voicecraft_name}")

The corresponding model is here for now: https://huggingface.co/nielsr/gigaHalfLibri330M_TTSEnhanced_max16s, but I could transfer it (along with the other checkpoints) to your organization.

This ensures:
βœ… download metrics will work for you
βœ… tags are added to the model card automatically which means people can easier find the models on the hub (better discoverability)
βœ… reloading the model is just a single line of code

Here's a notebook regarding how I did that :)

Btw, there's no need for a wget in the demo notebooks, you can leverage hf_hub_download to load a file in a single line of code! This is also illustrated in my notebook above.

Would you be interested in this integration?

Kind regards,

Niels
ML @ HF

@NielsRogge NielsRogge changed the title Add hf Make sure download metrics work on HF, add better discoverability Apr 7, 2024
@jasonppy jasonppy self-assigned this Apr 7, 2024
@jasonppy jasonppy merged commit 0f79429 into jasonppy:master Apr 8, 2024
@NielsRogge
Copy link
Contributor Author

Hi @jasonppy thanks for merging my PR! πŸ™Œ

Would you be up for pushing the various checkpoints to separate repos on the hub as done in this PR? This way download metrics will work

Also, feel free to leverage hf_hub_download rather than wget as it's easier to download checkpoints

Wauplin added a commit to Wauplin/VoiceCraft that referenced this pull request Apr 15, 2024
This PR tweaks the HF integrations:
- `VoiceCraft` tag is lowercased to `voicecraft` => not a hard requirement but makes it more consistent with other libraries on the Hub.
- `voicecraft` is set as the `library_name` instead of simply a tag. This is better for taxonomy on the Hub.

Regarding the integration, I also opened huggingface/huggingface.js#626 to make it more official on the Hub. In particular, there will now be an official `</> Use in VoiceCraft`  button in all voicecraft models that display the code snippet to load the model. This should help users getting started with the model. It will also add a link to the voicecraft repo for the installation guide.

cc @NielsRogge who opened jasonppy#78
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

Successfully merging this pull request may close these issues.

None yet

2 participants