Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git add with auto_lfs_track should track binary files #687

Closed
osanseviero opened this issue Feb 16, 2022 · 7 comments · Fixed by #828
Closed

Git add with auto_lfs_track should track binary files #687

osanseviero opened this issue Feb 16, 2022 · 7 comments · Fixed by #828

Comments

@osanseviero
Copy link
Member

When pushing binary files, users get the following error

remote: Your push was rejected because it contains binary files.
remote: Please use https://git-lfs.github.com/ to store binary files.

With auto LFS track this should be tracked by default.

WDYT @LysandreJik @julien-c ?

@julien-c
Copy link
Member

i don't remember the auto_lfs_track implementation, is there a file size threshold somewhere? We changed the file size threshold for binary files only to 1MB on the hub side recently. Non binary files still 10MB

@osanseviero
Copy link
Member Author

Yes, we set a 10mb auto track at https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/repository.py#L849-L853

We could do some similar check for binary files for 1MB?

@julien-c
Copy link
Member

yes!

and sorry about not thinking of this when we changed the thresholds on the hub side (@Pierrci @SBrandeis @coyotte508 )

@LysandreJik
Copy link
Member

Hey @osanseviero, indeed, happy to do that. Do you have a reproducible code example I can play with?

@osanseviero
Copy link
Member Author

Yes @LysandreJik.

from huggingface_hub import Repository, HfApi
import os

repo_url = HfApi().create_repo("test-bin-bug")
repo = Repository("local_repo", clone_from=repo_url)
with open(os.path.join("local_repo", "file"), "wb") as out:
    out.truncate(1024*1024)
repo.push_to_hub("Commit #1")

@Pierrci
Copy link
Member

Pierrci commented Feb 16, 2022

@LysandreJik you can check https://github.com/huggingface/moon-landing/blob/5fa4de96cb48dc0613933d2aa7e3311bbd0abaac/server/scripts/git/pre-receive#L143 for what we use server-side to detect binary files (cc @coyotte508 who implemented it)

@LysandreJik
Copy link
Member

Will be closed by #828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants