Spaces:
Sleeping
Sleeping
gary-boon Claude Opus 4.5 commited on
Commit ·
9978aec
1
Parent(s): 76b614d
Fix PyTorch dynamo cache directory issue in containers
Browse files- Set USER env var to avoid getpass.getuser() failure
- Set TORCHINDUCTOR_CACHE_DIR to bypass username lookup
- Set TORCH_HOME for torch cache
- Create cache directories with proper permissions
Fixes: KeyError: 'getpwuid(): uid not found: 1000'
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Dockerfile +8 -2
Dockerfile
CHANGED
|
@@ -14,9 +14,15 @@ ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
|
|
| 14 |
ENV HF_HOME=/tmp/hf_home
|
| 15 |
ENV HUGGINGFACE_HUB_CACHE=/tmp/huggingface_hub
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# Create cache directories with proper permissions
|
| 18 |
-
RUN mkdir -p /tmp/transformers_cache /tmp/hf_home /tmp/huggingface_hub && \
|
| 19 |
-
chmod -R 777 /tmp/transformers_cache /tmp/hf_home /tmp/huggingface_hub
|
| 20 |
|
| 21 |
# Copy and install Python requirements
|
| 22 |
COPY requirements.txt .
|
|
|
|
| 14 |
ENV HF_HOME=/tmp/hf_home
|
| 15 |
ENV HUGGINGFACE_HUB_CACHE=/tmp/huggingface_hub
|
| 16 |
|
| 17 |
+
# Fix for PyTorch dynamo cache directory issue in containers
|
| 18 |
+
# (getpass.getuser() fails when UID doesn't exist in /etc/passwd)
|
| 19 |
+
ENV USER=appuser
|
| 20 |
+
ENV TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_cache
|
| 21 |
+
ENV TORCH_HOME=/tmp/torch_home
|
| 22 |
+
|
| 23 |
# Create cache directories with proper permissions
|
| 24 |
+
RUN mkdir -p /tmp/transformers_cache /tmp/hf_home /tmp/huggingface_hub /tmp/torchinductor_cache /tmp/torch_home && \
|
| 25 |
+
chmod -R 777 /tmp/transformers_cache /tmp/hf_home /tmp/huggingface_hub /tmp/torchinductor_cache /tmp/torch_home
|
| 26 |
|
| 27 |
# Copy and install Python requirements
|
| 28 |
COPY requirements.txt .
|