Skip to content

Instantly share code, notes, and snippets.

@mlabonne
Last active April 2, 2024 14:20
Show Gist options
  • Save mlabonne/9d85e1bb8fc3efe8649b677845c83bdb to your computer and use it in GitHub Desktop.
Save mlabonne/9d85e1bb8fc3efe8649b677845c83bdb to your computer and use it in GitHub Desktop.
#!/bin/bash
WORKSPACE=${WORKSPACE:-"/workspace"}
cd $WORKSPACE
# Install Axolotl and dependencies
git clone https://github.com/OpenAccess-AI-Collective/axolotl
cd axolotl
pip3 install packaging huggingface_hub
pip3 install -e '.[flash-attn,deepspeed]'
# Install screen
apt install -y screen
screen -S main
# Train model
curl -o config.yaml $GIST_URL
mkdir out
accelerate launch -m axolotl.cli.train config.yaml
# Merge adapter
# CUDA_VISIBLE_DEVICES="" python3 -m axolotl.cli.merge_lora config.yaml --lora_model_dir=out
# Merge and upload model
wget https://gist.githubusercontent.com/mlabonne/522857e8d2aaf647451a09705fceb275/raw/c8e5aa66eec40c369bf8eaffcd2575bec79a919d/merge_upload.py
python merge_upload.py --base_model=$BASE_MODEL --peft_model="./out/" --hub_id=$MODEL_NAME
# Upload merged model
huggingface-cli upload --repo-type model $MODEL_NAME $MODEL_NAME .
# LLM AutoEval
if [ "$LLM_AUTOEVAL" == "True" ]; then
git clone https://github.com/mlabonne/llm-autoeval.git
bash $(basename https://github.com/mlabonne/llm-autoeval.git .git)/runpod.sh
fi
# Kill pod
if [ "$DEBUG" == "False" ]; then
runpodctl remove pod $RUNPOD_POD_ID
fi
sleep infinity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment