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 downloads work, better discoverability #878

Closed
wants to merge 1 commit into from

Conversation

NielsRogge
Copy link

@NielsRogge NielsRogge commented Jun 4, 2024

Hi @sarthakpati and team,

Thanks for this nice work! I wrote a quick PoC to showcase that you can easily have integration with the 🤗 hub so that you can automatically load the various GaNDLF models using from_pretrained (and push them using push_to_hub), track download numbers for your models (similar to models in the Transformers library), and have nice model cards on a per-model basis. It leverages the PyTorchModelHubMixin class which allows to inherits these methods.

Usage is as follows:

from .models import DenseNet

model = DenseNet(...)

# optionally, one can push a trained model to the hub at the end of training
model.push_to_hub("nielsr/densenet-finetuned-medical-segmentation")

# reload as follows
model = DenseNet.from_pretrained("nielsr/densenet-finetuned-medical-segmentation")

Alternatively, if you want a more custom integration with the hub, we also provide methods like hf_hub_download (to download a file from the hub, upload_folder and upload_file). Those require some more work however to make download stats work.

This means people don't need to manually download a checkpoint first in their local environment, it just loads automatically from the hub.

Would you be interested in this integration?

Fixes #727

Kind regards,

Niels

@NielsRogge NielsRogge requested a review from a team as a code owner June 4, 2024 07:43
Copy link
Contributor

github-actions bot commented Jun 4, 2024

MLCommons CLA bot:
Thank you very much for your submission, we really appreciate it. Before we can accept your contribution, we ask that you sign the MLCommons CLA (Apache 2). Please use this [Google form] (https://forms.gle/Ew1KkBVpyeJDuRw67) to initiate authorization. If you are from an MLCommons member organization, we will request that you be added to the CLA. If you are not from a member organization, we will email you a CLA to sign. For any questions, please contact support@mlcommons.org.
0 out of 1 committers have signed the MLCommons CLA.
@NielsRogge
You can retrigger this bot by commenting recheck in this Pull Request

@sarthakpati
Copy link
Collaborator

Thanks for the contribution, @NielsRogge!

Another PR is addressing this on a different level so that it allows interaction through the CLI (#880), do you think you could take a look at it and provide feedback?

I will close this PR out in favor of that one so that we are all on the same page.

@sarthakpati sarthakpati closed this Jun 4, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jun 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Hugging Face Hub integration
2 participants