20231209-docker-machine-learning
Docker
docker search tensorflow
docker pull jupyter/tensorflow-notebook
docker run jupyter/tensorflow-notebook -p 8000:8888
- -p out:in
Transformers
from transformers import pipeline
pip install transformers
docker compose
services: transformers-notebook: build: ./Dockerfile | image: jupyter/tensorflow-notebook - 8000:8888 environment - JUPYTER_TOKEN=token volumes - ./:/home/{user}
FROM jupyter/tensorflow-notebook USER $NB_UID //user | USER root RUN pip install --upgrade pip &&\ pip install transformers && \ pip install pysrt && \ fix-permissions "/home/${NB_USER}" COPY file.srt Translate.ipynb ./
docker-compose up
from transformers import pipeline
pip install transformers
translator = pipeline("translation_en_to_fr") fr = translator("Hi there I'm Alan!")
pysrt 讀取字幕檔
docker images
docker image tag OOOOOOO-transformers-notebook:latest {user}/srt-translator:1.0
docker push {user}/srt-translator:1.0
docker container prune
docker rmi {user}/srt-translator:1.0
docker run -p 5000:8888 {user}/srt-translator:1.0