Closed hahunavth closed 12 months ago
Hi @hahunavth, thanks for reporting. I think it's due to a forgotten case where less than 5 files are to be staged.
If we replace
if len(files_to_stage) > 5:
files_in_msg = str(files_to_stage[:5])[:-1] + ", ...]"
by
files_in_msg = str(files_to_stage[:5])[:-1] + ", ...]" if len(files_to_stage) > 5 else str(files_to_stage)
in the snippet you've shared, it should fix it.
Would you like to open a PR for that? :)
Also, Repository
is a bit of legacy code now. It is still supported and maintained but we are slowly moving out from it in favor of more practical http-based methods. For more details, check out this explanation guide.
Hi @Wauplin, thanks for the quick response and for pinpointing the issue. I've submitted a pull request with the proposed code change. You can review it by following this #1722 . I'm a new to Hugging Face, the information and the link to the explanation guide you provided have been very helpful to me. Thank you for your assistance!
Great, thank you! I'll merge the PR once the CI is happy :) Have a great continuation with HF ecosystem :hugs:
Describe the bug
When using the commit context manager to clone, create a commit with a file, and push, an UnboundLocalError is raised in the Hugging Face library code. This error occurs when manually copying a file to the local repository directory and then rerunning the process.
Reproduction
Logs
System info