Spaces:
Sleeping
Sleeping
dockerfile updated to download the model while docker image is building
Browse files- Dockerfile +6 -0
Dockerfile
CHANGED
|
@@ -47,6 +47,12 @@ COPY --chown=user requirements.txt .
|
|
| 47 |
RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \
|
| 48 |
pip install -r requirements.txt
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
# Install test requirements if needed
|
| 51 |
COPY --chown=user requirements-test.txt .
|
| 52 |
# Build only when TEST_ENV="true"
|
|
|
|
| 47 |
RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \
|
| 48 |
pip install -r requirements.txt
|
| 49 |
|
| 50 |
+
# Download the model during the build process
|
| 51 |
+
RUN --mount=type=cache,target=${PIP_CACHE_DIR},sharing=locked \
|
| 52 |
+
python -c "from transformers import AutoModelForSequenceClassification, AutoTokenizer; \
|
| 53 |
+
AutoModelForSequenceClassification.from_pretrained('bert-base-multilingual-cased').save_pretrained('/home/user/app/model'); \
|
| 54 |
+
AutoTokenizer.from_pretrained('bert-base-multilingual-cased').save_pretrained('/home/user/app/model')"
|
| 55 |
+
|
| 56 |
# Install test requirements if needed
|
| 57 |
COPY --chown=user requirements-test.txt .
|
| 58 |
# Build only when TEST_ENV="true"
|