MCG-NJU / EMA-VFI

[CVPR 2023] Extracting Motion and Appearance via Inter-Frame Attention for Efficient Video Frame Interpolatio
Apache License 2.0
399 stars 42 forks source link

Add mixin #28

Open NielsRogge opened 2 months ago

NielsRogge commented 2 months ago

Hi @GuozhenZhang1999 and team,

Thanks for this nice work! This PR aims to improve the discoverability of your models by adding a HF integration.

I wrote a quick PoC to showcase that you can easily have integration with the 🤗 hub so that you can

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

Usage is as follows:

from model.flow_estimation import MultiScaleFlow

# instantiate model
model = MultiScaleFlow(...)

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

# push to hub
model.push_to_hub("MCG-NJU/ema-vfi")

# reload
model = MultiScaleFlow.from_pretrained("MCG-NJU/ema-vfi")

This means people don't need to manually download a checkpoint first in their local environment, it just loads automatically from the hub. Checkpoints could be pushed to https://huggingface.co/MCG-NJU.

Would you be interested in this integration?

Kind regards,

Niels

Note

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