elungky commited on
Commit
10e72c6
·
1 Parent(s): b7ff06a

Fix PyTorch verification command in Dockerfile using heredoc for robust multi-line Python

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -10
Dockerfile CHANGED
@@ -57,16 +57,18 @@ RUN echo "Verifying Python and Conda installations..."
57
  RUN python --version
58
  RUN conda env list
59
  RUN echo "Verifying PyTorch and CUDA availability..."
60
- # REVISED: Break into more explicit separate statements with newlines for robustness
61
- RUN conda run -n cosmos-predict1 python -c "\
62
- import torch;\n\
63
- print('PyTorch Version: ' + torch.__version__);\n\
64
- print('CUDA Available: ' + str(torch.cuda.is_available()));\n\
65
- if torch.cuda.is_available():\n\
66
- print('CUDA Device Name: ' + torch.cuda.get_device_name(0));\n\
67
- else:\n\
68
- print('CUDA Device Name: N/A');\n\
69
- " || echo "PyTorch verification failed. Check dependencies in cosmos-predict1.yaml."
 
 
70
  # --- End Verification Steps ---
71
 
72
  # Make the start.sh script executable.
 
57
  RUN python --version
58
  RUN conda env list
59
  RUN echo "Verifying PyTorch and CUDA availability..."
60
+ # REVISED AGAIN: Use a heredoc for multi-line Python code
61
+ RUN conda run -n cosmos-predict1 python <<EOF
62
+ import torch
63
+ print('PyTorch Version: ' + torch.__version__)
64
+ print('CUDA Available: ' + str(torch.cuda.is_available()))
65
+ if torch.cuda.is_available():
66
+ print('CUDA Device Name: ' + torch.cuda.get_device_name(0))
67
+ else:
68
+ print('CUDA Device Name: N/A')
69
+ EOF
70
+ # Add the fallback echo if the python command fails
71
+ RUN [ $? -eq 0 ] || echo "PyTorch verification failed. Check dependencies in cosmos-predict1.yaml."
72
  # --- End Verification Steps ---
73
 
74
  # Make the start.sh script executable.