How do I upload an .h5 model to Hugging Face models and how can I use these models in Hugging Face spaces?

I want to create a space for my deep learning model saved as an .h5 file. However, spaces only allow a maximum of 10MB. How can I upload the .h5 model to Hugging Face models and use it within spaces for predictions?

Thank you.

We do accept larger files, but you have to handle them as lfs files. We also recommend using our models section and separating the model file from the Space demo Uploading models

However, in both cases, you need to track the large file with git lfs track "*.h5". Please check your repo i.e. .gitattributes and also make sure your git history doesn’t already include the h5.

1 Like

How to set the config files to run the models using API?

Make sure you’re model is transformers compatible, add the corrected task tags and pipeline_tag, then it should work, You can also look at similar models and copy the part of the metadata on the README.md