Pin transformers<4.45 to fix EsmModel import at runtime

Chai-1 requires EsmModel from transformers top-level import.
Versions 4.45+ moved it, causing ImportError at runtime.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-16 17:54:19 +01:00
parent 8ca37f1922
commit a191b6e192

View File

@@ -15,7 +15,7 @@ WORKDIR /workspace
# Install chai_lab and compatible transformers in a single layer # Install chai_lab and compatible transformers in a single layer
RUN pip install --no-cache-dir \ RUN pip install --no-cache-dir \
chai_lab==0.5.2 \ chai_lab==0.5.2 \
"transformers>=4.30.0,<5.0.0" "transformers>=4.30.0,<4.45.0"
# Make package dirs writable for any user (K8s may run as non-root) # Make package dirs writable for any user (K8s may run as non-root)
RUN chmod -R a+rw /opt/conda/lib/python3.11/site-packages/chai_lab/ && \ RUN chmod -R a+rw /opt/conda/lib/python3.11/site-packages/chai_lab/ && \
@@ -26,7 +26,7 @@ RUN chmod -R a+rw /opt/conda/lib/python3.11/site-packages/chai_lab/ && \
# Verify installations # Verify installations
RUN python -c "import torch; print(f'PyTorch: {torch.__version__}')" && \ RUN python -c "import torch; print(f'PyTorch: {torch.__version__}')" && \
python -c "import transformers; print(f'transformers: {transformers.__version__}')" && \ python -c "from transformers import EsmModel; print('EsmModel: OK')" && \
python -c "import chai_lab; print('chai_lab: OK')" && \ python -c "import chai_lab; print('chai_lab: OK')" && \
chai --help chai --help