File size: 2,607 Bytes
2e7b88d
 
 
 
 
 
 
 
 
 
 
d0354d2
7b17e5f
5c3be94
2e7b88d
 
 
7b17e5f
2e7b88d
 
da6615b
2e7b88d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d0354d2
7b17e5f
5c3be94
2e7b88d
 
 
7b17e5f
2e7b88d
 
da6615b
2e7b88d
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Checking for the file
# Check if a directory named "llama.cpp" exists in the current folder
echo "Checking if current directory contains llama.cpp folder"
if [ -d "llama.cpp" ]; then
    if [ -d "llama.cpp/build" ]; then
        echo "Changing directory to llama.cpp/build/"
        cd llama.cpp/build
        # Launch llama-server in the background
        echo "Starting llama-server in the background..."
        # cd build
        # & to run process in background, nohup and disown to isolate it from the terminal
        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..."
        # (Optional) Wait a few seconds for the server to start before launching Streamlit
        sleep 5
        echo "Initialization complete. Proceeding with Streamlit app startup..."
    else
        echo "Directory 'build' not found inside 'llama.cpp'"
    fi

# Else, check if the current directory itself is named "llama.cpp"
elif [ "$(basename "$PWD")" = "llama.cpp" ]; then
    echo "First condition is not met, checking if current directory is llama.cpp"
    echo "Current directory is llama.cpp"
    if [ -d "build" ]; then
        echo "Changing directory to build/"
        cd build
        # Launch llama-server in the background
        echo "Starting llama-server in the background..."
        # cd build
        # & to run process in background, nohup and disown to isolate it from the terminal
        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..."
        # (Optional) Wait a few seconds for the server to start before launching Streamlit
        sleep 5
        echo "Initialization complete. Proceeding with Streamlit app startup..."
    else
        echo "Directory 'build' not found in the current 'llama.cpp' folder"
    fi

# If neither condition is met, echo an appropriate message along with the current working directory
else
    echo "'llama.cpp' was not found in the current folder, and the current directory is not 'llama.cpp'."
    echo "Current working directory: $(pwd)"
fi