neufieldrobotics / NeuFlow_v2

Apache License 2.0
92 stars 6 forks source link

Add HF integration #1

Closed NielsRogge closed 2 months ago

NielsRogge commented 2 months ago

Hi,

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 model using from_pretrained (and push it 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, and perhaps most importantly, leverage safetensors for the weights in favor of pickle.

It leverages the PyTorchModelHubMixin class which allows to inherits these methods.

Usage is as follows:

from NeuFlow.neuflow import NeuFlow

# instantiate model
model = NeuFlow()

# equip model with weights
model.load_state_dict(...)

# push to hub
model.push_to_hub("your-hf-org/neuflow-v2")

# reload
model = NeuFlow.from_pretrained("your-hf-org/neuflow-v2")

This means people don't need to manually download a checkpoint first in their local environment, it just loads automatically from the hub, and they can discover it when filtering https://huggingface.co/models.

Would you be interested in this integration?

Kind regards,

Niels

Note

Please don't merge this PR before pushing the model to the hub :)

Study-is-happy commented 2 months ago

Thanks for the instruction! We will integrate to HF ASAP.

NielsRogge commented 2 months ago

Awesome!! Also opened a PR to link it to the paper page: https://huggingface.co/Study-is-happy/neuflow-v2/discussions/1.

We will work on adding a dedicated "optical-flow-estimation" tag so that people can easier discover models like yours (cc @merveenoyan).

We also hope researchers can leverage the tools from huggingface_hub for their future works.

Cheers :)

Niels

Study-is-happy commented 2 months ago

Awesome!! Also opened a PR to link it to the paper page: https://huggingface.co/Study-is-happy/neuflow-v2/discussions/1.

We will work on adding a dedicated "optical-flow-estimation" tag so that people can easier discover models like yours (cc @merveenoyan).

We also hope researchers can leverage the tools from huggingface_hub for their future works.

Cheers :)

Niels

Thanks Niels! We have merged the PR on HuggingFace and looking forward to the "optical-flow-estimation" tag!