From 308857344c21696ec2f8a108b2f59d9280e3a91a Mon Sep 17 00:00:00 2001 From: Lectom Date: Fri, 6 Dec 2024 11:05:05 +0900 Subject: [PATCH] Add files via upload --- .env.sample | 0 .gitattributes | 32 +++++++++ .gitignore | 166 +++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 24 +++++++ dockerfile | 26 +++++++ requirements.txt | 5 ++ 6 files changed, 253 insertions(+) create mode 100644 .env.sample create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 docker-compose.yml create mode 100644 dockerfile create mode 100644 requirements.txt diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..e69de29 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9254ea2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,32 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2d88f3b --- /dev/null +++ b/.gitignore @@ -0,0 +1,166 @@ +#output, model, etc +output +cache + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class +.vscode/ +flagged/ + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +# PyCharm +# JetBrains specific template is maintained in a separate JetBrains.gitignore that can +# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore +# and can be added to the global gitignore or merged into this file. For a more nuclear +# option (not recommended) you can uncomment the following to ignore the entire idea folder. +#.idea/ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..bb87eea --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,24 @@ +services: + sample-boilerplate: + # image: localregistry/sample-boilerplate:latest + build: + context: . + dockerfile : ./Dockerfile + container_name: sample-boilerplate + volumes: + - ./workspace:/opt/workspace + - ./cache:/root/.cache/ + working_dir: /opt/whisper + entrypoint: uvicorn api:app --host 0.0.0.0 --port 7890 --reload + restart: always + + ports: + - 7890:7890 + + deploy: + resources: + reservations: + devices: + - driver: nvidia + device_ids: ['0'] + capabilities: [gpu] diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..f37d168 --- /dev/null +++ b/dockerfile @@ -0,0 +1,26 @@ +# FROM huggingface/transformers-pytorch-gpu +FROM pytorch/pytorch:latest + +ARG DEBIAN_FRONTEND=noninteractive +ENV TZ=Asia/Seoul +ADD ./workspace /opt/workspace +WORKDIR /opt/workspace + +# Latest version of transformers-pytorch-gpu seems to lack tk. +# Further, pip install fails, so we must upgrade pip first. +RUN cd /etc/apt && \ + sed -i 's/archive.ubuntu.com/mirror.kakao.com/g' sources.list +RUN apt-get -y update +RUN apt-get -y install python3-tk git vim curl +RUN python3 -m pip install --upgrade pip + + +COPY requirements.txt . +RUN python3 -m pip install -r requirements.txt + +# To be able to see logs in real time +ENV PYTHONUNBUFFERED=1 + + +# ENTRYPOINT ["python3"] +# CMD ["app.py", "--server_name", "0.0.0.0", "--auto_parallel", "True"] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b5a3848 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +transformers +ffmpeg-python==0.2.0 +Jinja2 +fastapi +uvicorn[standard] \ No newline at end of file