This shell script automates the installation, setup, and running of the LlamaCpp server along with the OpenChat 3.5-GGUF model. The script checks if LlamaCpp is already installed and if the required model is downloaded, then proceeds accordingly.
- A Unix-based operating system (Linux, macOS, or WSL on Windows)
- Git
- Curl
- Make
check_error(): Checks for errors after each command and exits if an error occurs.is_llama_installed(): Checks if thellama-serverbinary is already built.is_model_dowloaded(): Checks if the OpenChat 3.5-GGUF model is already downloaded.
-
Clone and Build LlamaCpp:
- Clones the LlamaCpp repository from GitHub if it is not already installed.
- Builds the
llama-serverbinary usingmake.
-
Download the OpenChat Model:
- Downloads the OpenChat 3.5-GGUF model from Hugging Face if it is not already present in the models directory.
-
Start the LlamaCpp Server:
- Runs the LlamaCpp server with the specified model on port
8080.
- Runs the LlamaCpp server with the specified model on port
-
Clone the Repository: Ensure you have the script saved in the desired directory.
-
Allowed permission
chmod +x ./llamacpp.sh
-
Run the Script:
./llamacpp.sh
-
Script Execution:
- The script will first check if
llama-serveris already installed. - If not, it will clone the
llama.cpprepository and build the server. - Then, it checks if the OpenChat 3.5-GGUF model is already downloaded. If not, it will download the model.
- Finally, it starts the
llama-serverusing the downloaded model.
- The script will first check if
-
Access the Server: The server will be accessible at
http://localhost:8080/.
- Ensure that all dependencies (Git, Curl, Make) are installed before running the script.
- The script assumes the presence of a Unix-like environment. Adjustments might be needed for other environments.