|
#!/bin/bash |
|
set -e |
|
|
|
echo "Starting initialization of llama.cpp environment..." |
|
|
|
|
|
if [ ! -d "llama.cpp" ]; then |
|
echo "Cloning llama.cpp repository..." |
|
git clone https://github.com/ggml-org/llama.cpp |
|
else |
|
echo "llama.cpp repository already exists. Skipping clone." |
|
fi |
|
|
|
cd llama.cpp |
|
|
|
|
|
echo "Configuring build with cmake..." |
|
cmake -B build |
|
echo "Building llama-server..." |
|
cmake --build build --config Release -t llama-server |
|
|
|
|
|
if [ ! -f "models/sarvam_entity_normalisation_llama_3.1_8b_unsloth.Q4_K_M.gguf" ]; then |
|
echo "Model not found. Downloading the model..." |
|
cd models |
|
wget https://huggingface.co/Tasmay-Tib/sarvam-entity-normalisation-llama-3.1-8b-gguf/resolve/main/sarvam_entity_normalisation_llama_3.1_8b_unsloth.Q4_K_M.gguf |
|
cd .. |
|
else |
|
echo "Model already exists. Skipping download." |
|
fi |
|
|
|
|
|
echo "Starting llama-server in the background..." |
|
cd build |
|
|
|
nohup ./bin/llama-server \ |
|
-m ../models/sarvam_entity_normalisation_llama_3.1_8b_unsloth.Q4_K_M.gguf \ |
|
-n 256 -c 1024 -t 2 -b 1 \ |
|
--temp 0.1 --repeat-penalty 1.1 --top-k 20 \ |
|
--port 8081 --mlock --numa numactl & |
|
disown |
|
echo "llama-server launched. Waiting for the server to initialize..." |
|
|
|
sleep 5 |
|
echo "Initialization complete. Proceeding with Streamlit app startup..." |