Richard Durkee
10/27/2024, 4:17 PMChaoyu
10/28/2024, 1:43 PMZak Ozbourne
10/28/2024, 9:52 PMZak Ozbourne
10/28/2024, 9:54 PMRichard Durkee
10/29/2024, 12:14 AMZak Ozbourne
10/29/2024, 1:04 AMsudo apt install python3-pip
pip install -U bentoml
pip install -U openllm
pip install vllm
this one takes a while
pip install --upgrade jsonschema
create a fork of <https://github.com/bentoml/openllm-models>
(https://github.com/bentoml/openllm-models/fork)
Name it custom-openllm-models
Clone to your machine
git clone <https://github.com/{git_username}/custom-openllm-models.git>
------------------------------
To add your own models, navigate to ~/custom-openllm-models/src and edit recipe.yaml
Here is an example, add this to the end of the recipe.yaml
You may need to edit these depending on your model type and size.
"mistral:7b-dolphin-bf16":
project: vllm-chat
service_config:
name: dolphin2_9_3
workers: 1
traffic:
timeout: 300
resources:
gpu: 1
gpu_type: nvidia-rtx-3090
engine_config:
model: cognitivecomputations/dolphin-2.9.3-mistral-7B-32k
max_model_len: 28704
enforce_eager: true
dtype: half
tensor_parallel_size: 1
extra_labels:
openllm_alias: 7b
model_name: cognitivecomputations/dolphin-2.9.3-mistral-7B-32k
max_tokens:
default: 28704
maximum: 28704
minimum: 128
title: Max Tokens
type: integer
--------------------
cd ~/custom-openllm-models/src/vllm-chat
pip install -r requirements.txt -U
this one also takes a long time
cd ~/custom-openllm-models/src
BENTOML_HOME=/home/bentobox/custom-openllm-models/bentoml/ python3 make.py "mistral:7b-dolphin-bf16"
Use the Title of the custom model from recipe.yaml
"mistral:7b-dolphin-bf16"
nano ~/.bashrc
echo 'export PATH=$PATH:/home/bentobox/.local/bin' >> ~/.bashrc
source ~/.bashrc
Remove the default openLLM repo and add your new custom one:
openllm repo remove default
`openllm repo add default https://github.com/{username}/custom-openllm-models
openllm repo update
Run OpenLLM
openllm hello
You should see a list of models and options on how to run them.
the first run will take time to start as it has to download the model files
----
## Here is a bash file i made to streamline the building process
bash
#!/bin/bash
# Prompt for the model name
read -p "Enter the model name (e.g., mistral:7b-dolphin-bf16): " MODEL_NAME
# Navigate to the specified directory
cd ~/custom-openllm-models || { echo "Failed to navigate to ~/custom-openllm-models"; exit 1; }
# Perform git pull
git pull || { echo "Git pull failed"; exit 1; }
# Navigate to src directory
cd src || { echo "Failed to navigate to src"; exit 1; }
# Run the make.py script with the specified model name
BENTOML_HOME=/home/bentobox/custom-openllm-models/bentoml/ python3 make.py "$MODEL_NAME" || { echo "Python script execution failed"; exit 1; }
# Navigate back to the parent directory
cd ..
# Perform git add, commit, and push
git add . || { echo "Git add failed"; exit 1; }
git commit -m "built $MODEL_NAME" || { echo "Git commit failed"; exit 1; }
git push || { echo "Git push failed"; exit 1; }
# Update openllm repo
openllm repo update || { echo "openllm repo update failed"; exit 1; }
echo "Script executed successfully"
-------
### Setting up OpenLLM as Service
sudo nano /etc/systemd/system/openllm-dolphin.service
[Unit]
Description=OpenLLM Dolphin Service
After=network.target
[Service]
Type=simple
User=bentobox
WorkingDirectory=/home/{username}
ExecStart=/home/{username}/.local/bin/openllm serve dolphin2_9_3:7b
Restart=on-failure
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl start openllm-dolphin
sudo systemctl enable openllm-dolphin
sudo systemctl status openllm-dolphinZak Ozbourne
10/29/2024, 1:04 AMRichard Durkee
10/29/2024, 2:39 PMZak Ozbourne
11/12/2024, 6:13 AM