@@ -13,60 +13,46 @@ echo "Can't initialize NVML. OR No CUDA runtime is found, using CUDA_HOME='/usr/
13
13
echo " Please ignore these warnings. They are expected."
14
14
echo " ########################################################"
15
15
16
- # Block 2: Use uv instead of pip
17
- echo " Setting up Python environment..."
18
-
19
- # Create virtual environment using uv
20
- uv venv $HOME /.venv
21
- echo " ✓ Virtual environment created"
22
-
23
- # Make sure we use the virtual environment's Python and uv
24
- PYTHON=" $HOME /.venv/bin/python"
25
- UV=" uv"
26
-
27
- # Add venv activation to .bashrc
28
- echo ' source $HOME/.venv/bin/activate' >> ~ /.bashrc
16
+ # Block 2: Python environment is already created by Dockerfile
17
+ echo " Using uv for package installation..."
18
+
19
+ # Make sure we're using the venv from Dockerfile
20
+ if [ -d " $HOME /.venv" ]; then
21
+ echo " Using existing virtual environment"
22
+ source $HOME /.venv/bin/activate
23
+ PYTHON=" python"
24
+ else
25
+ echo " Warning: Virtual environment not found, creating one now"
26
+ uv venv $HOME /.venv
27
+ source $HOME /.venv/bin/activate
28
+ PYTHON=" python"
29
+ fi
29
30
30
31
# Block 3: Python Dependencies using uv
31
32
echo " Installing Python packages..."
32
- $UV pip install --upgrade pip
33
- echo " ✓ Pip upgraded"
34
33
35
- # Install setuptools first (required by triton)
36
- echo " Installing setuptools..."
37
- $UV pip install setuptools wheel
38
- echo " ✓ Setuptools and wheel installed"
34
+ # Install packages in parallel with efficient dependency resolution
35
+ echo " Installing core packages..."
36
+ uv pip install -U " transformers==4.48.3" triton " sglang[all]>=0.4.2.post4" --find-links https://flashinfer.ai/whl/cu124/torch2.5/flashinfer/
39
37
40
- # Install transformers
41
- echo " Installing transformers..."
42
- $UV pip install " transformers==4.48.3"
43
- $PYTHON -c " import transformers" && echo " ✓ Transformers installed" || echo " Warning: Could not import transformers, but continuing"
38
+ echo " Installing additional packages..."
39
+ uv pip install -U accelerate bitsandbytes huggingface_hub
44
40
45
- # Install triton first as it's a dependency for sglang
46
- echo " Installing triton..."
47
- $UV pip install triton
41
+ # Validate installations
42
+ $PYTHON -c " import transformers" && echo " ✓ Transformers installed" || echo " Warning: Could not import transformers, but continuing"
48
43
$PYTHON -c " import triton" && echo " ✓ Triton installed" || echo " Warning: Could not import triton"
49
-
50
- # Install sglang and dependencies
51
- echo " Installing sglang and dependencies..."
52
- $UV pip install " sglang[all]>=0.4.2.post4" --find-links https://flashinfer.ai/whl/cu124/torch2.5/flashinfer/
53
44
$PYTHON -c " import sglang" && echo " ✓ SGLang installed" || { echo " ERROR: Could not import sglang, installation failed" ; exit 1; }
54
-
55
- # Install additional required packages
56
- echo " Installing additional packages..."
57
- $UV pip install accelerate bitsandbytes
58
45
$PYTHON -c " import accelerate" && echo " ✓ Accelerate installed" || echo " Warning: Could not import accelerate"
59
- # $PYTHON -c "import bitsandbytes" && echo "✓ BitsAndBytes installed" || echo "Warning: Could not import bitsandbytes"
60
-
61
- # Install huggingface_hub
62
- echo " Installing huggingface_hub..."
63
- $UV pip install huggingface_hub
64
46
$PYTHON -c " import huggingface_hub" && echo " ✓ Huggingface_hub installed" || echo " Warning: Could not import huggingface_hub"
65
47
66
- # Install requirements.txt packages
67
- echo " Installing requirements.txt packages..."
68
- $UV pip install -r ~ /requirements.txt
69
- echo " ✓ Application dependencies installed"
48
+ # Install requirements.txt packages efficiently
49
+ if [ -f ~ /requirements.txt ]; then
50
+ echo " Installing requirements.txt packages..."
51
+ uv pip install -r ~ /requirements.txt
52
+ echo " ✓ Application dependencies installed"
53
+ else
54
+ echo " No requirements.txt found, skipping"
55
+ fi
70
56
71
57
# Block 4: Skip CUDA Check during build
72
58
echo " Note: Skipping CUDA check during build phase. Will check when container runs."
0 commit comments