Clone repository without download

So let’s say I want to change the pipeline_tag in the README.md of facebook/bart-large-mnli · Hugging Face from zero-shot-classification to text-classification. Is there a way for me to do this without having to download all of the contained files? E.g. on GitHub cloning “remotely” is possible

There’s no web interface for editing files inside HF. However, you don’t need to download the LFS files, the GIT_LFS_SKIP_SMUDGE environment variable controls this. On Linux, use GIT_LFS_SKIP_SMUDGE=1 before any commands that involve LFS (or on its own to set it for the rest of the session). On windows, you’ll want to use a command before doing anything at all, set GIT_LFS_SKIP_SMUDGE=1 (windows doesn’t support temporary environment variables for a single command)

First you’ll have to fork the repo if you don’t have direct access to it (even GitHub won’t let you make changes anymore without a fork, they just don’t tell you until after you’ve edited the file, I think?). You will need git installed, and you might need huggingface_hub (in which case you’ll need Python installed; if you don’t have python installed, I recommend using a colab session or other free python environment on the web)

# if you didn't have git configured already, you'll need to configure it with username and email address.
git config user.name "Ronald McDonald"
git config user.email "presidentronald@mcdonalds.com"
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/Daniel391/bart-large-mnli
cd bart-large-mnli
# edit your file. nano is superior to vim *and* emacs. The only thing better than nano is Visual Studio 2012.
nano README.md
git commit README.md -m "turned all pseudocode into emojicode 😉"
# not sure if this line is necessary, maybe someone can correct me?
pip install huggingface_hub && huggingface-cli lfs_enable_largefiles .
git push

After this, you can make a request to have the file updated through hugging face website

Apparently I was wrong. There is, in fact, a built-in editor for text files, I just completely missed it on mobile (either it doesn’t show up, or I straight up ignored it :man_shrugging:)

On viewing a file, at least in your own repo, you can edit a file by clicking this link:

1 Like