MingLi commited on
Commit
1a0fc72
·
1 Parent(s): 99023cb

optimized setup.sh

Browse files
Files changed (1) hide show
  1. setup.sh +16 -9
setup.sh CHANGED
@@ -1,5 +1,5 @@
1
  #!/bin/bash
2
- echo "Starting training..."
3
  uv sync --offline
4
  echo "Activated virtual environment"
5
  source .venv/bin/activate
@@ -10,20 +10,27 @@ cp debug/modeling_llama.py .venv/lib/python3.10/site-packages/transformers/model
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}"
28
 
 
 
 
29
  sh train_movielens.sh
 
1
  #!/bin/bash
2
+ echo "Starting building the environment..."
3
  uv sync --offline
4
  echo "Activated virtual environment"
5
  source .venv/bin/activate
 
10
  export LLM_PATH=meta-llama/Llama-2-7b-hf
11
  echo "LLM_PATH: $LLM_PATH"
12
 
13
+ if [ -n "$LD_LIBRARY_PATH" ]; then
14
+ echo "LD_LIBRARY_PATH is already set. Skipping CUDA setup..."
15
+ else
16
+ echo "Setting up CUDA..."
17
+ fi
18
  cuda_dirs=(/usr/local/cuda-*/)
19
  if [ ${#cuda_dirs[@]} -eq 0 ]; then
20
+
21
  echo "Can not find any cuda folder in /usr/local"
22
  exit 1
 
23
 
24
+ # Sort the cuda folders and get the latest one
25
+ latest_cuda=$(for dir in "${cuda_dirs[@]}"; do echo "${dir%/}"; done | sort -V | tail -n 1)
26
 
27
+ echo "The latest CUDA folder is: ${latest_cuda}"
28
 
29
+ export CUDA_HOME="${latest_cuda}"
30
+ export PATH="${latest_cuda}/bin:${PATH}"
31
+ export LD_LIBRARY_PATH="${latest_cuda}/lib64/stubs:${latest_cuda}/lib64:${latest_cuda}/cudnn/lib:${LD_LIBRARY_PATH}"
32
 
33
+ fi
34
+
35
+ echo "Starting training..."
36
  sh train_movielens.sh