Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/ggml/blob/master/examples/gpt-2/download-ggml-model.sh # ggml [Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `ggml / examples / gpt-2 / download-ggml-model.sh` 69 lines ยท 1752 bytes Raw Blame History 1 #!/bin/bash 2 3 # This script downloads GPT-2 model files that have already been converted to ggml format. 4 # This way you don't have to convert them yourself. 5 # 6 # If you want to download the original GPT-2 model files, use the "download-model.sh" script instead. 7 8 #src="https://ggml.ggerganov.com" 9 #pfx="ggml-model-gpt-2" 10 11 src="https://huggingface.co/ggerganov/ggml" 12 pfx="resolve/main/ggml-model-gpt-2" 13 14 ggml_path=$(dirname $(realpath $0)) 15 16 # GPT-2 models 17 models=( "117M" "345M" "774M" "1558M" ) 18 19 # list available models 20 function list_models { 21 printf "\n" 22 printf " Available models:" 23 for model in "${models[@]}"; do 24 printf " $model" 25 done 26 printf "\n\n" 27 } 28 29 if [ "$#" -ne 1 ]; then 30 printf "Usage: $0 \n" 31 list_models 32 33 exit 1 34 fi 35 36 model=$1 37 38 if [[ ! " ${models[@]} " =~ " ${model} " ]]; then 39 printf "Invalid model: $model\n" 40 list_models 41 42 exit 1 43 fi 44 45 # download ggml model 46 47 printf "Downloading ggml model $model ...\n" 48 49 mkdir -p models/gpt-2-$model 50 51 if [ -x "$(command -v wget)" ]; then 52 wget --quiet --show-progress -O models/gpt-2-$model/ggml-model.bin $src/$pfx-$model.bin 53 elif [ -x "$(command -v curl)" ]; then 54 curl -L --output models/gpt-2-$model/ggml-model.bin $src/$pfx-$model.bin 55 else 56 printf "Either wget or curl is required to download models.\n" 57 exit 1 58 fi 59 60 if [ $? -ne 0 ]; then 61 printf "Failed to download ggml model $model \n" 62 printf "Please try again later or download the original GPT-2 model files and convert them yourself.\n" 63 exit 1 64 fi 65 66 printf "Done! Model '$model' saved in 'models/gpt-2-$model/ggml-model.bin'\n" 67 printf "You can now use it like this:\n\n" 68 printf " $ ./bin/gpt-2 -m models/gpt-2-$model/ggml-model.bin -p \"This is an example\"\n" 69 printf "\n"