Skip to content

Instantly share code, notes, and snippets.

@TaylorBurnham
Created August 26, 2023 14:53
Show Gist options
  • Save TaylorBurnham/09f00bd661ab7c005e21d91acf763202 to your computer and use it in GitHub Desktop.
Save TaylorBurnham/09f00bd661ab7c005e21d91acf763202 to your computer and use it in GitHub Desktop.
CodeLlama Download

This is a quick and dirty script to pull specific files from HuggingFace using Git LFS, but only pulling the file based off the quant method.

./download_hf_model.sh "TheBloke" "CodeLlama-34B-Python-GGUF" "Q5_K_M.gguf"

This will download only the file with the quant method Q5_K_M, which keeps you from downloading 150GB+ of data. If you want all of the CodeLlama GGUF models you can use this for loop.

OWNER="TheBloke"
FORMAT="GGUF"
MODEL_LIST="CodeLlama-7B CodeLlama-13B CodeLlama-34B"
MODEL_TYPE="Instruct Python"
for REPO_NAME in $(echo ${MODEL_LIST}); do 
    MODEL_NAME="${REPO_NAME}-${FORMAT}";
    echo "Pulling ${OWNER}/${MODEL_NAME}"
    ./get_hf_repo.sh "${OWNER}" "${MODEL_NAME}"
    for REPO_TYPE in $(echo ${MODEL_TYPE}); do 
        MODEL_NAME="${REPO_NAME}-${REPO_TYPE}-${FORMAT}";
        echo "Pulling ${OWNER}/${MODEL_NAME}"
        ./get_hf_repo.sh "${OWNER}" "${MODEL_NAME}"
    done;
done
#!/bin/bash
OWNER="${1:-TheBloke}"
REPO="${2:-CodeLlama-13B-GGUF}"
FILE="${3:-Q5_K_M.gguf}"
URL="https://huggingface.co/${OWNER}/${REPO}"
# Performs a clone and only sets file pointers for LFS objects.
GIT_LFS_SKIP_SMUDGE=1 git clone "${URL}"
# Pull the specific file, rather than all
cd "${REPO}" && git lfs pull -I "*.${FILE}" && cd ..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment