Open NielsRogge opened 1 month ago
Thanks for indexing my paper! I’ve uploaded the models to the hub as suggested. Let me know if there’s anything else I can do. Appreciate the support!
Best, Jinho Jeong
That's great!
I noticed the main class is here, right? https://github.com/3587jjh/PCSR/blob/f799e7278f589ad81a845cebff0790b432130f3b/models/pcsr.py#L15
In that case, we recommend to inherit from the PyTorchModelHubMixin class, which works as long as the arguments which the class takes in its init method are JSON serializable. Basically you can do this:
from models.pcsr import PCSR
from huggingface_hub import hf_hub_download
# define model
model = PCSR(...)
# equip with weights
filepath = hf_hub_download(repo_id="3587jjh/pcsr_carn", filename="carn-pcsr-phase1.pth")
model.load_state_dict(filepath, map_location="cpu")
# push to hub
model.push_to_hub("3587jjh/pcsr_carn")
# reload
model = PCSR.from_pretrained("3587jjh/pcsr_carn")
Would be great to try this! This way, download stats are also tracked for your model.
Btw if you're interested, would be cool to create a Gradio demo on Spaces, and link it to the paper as well.
Hi @3587jjh,
Niels here from the open-source team at Hugging Face. I indexed your paper here: https://huggingface.co/papers/2407.21448, congrats on getting it accepted to ECCV (feel free to claim authorship with your HF account). I work together with AK on improving the visibility of researchers' work on the hub.
I was wondering you'd be up for collaborating on releasing the checkpoints on the 🤗 hub, rather than Github, to improve their discoverability. We can add tags so that people find them when filtering https://huggingface.co/models (in this case, we can add "image-to-image" in the model cards, so that people find it at https://huggingface.co/models?pipeline_tag=image-to-image&sort=trending).
Uploading models
See here for a guide: https://huggingface.co/docs/hub/models-uploading. In case the models are custom PyTorch model, we could probably leverage the PyTorchModelHubMixin class which adds
from_pretrained
andpush_to_hub
to each model. Alternatively, one can leverages the hf_hub_download one-liner to download a checkpoint from the hub.We encourage researchers to push each model checkpoint to a separate model repository, so that things like download stats also work. Moreover, we can then link the checkpoints to the paper page, improving their visibility.
Let me know if you're interested/need any help regarding this!
Happy to also send a PR if required.
Cheers,
Niels ML Engineer @ HF 🤗