From ca0debdb7080952cd50e057d3dec30b9e8bdfe0a Mon Sep 17 00:00:00 2001 From: axel7083 <42176370+axel7083@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:08:16 +0200 Subject: [PATCH 1/4] chore: update run.sh script Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com> --- chat/requirements.txt | 2 +- chat/run.sh | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/chat/requirements.txt b/chat/requirements.txt index bbea3dd..d0a27bb 100644 --- a/chat/requirements.txt +++ b/chat/requirements.txt @@ -1 +1 @@ -llama-cpp-python[server] \ No newline at end of file +llama-cpp-python[server]==0.2.57 \ No newline at end of file diff --git a/chat/run.sh b/chat/run.sh index 756a9e9..23a0f53 100755 --- a/chat/run.sh +++ b/chat/run.sh @@ -15,4 +15,15 @@ # limitations under the License. # # SPDX-License-Identifier: Apache-2.0 -python -m llama_cpp.server --model ${MODEL_PATH} --host ${HOST:=0.0.0.0} --port ${PORT:=8000} --n_gpu_layers 0 +if [ ${CONFIG_PATH} ] || [[ ${MODEL_PATH} && ${CONFIG_PATH} ]]; then + python -m llama_cpp.server --config_file ${CONFIG_PATH} + exit 0 +fi + +if [ ${MODEL_PATH} ]; then + python -m llama_cpp.server --model ${MODEL_PATH} --host ${HOST:=0.0.0.0} --port ${PORT:=8001} --n_gpu_layers ${GPU_LAYERS:=0} --clip_model_path ${CLIP_MODEL_PATH:=None} --chat_format ${CHAT_FORMAT:="llama-2"} + exit 0 +fi + +echo "Please set either a CONFIG_PATH or a MODEL_PATH" +exit 1 \ No newline at end of file From 4a60c332d58c4db3d6a9290dad2bd19459a2e72d Mon Sep 17 00:00:00 2001 From: axel7083 <42176370+axel7083@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:36:49 +0200 Subject: [PATCH 2/4] fix: removing config file related code Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com> --- chat/run.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/chat/run.sh b/chat/run.sh index 23a0f53..913f303 100755 --- a/chat/run.sh +++ b/chat/run.sh @@ -15,15 +15,10 @@ # limitations under the License. # # SPDX-License-Identifier: Apache-2.0 -if [ ${CONFIG_PATH} ] || [[ ${MODEL_PATH} && ${CONFIG_PATH} ]]; then - python -m llama_cpp.server --config_file ${CONFIG_PATH} - exit 0 -fi - if [ ${MODEL_PATH} ]; then python -m llama_cpp.server --model ${MODEL_PATH} --host ${HOST:=0.0.0.0} --port ${PORT:=8001} --n_gpu_layers ${GPU_LAYERS:=0} --clip_model_path ${CLIP_MODEL_PATH:=None} --chat_format ${CHAT_FORMAT:="llama-2"} exit 0 fi -echo "Please set either a CONFIG_PATH or a MODEL_PATH" +echo "Please set MODEL_PATH" exit 1 \ No newline at end of file From bfc710495aa3c8d9184b3f9969476b994afd92e4 Mon Sep 17 00:00:00 2001 From: axel7083 <42176370+axel7083@users.noreply.github.com> Date: Wed, 10 Apr 2024 15:47:56 +0200 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Florent BENOIT Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com> --- chat/requirements.txt | 2 +- chat/run.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chat/requirements.txt b/chat/requirements.txt index d0a27bb..66f8c7b 100644 --- a/chat/requirements.txt +++ b/chat/requirements.txt @@ -1 +1 @@ -llama-cpp-python[server]==0.2.57 \ No newline at end of file +llama-cpp-python[server]==0.2.57 diff --git a/chat/run.sh b/chat/run.sh index 913f303..a0bc888 100755 --- a/chat/run.sh +++ b/chat/run.sh @@ -20,5 +20,5 @@ if [ ${MODEL_PATH} ]; then exit 0 fi -echo "Please set MODEL_PATH" -exit 1 \ No newline at end of file +echo "This image should not be used outside of Podman Desktop AI Lab extension. Missing required MODEL_PATH environment variable." +exit 1 From c55c6df39b88673a67c1cfef40881f3826d489ae Mon Sep 17 00:00:00 2001 From: axel7083 <42176370+axel7083@users.noreply.github.com> Date: Thu, 11 Apr 2024 14:09:21 +0200 Subject: [PATCH 4/4] Update chat/run.sh Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com> --- chat/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chat/run.sh b/chat/run.sh index a0bc888..699a010 100755 --- a/chat/run.sh +++ b/chat/run.sh @@ -16,7 +16,7 @@ # # SPDX-License-Identifier: Apache-2.0 if [ ${MODEL_PATH} ]; then - python -m llama_cpp.server --model ${MODEL_PATH} --host ${HOST:=0.0.0.0} --port ${PORT:=8001} --n_gpu_layers ${GPU_LAYERS:=0} --clip_model_path ${CLIP_MODEL_PATH:=None} --chat_format ${CHAT_FORMAT:="llama-2"} + python -m llama_cpp.server --model ${MODEL_PATH} --host ${HOST:=0.0.0.0} --port ${PORT:=8001} --n_gpu_layers ${GPU_LAYERS:=0} --clip_model_path ${CLIP_MODEL_PATH:=None} --chat_format ${MODEL_CHAT_FORMAT:="llama-2"} exit 0 fi