From e535c212a10b9740e9cde0715db859c24e16420c Mon Sep 17 00:00:00 2001 From: xiagw Date: Mon, 14 Aug 2023 16:59:03 +0800 Subject: [PATCH 1/3] add one-key-start run.sh --- run.sh | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 run.sh diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..bbb59f7 --- /dev/null +++ b/run.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +me_path="$(dirname "$(readlink -f "$0")")" + +case "$1" in +7b) + image_name=soulteary/llama2 + tag_name=7b + docker_file=docker/Dockerfile.7b + mod_path=meta-llama + ;; +7b-cn) + image_name=soulteary/llama2 + tag_name=7b-cn + docker_file=docker/Dockerfile.7b-cn + mod_path=LinkSoul + ;; +7b-cn-4bit) + image_name=soulteary/llama2 + tag_name=7b-cn-4bit + docker_file=docker/Dockerfile.7b-cn-4bit + mod_path=soulteary + ;; +13b) + image_name=soulteary/llama2 + tag_name=13b + docker_file=docker/Dockerfile.13b + mod_path=meta-llama + ;; +*) + cat < Date: Mon, 14 Aug 2023 17:06:36 +0800 Subject: [PATCH 2/3] remove scripts --- README.md | 28 ++++++++++++++-------------- README_EN.md | 28 ++++++++++++++-------------- run.sh | 2 +- scripts/make-13b.sh | 5 ----- scripts/make-7b-cn-4bit.sh | 5 ----- scripts/make-7b-cn.sh | 5 ----- scripts/make-7b.sh | 5 ----- scripts/run-13b.sh | 3 --- scripts/run-7b-cn-4bit.sh | 3 --- scripts/run-7b-cn.sh | 3 --- scripts/run-7b.sh | 3 --- 11 files changed, 29 insertions(+), 61 deletions(-) delete mode 100755 scripts/make-13b.sh delete mode 100755 scripts/make-7b-cn-4bit.sh delete mode 100755 scripts/make-7b-cn.sh delete mode 100755 scripts/make-7b.sh delete mode 100755 scripts/run-13b.sh delete mode 100755 scripts/run-7b-cn-4bit.sh delete mode 100755 scripts/run-7b-cn.sh delete mode 100755 scripts/run-7b.sh diff --git a/README.md b/README.md index 7f33fd7..b164567 100644 --- a/README.md +++ b/README.md @@ -38,16 +38,16 @@ ```bash # 7B -bash scripts/make-7b.sh +bash run.sh 7b -# 或 13B -bash scripts/make-13b.sh +# 13B +bash run.sh 13b -# 或 7B Chinese -bash scripts/make-7b-cn.sh +# 7B Chinese +bash run.sh 7b-cn -# 或 7B Chinese 4bit -bash scripts/make-7b-cn-4bit.sh +# 7B Chinese 4bit +bash run.sh 7b-cn-4bit ``` 2. 选择适合你的命令,从 HuggingFace 下载 LLaMA2 或中文模型: @@ -127,13 +127,13 @@ meta-llama ```bash # 7B -bash scripts/run-7b.sh -# 或 13B -bash scripts/run-13b.sh -# 或 Chinese 7B -bash scripts/run-7b-cn.sh -# 或 Chinese 7B 4BIT -bash scripts/run-7b-cn-4bit.sh +bash run.sh 7b +# 13B +bash run.sh 13b +# Chinese 7B +bash run.sh 7b-cn +# Chinese 7B 4BIT +bash run.sh 7b-cn-4bit ``` 模型运行之后,在浏览器中访问 `http://localhost7860` 或者 `http://你的IP地址:7860` 就可以开始玩了。 diff --git a/README_EN.md b/README_EN.md index 49c9809..acaad3b 100644 --- a/README_EN.md +++ b/README_EN.md @@ -39,16 +39,16 @@ Get started quickly, locally using the 7B or 13B models, using Docker. ```bash # 7B -bash scripts/make-7b.sh +bash run.sh 7b -# OR 13B -bash scripts/make-13b.sh +# 13B +bash run.sh 13b -# OR 7B Chinese -bash scripts/make-7b-cn.sh +# 7B Chinese +bash run.sh 7b-cn -# OR 7B Chinese 4bit -bash scripts/make-7b-cn-4bit.sh +# 7B Chinese 4bit +bash run.sh 7b-cn-4bit ``` 2. Download LLaMA2 Models from HuggingFace, or chinese models. @@ -128,13 +128,13 @@ meta-llama ```bash # 7B -bash scripts/run-7b.sh -# OR 13B -bash scripts/run-13b.sh -# OR Chinese 7B -bash scripts/run-7b-cn.sh -# OR Chinese 7B 4BIT -bash scripts/run-7b-cn-4bit.sh +bash run.sh 7b +# 13B +bash run.sh 13b +# Chinese 7B +bash run.sh 7b-cn +# Chinese 7B 4BIT +bash run.sh 7b-cn-4bit ``` enjoy, open `http://localhost7860` or `http://ip:7860` and play with the LLaMA2! diff --git a/run.sh b/run.sh index bbb59f7..76e8e2d 100644 --- a/run.sh +++ b/run.sh @@ -56,6 +56,6 @@ else fi docker run --gpus all --rm -it --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 \ - -p 7861:7860 \ + -p 7860:7860 \ -v "$me_path/$mod_path":"/app/$mod_path" \ "${image_name}:${tag_name}" diff --git a/scripts/make-13b.sh b/scripts/make-13b.sh deleted file mode 100755 index dac1284..0000000 --- a/scripts/make-13b.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -docker build -t soulteary/llama2:base . -f docker/Dockerfile.base - -docker build -t soulteary/llama2:13b . -f docker/Dockerfile.13b diff --git a/scripts/make-7b-cn-4bit.sh b/scripts/make-7b-cn-4bit.sh deleted file mode 100755 index 2b24b70..0000000 --- a/scripts/make-7b-cn-4bit.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -docker build -t soulteary/llama2:base . -f docker/Dockerfile.base - -docker build -t soulteary/chinese-llama2:7b-4bit . -f docker/Dockerfile.7b-cn-4bit diff --git a/scripts/make-7b-cn.sh b/scripts/make-7b-cn.sh deleted file mode 100755 index 526b9d3..0000000 --- a/scripts/make-7b-cn.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -docker build -t soulteary/llama2:base . -f docker/Dockerfile.base - -docker build -t soulteary/llama2:7b-cn . -f docker/Dockerfile.7b-cn diff --git a/scripts/make-7b.sh b/scripts/make-7b.sh deleted file mode 100755 index 791951c..0000000 --- a/scripts/make-7b.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -docker build -t soulteary/llama2:base . -f docker/Dockerfile.base - -docker build -t soulteary/llama2:7b . -f docker/Dockerfile.7b diff --git a/scripts/run-13b.sh b/scripts/run-13b.sh deleted file mode 100755 index f35f3eb..0000000 --- a/scripts/run-13b.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -docker run --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 --rm -it -v `pwd`/meta-llama:/app/meta-llama -p 7860:7860 soulteary/llama2:13b diff --git a/scripts/run-7b-cn-4bit.sh b/scripts/run-7b-cn-4bit.sh deleted file mode 100755 index bee4d76..0000000 --- a/scripts/run-7b-cn-4bit.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -docker run --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 --rm -it -v `pwd`/soulteary:/app/soulteary -p 7860:7860 soulteary/chinese-llama2:7b-4bit diff --git a/scripts/run-7b-cn.sh b/scripts/run-7b-cn.sh deleted file mode 100755 index 4fcc5af..0000000 --- a/scripts/run-7b-cn.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -docker run --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 --rm -it -v `pwd`/LinkSoul:/app/LinkSoul -p 7860:7860 soulteary/llama2:7b-cn \ No newline at end of file diff --git a/scripts/run-7b.sh b/scripts/run-7b.sh deleted file mode 100755 index d866763..0000000 --- a/scripts/run-7b.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -docker run --gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 --rm -it -v `pwd`/meta-llama:/app/meta-llama -p 7860:7860 soulteary/llama2:7b From 0a662adc1084cc97778778616dc3acbce49494b4 Mon Sep 17 00:00:00 2001 From: xiagw Date: Mon, 14 Aug 2023 17:21:07 +0800 Subject: [PATCH 3/3] add download models --- run.sh | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/run.sh b/run.sh index 76e8e2d..6dde540 100644 --- a/run.sh +++ b/run.sh @@ -7,26 +7,34 @@ case "$1" in image_name=soulteary/llama2 tag_name=7b docker_file=docker/Dockerfile.7b + # MetaAI LLaMA2 Models (10~14GB vRAM) + mod_url=https://huggingface.co/meta-llama/Llama-2-7b-chat-hf + mod_path=meta-llama + ;; +13b) + image_name=soulteary/llama2 + tag_name=13b + docker_file=docker/Dockerfile.13b + # MetaAI LLaMA2 Models (10~14GB vRAM) + mod_url=https://huggingface.co/meta-llama/Llama-2-13b-chat-hf mod_path=meta-llama ;; 7b-cn) image_name=soulteary/llama2 tag_name=7b-cn docker_file=docker/Dockerfile.7b-cn + # 或 Chinese LLaMA2 (10~14GB vRAM) + mod_url=https://huggingface.co/LinkSoul/Chinese-Llama-2-7b mod_path=LinkSoul ;; 7b-cn-4bit) image_name=soulteary/llama2 tag_name=7b-cn-4bit docker_file=docker/Dockerfile.7b-cn-4bit + # 或 Chinese LLaMA2 4BIT (5GB vRAM) + mod_url=https://huggingface.co/soulteary/Chinese-Llama-2-7b-4bit mod_path=soulteary ;; -13b) - image_name=soulteary/llama2 - tag_name=13b - docker_file=docker/Dockerfile.13b - mod_path=meta-llama - ;; *) cat <