-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Goofing around with some translation stuff
- Loading branch information
1 parent
f074687
commit d874cc3
Showing
11 changed files
with
3,465 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Stage 1: Base layer with python and necessary libraries | ||
FROM python:3.10-slim-buster as base | ||
|
||
WORKDIR /app | ||
|
||
COPY python/translation/poetry.lock python/translation/pyproject.toml /app/ | ||
|
||
RUN pip install poetry \ | ||
&& poetry config virtualenvs.create false \ | ||
&& poetry install --no-dev | ||
|
||
RUN pip install torch==2.0.0+cpu torchvision==0.15.1+cpu torchaudio==2.0.1 --index-url https://download.pytorch.org/whl/cpu | ||
|
||
# Stage 2: Downloading the translation model | ||
FROM alpine/git:latest as model-downloader | ||
|
||
WORKDIR /model | ||
|
||
RUN git lfs install | ||
|
||
RUN git clone https://hf.co/google-t5/t5-small | ||
|
||
# Stage 3: Building the final image | ||
FROM base as final | ||
|
||
RUN mkdir -p /models | ||
|
||
ENV MODEL_FROM_DISK=True | ||
COPY --from=model-downloader /model/t5-small /app/google-t5/t5-small | ||
|
||
COPY python/translation/translation /app/translation | ||
|
||
ENV PYTHONPATH=/app | ||
|
||
CMD ["uvicorn", "translation.app:app", "--host", "0.0.0.0", "--port", "8093"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
version: '3.8' | ||
|
||
services: | ||
translation: | ||
build: | ||
context: ../../ | ||
dockerfile: build/translation/Dockerfile | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
image: translation | ||
restart: always | ||
container_name: translation | ||
env_file: | ||
- ../../.env | ||
environment: | ||
- PORT=8093 | ||
ports: | ||
- "8093:8093" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Stage 1: Base layer with python and necessary libraries | ||
FROM python:3.10-slim-buster as base | ||
|
||
WORKDIR /app | ||
|
||
COPY python/translation/poetry.lock python/translation/pyproject.toml /app/ | ||
|
||
RUN pip install poetry \ | ||
&& poetry config virtualenvs.create false \ | ||
&& poetry install --no-dev | ||
|
||
RUN pip install torch==2.0.0 torchvision==0.15.1 torchaudio==2.0.1 | ||
|
||
# Stage 2: Downloading the translation model | ||
FROM alpine/git:latest as model-downloader | ||
|
||
WORKDIR /model | ||
|
||
RUN git lfs install | ||
|
||
RUN git clone https://hf.co/google-t5/t5-small | ||
|
||
# Stage 3: Building the final image | ||
FROM base as final | ||
|
||
RUN mkdir -p /models | ||
|
||
ENV MODEL_FROM_DISK=True | ||
|
||
COPY --from=model-downloader /model/t5-small /app/google-t5/t5-small | ||
COPY python/translation/translation /app/translation | ||
|
||
ENV PYTHONPATH=/app | ||
|
||
CMD ["uvicorn", "translation.app:app", "--host", "0.0.0.0", "--port", "8093"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
version: '3.8' | ||
|
||
services: | ||
translation: | ||
build: | ||
context: ../../ | ||
dockerfile: build/translation/gpu.Dockerfile | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" | ||
image: translation | ||
restart: always | ||
container_name: translation | ||
env_file: | ||
- ../../.env | ||
environment: | ||
- PORT=8093 | ||
ports: | ||
- "8093:8093" | ||
deploy: | ||
resources: | ||
reservations: | ||
devices: | ||
- driver: nvidia | ||
count: 1 | ||
capabilities: [gpu] |
Oops, something went wrong.