Push keras to hub fail because of binary files

Hello,

When trying to push a custom keras model to huggingface hub, I received the following error:

remote: -------------------------------------------------------------------------        
remote: Your push was rejected because it contains binary files.        
remote: Please use https://git-lfs.github.com/ to store binary files.        
remote: See also: https://hf.co/docs/hub/repositories-getting-started#terminal        
remote: -------------------------------------------------------------------------        
remote: Offending files:        
remote:  - variables/variables.data-00000-of-00001 (ref: refs/heads/main)        
To https://huggingface.co/martin-ha/text_image_dual_encoder

I run the code in colab with following library version:

%pip install -q -U tensorflow==2.9.1 tensorflow-hub==0.12.0 tensorflow-text==2.9.0 tensorflow-addons==0.17.1 huggingface_hub==0.7.0

I read this issue but the fix does not appear to work for me. You can reproduce this error in this colab notebook. Could someone help me solve this issue? Thanks!

1 Like

Hello there :wave:

You need to use push_to_hub_keras() (I realized there’s a bug in push_to_hub). I managed to upload your model here. I have a blog post on how to get the best of push_to_hub_keras() if you’re interested. Below is my code.

from huggingface_hub import push_to_hub_keras

push_to_hub_keras(dual_encoder, “merve/text_image_dual_encoder”)

1 Like

push_to_hub_keras() solve the issue for me. Thanks Merve!

1 Like