From 64efeceabdbf7e1e3b2adb7ba060e6b15a9fc086 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Mon, 12 Dec 2022 23:49:12 +0200 Subject: [PATCH] examples : redirect download scripts to HF --- .gitignore | 1 + examples/gpt-2/download-ggml-model.sh | 15 ++++++++++++++- examples/gpt-j/download-ggml-model.sh | 15 ++++++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 58cfed0..9e331d7 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,6 @@ compile_commands.json .exrc .cache +.DS_Store src/arm_neon.h diff --git a/examples/gpt-2/download-ggml-model.sh b/examples/gpt-2/download-ggml-model.sh index 9708618..8856bef 100755 --- a/examples/gpt-2/download-ggml-model.sh +++ b/examples/gpt-2/download-ggml-model.sh @@ -5,6 +5,12 @@ # # If you want to download the original GPT-2 model files, use the "download-model.sh" script instead. +#src="https://ggml.ggerganov.com" +#pfx="ggml-model-gpt-2" + +src="https://huggingface.co/datasets/ggerganov/ggml" +pfx="resolve/main/ggml-model-gpt-2" + ggml_path=$(dirname $(realpath $0)) # GPT-2 models @@ -42,7 +48,14 @@ printf "Downloading ggml model $model ...\n" mkdir -p models/gpt-2-$model -wget --quiet --show-progress -O models/gpt-2-$model/ggml-model.bin https://ggml.ggerganov.com/ggml-model-gpt-2-$model.bin +if [ -x "$(command -v wget)" ]; then + wget --quiet --show-progress -O models/gpt-2-$model/ggml-model.bin $src/$pfx-$model.bin +elif [ -x "$(command -v curl)" ]; then + curl -L --output models/gpt-2-$model/ggml-model.bin $src/$pfx-$model.bin +else + printf "Either wget or curl is required to download models.\n" + exit 1 +fi if [ $? -ne 0 ]; then printf "Failed to download ggml model $model \n" diff --git a/examples/gpt-j/download-ggml-model.sh b/examples/gpt-j/download-ggml-model.sh index f6f5791..76b0a30 100755 --- a/examples/gpt-j/download-ggml-model.sh +++ b/examples/gpt-j/download-ggml-model.sh @@ -5,6 +5,12 @@ # # If you want to download the original GPT-J model files, use the "download-model.sh" script instead. +#src="https://ggml.ggerganov.com" +#pfx="ggml-model-gpt-j" + +src="https://huggingface.co/datasets/ggerganov/ggml" +pfx="resolve/main/ggml-model-gpt-j" + ggml_path=$(dirname $(realpath $0)) # GPT-J models @@ -42,7 +48,14 @@ printf "Downloading ggml model $model ...\n" mkdir -p models/gpt-j-$model -wget --quiet --show-progress -O models/gpt-j-$model/ggml-model.bin https://ggml.ggerganov.com/ggml-model-gpt-j-$model.bin +if [ -x "$(command -v wget)" ]; then + wget --quiet --show-progress -O models/gpt-j-$model/ggml-model.bin $src/$pfx-$model.bin +elif [ -x "$(command -v curl)" ]; then + curl -L --output models/gpt-j-$model/ggml-model.bin $src/$pfx-$model.bin +else + printf "Either wget or curl is required to download models.\n" + exit 1 +fi if [ $? -ne 0 ]; then printf "Failed to download ggml model $model \n"