Skip to content

Instantly share code, notes, and snippets.

@vuiseng9
Last active December 26, 2023 20:54
Show Gist options
  • Save vuiseng9/a5fd66645c6e3dcd66480911c8aa2523 to your computer and use it in GitHub Desktop.
Save vuiseng9/a5fd66645c6e3dcd66480911c8aa2523 to your computer and use it in GitHub Desktop.
# Ensure git-lfs is installed.

REPO_ID=<label>

# create a repo with your account in model hub
huggingface-cli repo create $REPO_ID

# clone the newly-created repo (git clone command will be printed)
git clone https://huggingface.co/<hf-userid>/<repo_id>

cd $REPO_ID

# Initialize git lfs for the repo, model hub requires file larger than 10MB to be tracked via git-lfs
git lfs install

# put content in the local repo directory

# filter file size > 10MB
find . -type f -size +10M

# track with lfs for file size > 10MB
git lfs track [file path]

# To enable upload of files > 5GB.
huggingface-cli lfs-enable-largefiles .

# commit and push like standard process of github
@vuiseng9
Copy link
Author

snippet to prune checkpoints in output folder

# for a range of id
END=5
for i in $(seq 1 $END); do
    echo checkpoint-1${i}???/ 
    #rm -rf ...
done

# for more than a run in current directory
for d in */ ; do 
    echo "$d" 
    #ls -d $d/checkpoint-1[0-7]???/ 
    #rm -rf $d/checkpoint-*/ 
done

@vuiseng9
Copy link
Author

Create private repo using python api

from huggingface_hub import login, create_repo
login()
create_repo("<model id>", private=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment