MingLi
commited on
Commit
·
99023cb
1
Parent(s):
9f13819
optimized setup.sh
Browse files
setup.sh
CHANGED
@@ -1,27 +1,27 @@
|
|
1 |
#!/bin/bash
|
|
|
2 |
uv sync --offline
|
|
|
|
|
|
|
3 |
cp debug/utils.py .venv/lib/python3.10/site-packages/transformers/generation/utils.py
|
4 |
cp debug/modeling_llama.py .venv/lib/python3.10/site-packages/transformers/models/llama/modeling_llama.py
|
5 |
|
6 |
export LLM_PATH=meta-llama/Llama-2-7b-hf
|
|
|
7 |
|
8 |
-
|
9 |
cuda_dirs=(/usr/local/cuda-*/)
|
10 |
if [ ${#cuda_dirs[@]} -eq 0 ]; then
|
11 |
-
echo "
|
12 |
exit 1
|
13 |
fi
|
14 |
|
15 |
-
#
|
16 |
latest_cuda=$(for dir in "${cuda_dirs[@]}"; do echo "${dir%/}"; done | sort -V | tail -n 1)
|
17 |
|
18 |
-
echo "
|
19 |
|
20 |
-
# 构造新的LD_LIBRARY_PATH
|
21 |
-
# 依次加入以下路径:
|
22 |
-
# 1. ${latest_cuda}/lib64/stubs
|
23 |
-
# 2. ${latest_cuda}/lib64
|
24 |
-
# 3. ${latest_cuda}/cudnn/lib
|
25 |
export CUDA_HOME="${latest_cuda}"
|
26 |
export PATH="${latest_cuda}/bin:${PATH}"
|
27 |
export LD_LIBRARY_PATH="${latest_cuda}/lib64/stubs:${latest_cuda}/lib64:${latest_cuda}/cudnn/lib:${LD_LIBRARY_PATH}"
|
|
|
1 |
#!/bin/bash
|
2 |
+
echo "Starting training..."
|
3 |
uv sync --offline
|
4 |
+
echo "Activated virtual environment"
|
5 |
+
source .venv/bin/activate
|
6 |
+
echo "Copying files..."
|
7 |
cp debug/utils.py .venv/lib/python3.10/site-packages/transformers/generation/utils.py
|
8 |
cp debug/modeling_llama.py .venv/lib/python3.10/site-packages/transformers/models/llama/modeling_llama.py
|
9 |
|
10 |
export LLM_PATH=meta-llama/Llama-2-7b-hf
|
11 |
+
echo "LLM_PATH: $LLM_PATH"
|
12 |
|
13 |
+
echo "Setting up CUDA..."
|
14 |
cuda_dirs=(/usr/local/cuda-*/)
|
15 |
if [ ${#cuda_dirs[@]} -eq 0 ]; then
|
16 |
+
echo "Can not find any cuda folder in /usr/local"
|
17 |
exit 1
|
18 |
fi
|
19 |
|
20 |
+
# Sort the cuda folders and get the latest one
|
21 |
latest_cuda=$(for dir in "${cuda_dirs[@]}"; do echo "${dir%/}"; done | sort -V | tail -n 1)
|
22 |
|
23 |
+
echo "The latest CUDA folder is: ${latest_cuda}"
|
24 |
|
|
|
|
|
|
|
|
|
|
|
25 |
export CUDA_HOME="${latest_cuda}"
|
26 |
export PATH="${latest_cuda}/bin:${PATH}"
|
27 |
export LD_LIBRARY_PATH="${latest_cuda}/lib64/stubs:${latest_cuda}/lib64:${latest_cuda}/cudnn/lib:${LD_LIBRARY_PATH}"
|