File size: 1,251 Bytes
9f13819 1a0fc72 9f13819 99023cb 9f13819 8ed221f 99023cb 9f13819 1a0fc72 9f13819 1a0fc72 99023cb 9f13819 1a0fc72 9f13819 1a0fc72 9f13819 1a0fc72 9f13819 1a0fc72 9f13819 |
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 |
#!/bin/bash
echo "Starting building the environment..."
uv sync --offline
echo "Activated virtual environment"
source .venv/bin/activate
echo "Copying files..."
cp debug/utils.py .venv/lib/python3.10/site-packages/transformers/generation/utils.py
cp debug/modeling_llama.py .venv/lib/python3.10/site-packages/transformers/models/llama/modeling_llama.py
if [ -d "$HOME/Llama-2-7b-hf" ]; then
export LLM_PATH="$HOME/Llama-2-7b-hf"
else
export LLM_PATH="meta-llama/Llama-2-7b-hf"
fi
echo "LLM_PATH: $LLM_PATH"
if [ -n "$LD_LIBRARY_PATH" ]; then
echo "LD_LIBRARY_PATH is already set. Skipping CUDA setup..."
else
echo "Setting up CUDA..."
fi
cuda_dirs=(/usr/local/cuda-*/)
if [ ${#cuda_dirs[@]} -eq 0 ]; then
echo "Can not find any cuda folder in /usr/local"
exit 1
# Sort the cuda folders and get the latest one
latest_cuda=$(for dir in "${cuda_dirs[@]}"; do echo "${dir%/}"; done | sort -V | tail -n 1)
echo "The latest CUDA folder is: ${latest_cuda}"
export CUDA_HOME="${latest_cuda}"
export PATH="${latest_cuda}/bin:${PATH}"
export LD_LIBRARY_PATH="${latest_cuda}/lib64/stubs:${latest_cuda}/lib64:${latest_cuda}/cudnn/lib:${LD_LIBRARY_PATH}"
fi
echo "Starting training..."
sh train_movielens.sh
|