11#! /bin/bash
22
33# # Example run command
4- # ./linux-and-mac.sh './jan/plugins/@janhq/inference-plugin/dist/nitro /nitro_mac_arm64' https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v0.3-GGUF/resolve/main/tinyllama-1.1b-chat-v0.3.Q2_K.gguf
4+ # ./linux-and-mac.sh './jan/plugins/@janhq/inference-plugin/dist/cortex-cpp /nitro_mac_arm64' https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v0.3-GGUF/resolve/main/tinyllama-1.1b-chat-v0.3.Q2_K.gguf
55
66# Check for required arguments
77if [[ $# -ne 3 ]]; then
88 echo " Usage: $0 <path_to_binary> <url_to_download_llm> <url_to_download_embedding>"
99 exit 1
1010fi
1111
12- rm /tmp/load-llm-model-res.log /tmp/completion-res.log /tmp/unload-model-res.log /tmp/load-embedding-model-res.log /tmp/embedding-res.log /tmp/nitro .log
12+ rm /tmp/load-llm-model-res.log /tmp/completion-res.log /tmp/unload-model-res.log /tmp/load-embedding-model-res.log /tmp/embedding-res.log /tmp/cortex-cpp .log
1313
1414BINARY_PATH=$1
1515DOWNLOAD_LLM_URL=$2
@@ -22,14 +22,14 @@ range=$((max - min + 1))
2222PORT=$(( RANDOM % range + min))
2323
2424# Start the binary file
25- " $BINARY_PATH " 1 127.0.0.1 $PORT > /tmp/nitro .log &
25+ " $BINARY_PATH " 1 127.0.0.1 $PORT > /tmp/cortex-cpp .log &
2626
2727# Get the process id of the binary file
2828pid=$!
2929
3030if ! ps -p $pid > /dev/null; then
31- echo " nitro failed to start. Logs:"
32- cat /tmp/nitro .log
31+ echo " cortex-cpp failed to start. Logs:"
32+ cat /tmp/cortex-cpp .log
3333 exit 1
3434fi
3535
@@ -47,7 +47,7 @@ if [[ ! -f "/tmp/test-embedding" ]]; then
4747fi
4848
4949# Run the curl commands
50- response1=$( curl --connect-timeout 60 -o /tmp/load-llm-model-res.log -s -w " %{http_code}" --location " http://127.0.0.1:$PORT /inferences/llamacpp /loadModel" \
50+ response1=$( curl --connect-timeout 60 -o /tmp/load-llm-model-res.log -s -w " %{http_code}" --location " http://127.0.0.1:$PORT /inferences/server /loadModel" \
5151 --header ' Content-Type: application/json' \
5252 --data ' {
5353 "llama_model_path": "/tmp/testllm",
@@ -57,8 +57,8 @@ response1=$(curl --connect-timeout 60 -o /tmp/load-llm-model-res.log -s -w "%{ht
5757}' )
5858
5959if ! ps -p $pid > /dev/null; then
60- echo " nitro failed to load model. Logs:"
61- cat /tmp/nitro .log
60+ echo " cortex-cpp failed to load model. Logs:"
61+ cat /tmp/cortex-cpp .log
6262 exit 1
6363fi
6464
@@ -83,14 +83,14 @@ response2=$(
8383)
8484
8585# unload model
86- response3=$( curl --connect-timeout 60 -o /tmp/unload-model-res.log --request GET -s -w " %{http_code}" --location " http://127.0.0.1:$PORT /inferences/llamacpp /unloadModel" \
86+ response3=$( curl --connect-timeout 60 -o /tmp/unload-model-res.log --request GET -s -w " %{http_code}" --location " http://127.0.0.1:$PORT /inferences/server /unloadModel" \
8787 --header ' Content-Type: application/json' \
8888 --data ' {
8989 "llama_model_path": "/tmp/testllm"
9090}' )
9191
9292# load embedding model
93- response4=$( curl --connect-timeout 60 -o /tmp/load-embedding-model-res.log -s -w " %{http_code}" --location " http://127.0.0.1:$PORT /inferences/llamacpp /loadModel" \
93+ response4=$( curl --connect-timeout 60 -o /tmp/load-embedding-model-res.log -s -w " %{http_code}" --location " http://127.0.0.1:$PORT /inferences/server /loadModel" \
9494 --header ' Content-Type: application/json' \
9595 --data ' {
9696 "llama_model_path": "/tmp/test-embedding",
@@ -145,9 +145,9 @@ if [[ "$response5" -ne 200 ]]; then
145145fi
146146
147147if [[ " $error_occurred " -eq 1 ]]; then
148- echo " Nitro test run failed!!!!!!!!!!!!!!!!!!!!!!"
149- echo " Nitro Error Logs:"
150- cat /tmp/nitro .log
148+ echo " cortex-cpp test run failed!!!!!!!!!!!!!!!!!!!!!!"
149+ echo " cortex-cpp Error Logs:"
150+ cat /tmp/cortex-cpp .log
151151 kill $pid
152152 exit 1
153153fi
@@ -172,7 +172,7 @@ echo "----------------------"
172172echo " Log run test:"
173173cat /tmp/embedding-res.log
174174
175- echo " Nitro test run successfully!"
175+ echo " cortex-cpp test run successfully!"
176176
177177# Kill the server process
178178kill $pid
0 commit comments