Skip to content

Commit

Permalink
build: improve pytorch installation based on operating system
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPandir committed Mar 1, 2024
1 parent b728887 commit aa366f9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN curl -sSf https://rye-up.com/get | NO_AUTO_INSTALL=1 RYE_INSTALL_OPTION="--y
bash -c "source $HOME/.rye/env && rye pin 3.12.2 && rye config --set-bool behavior.use-uv=false"
ENV PATH=/root/.rye/shims:$PATH
COPY pyproject.toml ./
RUN --mount=type=cache,target=/root/.cache rye sync --no-dev --features torch-cpu
RUN --mount=type=cache,target=/root/.cache rye sync --no-dev

FROM base as models-installer
RUN apt-get -y update && apt-get -y install curl
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "silero-tts-api-server"
version = "1.0.0"
description = "This is a simple server that uses Silero models to convert text to audio files over HTTP"
license = { text = "MIT" }
authors = [
{ name = "MrPandir", email = "MrPandir@users.noreply.github.com" }
]
Expand All @@ -10,13 +11,11 @@ dependencies = [
"litestar>=2.6.1",
"numpy>=1.26.4",
"python-dotenv>=1.0.1",
"torch==2.2.0+cpu; sys_platform == 'aarch64' or sys_platform == 'x86_64'",
"torch==2.2.0; sys_platform != 'aarch64' and sys_platform != 'x86_64'",
]
requires-python = ">=3.9"

[project.optional-dependencies]
torch-cpu = ["torch==2.2.0+cpu"]
torch = ["torch==2.2.0"]

[tool.setuptools]
packages = []

Expand Down
13 changes: 11 additions & 2 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# last locked with the following flags:
# pre: false
# features: ["torch"]
# features: []
# all-features: false
# with-sources: true

Expand All @@ -21,7 +21,10 @@ click==8.1.7
# via litestar
# via rich-click
# via uvicorn
# faker==23.2.1 (excluded)
exceptiongroup==1.2.0
# via anyio
# via litestar
# faker==23.3.0 (excluded)
# via polyfactory
# filelock==3.13.1 (excluded)
# via torch
Expand All @@ -37,6 +40,8 @@ httpx==0.26.0
idna==3.6
# via anyio
# via httpx
importlib-metadata==7.0.1
# via litestar
# jinja2==3.1.3 (excluded)
# via torch
litestar==2.6.1
Expand Down Expand Up @@ -82,9 +87,13 @@ sniffio==1.3.0
torch==2.2.0
# via silero-tts-api-server
typing-extensions==4.9.0
# via anyio
# via litestar
# via polyfactory
# via rich-click
# via torch
# via uvicorn
uvicorn==0.27.1
# via silero-tts-api-server
zipp==3.17.0
# via importlib-metadata
13 changes: 11 additions & 2 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# last locked with the following flags:
# pre: false
# features: ["torch"]
# features: []
# all-features: false
# with-sources: true

Expand All @@ -21,7 +21,10 @@ click==8.1.7
# via litestar
# via rich-click
# via uvicorn
# faker==23.2.1 (excluded)
exceptiongroup==1.2.0
# via anyio
# via litestar
# faker==23.3.0 (excluded)
# via polyfactory
# filelock==3.13.1 (excluded)
# via torch
Expand All @@ -37,6 +40,8 @@ httpx==0.26.0
idna==3.6
# via anyio
# via httpx
importlib-metadata==7.0.1
# via litestar
# jinja2==3.1.3 (excluded)
# via torch
litestar==2.6.1
Expand Down Expand Up @@ -82,9 +87,13 @@ sniffio==1.3.0
torch==2.2.0
# via silero-tts-api-server
typing-extensions==4.9.0
# via anyio
# via litestar
# via polyfactory
# via rich-click
# via torch
# via uvicorn
uvicorn==0.27.1
# via silero-tts-api-server
zipp==3.17.0
# via importlib-metadata

0 comments on commit aa366f9

Please sign in to comment.