diff --git a/Dockerfile b/Dockerfile index c0416b7..119236d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,24 +17,40 @@ ENV UV_LINK_MODE=copy \ RUN apt-get update && apt-get install -y --no-install-recommends libgomp1 \ && rm -rf /var/lib/apt/lists/* -# `server` and `sktime` are always in, so the process can load naive. Heavier extras -# come from the build arg, one word each, e.g. +# `server` is always in, and it pulls `sktime`, so the process can load naive. Heavier +# extras come from the build arg, one word each, e.g. # docker build --build-arg TSERVE_EXTRAS=hub . -# docker build --build-arg TSERVE_EXTRAS="chronos gpu" . ARG TSERVE_EXTRAS="" +# Empty keeps PyPI torch (CUDA on Linux). Any value appends the CPU index, e.g. +# docker build --build-arg TSERVE_CPU=1 . +ARG TSERVE_CPU="" + +# Optional `--extra` for every sync. Empty when TSERVE_EXTRAS is unset. +ENV SYNC_EXTRAS="${TSERVE_EXTRAS:+--extra ${TSERVE_EXTRAS}}" # Resolve and install third-party deps from pyproject.toml only. Source changes -# then do not rebuild this layer. uv.lock is not tracked, so this is not -# `--frozen` / `--locked`. printf repeats `--extra` once per remaining word. +# then do not rebuild this layer. +COPY docker/pytorch-cpu.toml /pytorch-cpu.toml COPY pyproject.toml ./ RUN --mount=type=cache,target=/root/.cache/uv \ - uv sync --no-dev --no-install-project --no-editable \ - $(printf -- '--extra %s ' server sktime $TSERVE_EXTRAS) + if [ -n "$TSERVE_CPU" ]; then cat /pytorch-cpu.toml >> pyproject.toml; fi \ + && uv sync \ + --no-dev \ + --no-install-project \ + --no-editable \ + --extra server \ + $SYNC_EXTRAS +# Install tserve now that the source tree is present. Third-party deps stay in +# the layer above, so a source edit rebuilds only this step. COPY . . RUN --mount=type=cache,target=/root/.cache/uv \ - uv sync --no-dev --no-editable \ - $(printf -- '--extra %s ' server sktime $TSERVE_EXTRAS) + if [ -n "$TSERVE_CPU" ]; then cat /pytorch-cpu.toml >> pyproject.toml; fi \ + && uv sync \ + --no-dev \ + --no-editable \ + --extra server \ + $SYNC_EXTRAS # Runtime image: no uv, no source tree. `--no-editable` baked tserve # into the venv, so only `.venv` is copied. Python path must match the builder. diff --git a/README.md b/README.md index 9b070a8..07a314c 100644 --- a/README.md +++ b/README.md @@ -122,9 +122,9 @@ Multivariate series, covariates, and quantiles differ by family: [Capabilities]( Docker needs no local Python. uv and pip need Python 3.12 or newer. Install the extra, or pull the tag, for the family in the table above. -- **Docker.** [Pull an image](https://tserve.readthedocs.io/en/latest/server/docker/#pull-an-image), then [run the server](https://tserve.readthedocs.io/en/latest/server/docker/#run-the-server). CPU and GPU are separate tags. -- **uv or pip.** [UV / Pip](https://tserve.readthedocs.io/en/latest/installation/#uv-pip). A PyPI install takes CUDA torch (MPS on macOS). A CPU wheel: [CPU-only install](https://tserve.readthedocs.io/en/latest/server/pip/#cpu-only-install). -- **A clone.** [From source](https://tserve.readthedocs.io/en/latest/installation/#from-source). On a clone, uv selects the torch index with the [`gpu` extra](https://tserve.readthedocs.io/en/latest/server/source/#gpu). +- **Docker.** [Pull an image](https://tserve.readthedocs.io/en/latest/server/docker/#pull-an-image), then [run the server](https://tserve.readthedocs.io/en/latest/server/docker/#run-the-server). Each family has a CPU tag and a `-gpu` tag. +- **uv or pip.** [UV / Pip](https://tserve.readthedocs.io/en/latest/installation/#uv-pip). A CPU-only build for your OS on [CPU-only install](https://tserve.readthedocs.io/en/latest/server/pip/#cpu-only-install). +- **A clone.** [From source](https://tserve.readthedocs.io/en/latest/server/source/). An editable install for development and unreleased changes. ## Load a model diff --git a/docker-bake.hcl b/docker-bake.hcl index c1a9ebc..9e7f9d7 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,6 +1,7 @@ # TServe images: same Dockerfile, different TSERVE_EXTRAS. # Every tag is linux/amd64 + linux/arm64 (Linux, Mac, Windows Docker Desktop). -# `--extra gpu` is a torch index choice (PyPI / CUDA / MPS), not an arch pin. +# Empty TSERVE_CPU keeps PyPI torch (CUDA on Linux). CPU tags set TSERVE_CPU +# so torch comes from the CPU index. :base has no torch. # # First time on a new machine: # docker run --privileged --rm tonistiigi/binfmt --install all @@ -55,156 +56,156 @@ target "base" { target "hub" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "hub" } + args = { TSERVE_EXTRAS = "hub", TSERVE_CPU = "1" } tags = ["${TSERVE_IMAGE}:hub"] } target "chronos" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "chronos" } + args = { TSERVE_EXTRAS = "chronos", TSERVE_CPU = "1" } tags = ["${TSERVE_IMAGE}:chronos"] } target "kronos" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "kronos" } + args = { TSERVE_EXTRAS = "kronos", TSERVE_CPU = "1" } tags = ["${TSERVE_IMAGE}:kronos"] } target "granite" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "granite" } + args = { TSERVE_EXTRAS = "granite", TSERVE_CPU = "1" } tags = ["${TSERVE_IMAGE}:granite"] } target "moirai" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "moirai" } + args = { TSERVE_EXTRAS = "moirai", TSERVE_CPU = "1" } tags = ["${TSERVE_IMAGE}:moirai"] } target "tirex" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "tirex" } + args = { TSERVE_EXTRAS = "tirex", TSERVE_CPU = "1" } tags = ["${TSERVE_IMAGE}:tirex"] } target "tirex2" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "tirex2" } + args = { TSERVE_EXTRAS = "tirex2", TSERVE_CPU = "1" } tags = ["${TSERVE_IMAGE}:tirex2"] } target "toto" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "toto" } + args = { TSERVE_EXTRAS = "toto", TSERVE_CPU = "1" } tags = ["${TSERVE_IMAGE}:toto"] } target "mantis" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "mantis" } + args = { TSERVE_EXTRAS = "mantis", TSERVE_CPU = "1" } tags = ["${TSERVE_IMAGE}:mantis"] } target "timesfm3" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "timesfm3" } + args = { TSERVE_EXTRAS = "timesfm3", TSERVE_CPU = "1" } tags = ["${TSERVE_IMAGE}:timesfm3"] } target "t0" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "t0" } + args = { TSERVE_EXTRAS = "t0", TSERVE_CPU = "1" } tags = ["${TSERVE_IMAGE}:t0"] } target "tafsut" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "tafsut" } + args = { TSERVE_EXTRAS = "tafsut", TSERVE_CPU = "1" } tags = ["${TSERVE_IMAGE}:tafsut"] } target "full" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "full" } + args = { TSERVE_EXTRAS = "full", TSERVE_CPU = "1" } tags = ["${TSERVE_IMAGE}:full"] } target "hub-gpu" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "hub gpu" } + args = { TSERVE_EXTRAS = "hub" } tags = ["${TSERVE_IMAGE}:hub-gpu"] } target "chronos-gpu" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "chronos gpu" } + args = { TSERVE_EXTRAS = "chronos" } tags = ["${TSERVE_IMAGE}:chronos-gpu"] } target "kronos-gpu" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "kronos gpu" } + args = { TSERVE_EXTRAS = "kronos" } tags = ["${TSERVE_IMAGE}:kronos-gpu"] } target "granite-gpu" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "granite gpu" } + args = { TSERVE_EXTRAS = "granite" } tags = ["${TSERVE_IMAGE}:granite-gpu"] } target "moirai-gpu" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "moirai gpu" } + args = { TSERVE_EXTRAS = "moirai" } tags = ["${TSERVE_IMAGE}:moirai-gpu"] } target "tirex-gpu" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "tirex gpu" } + args = { TSERVE_EXTRAS = "tirex" } tags = ["${TSERVE_IMAGE}:tirex-gpu"] } target "tirex2-gpu" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "tirex2 gpu" } + args = { TSERVE_EXTRAS = "tirex2" } tags = ["${TSERVE_IMAGE}:tirex2-gpu"] } target "toto-gpu" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "toto gpu" } + args = { TSERVE_EXTRAS = "toto" } tags = ["${TSERVE_IMAGE}:toto-gpu"] } target "mantis-gpu" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "mantis gpu" } + args = { TSERVE_EXTRAS = "mantis" } tags = ["${TSERVE_IMAGE}:mantis-gpu"] } target "timesfm3-gpu" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "timesfm3 gpu" } + args = { TSERVE_EXTRAS = "timesfm3" } tags = ["${TSERVE_IMAGE}:timesfm3-gpu"] } target "t0-gpu" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "t0 gpu" } + args = { TSERVE_EXTRAS = "t0" } tags = ["${TSERVE_IMAGE}:t0-gpu"] } target "tafsut-gpu" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "tafsut gpu" } + args = { TSERVE_EXTRAS = "tafsut" } tags = ["${TSERVE_IMAGE}:tafsut-gpu"] } target "full-gpu" { inherits = ["_common"] - args = { TSERVE_EXTRAS = "full gpu" } + args = { TSERVE_EXTRAS = "full" } tags = ["${TSERVE_IMAGE}:full-gpu"] } diff --git a/docker/pytorch-cpu.toml b/docker/pytorch-cpu.toml new file mode 100644 index 0000000..1ee698a --- /dev/null +++ b/docker/pytorch-cpu.toml @@ -0,0 +1,10 @@ +# Appended to pyproject.toml when the image is built with TSERVE_CPU set. +# `explicit` keeps every package except torch on PyPI. + +[[tool.uv.index]] +name = "pytorch-cpu" +url = "https://download.pytorch.org/whl/cpu" +explicit = true + +[tool.uv.sources] +torch = [{ index = "pytorch-cpu" }] diff --git a/docs/installation.md b/docs/installation.md index bf47c85..fd4a09d 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -26,7 +26,7 @@ Other model families use different image tags. Choose the model first, then use ## UV / Pip -TServe requires Python 3.12 or newer. Install the `server` extra and the extra for the model family you need. The examples below install the `hub` family. A plain install pulls the CUDA build of torch (MPS on macOS); the CPU tabs skip that download on a machine without a GPU. +TServe requires Python 3.12 or newer. Install the `server` extra and the extra for the model family you need. The examples below install the `hub` family. A CPU build of torch: [CPU-only install](server/pip.md#cpu-only-install). === "uv" @@ -36,23 +36,9 @@ TServe requires Python 3.12 or newer. Install the `server` extra and the extra f uv venv ``` - Then install TServe: - - === "GPU (default)" - - ```bash - uv pip install "tserve[server,hub]" - ``` - - === "CPU only" - - ```bash - uv pip install torch --index-url https://download.pytorch.org/whl/cpu - ``` - - ```bash - uv pip install "tserve[server,hub]" - ``` + ```bash + uv pip install "tserve[server,hub]" + ``` === "pip" @@ -72,29 +58,15 @@ TServe requires Python 3.12 or newer. Install the `server` extra and the extra f .venv\Scripts\Activate.ps1 ``` - Then install TServe: - - === "GPU (default)" - - ```bash - python -m pip install "tserve[server,hub]" - ``` - - === "CPU only" - - ```bash - python -m pip install torch --index-url https://download.pytorch.org/whl/cpu - ``` - - ```bash - python -m pip install "tserve[server,hub]" - ``` + ```bash + python -m pip install "tserve[server,hub]" + ``` -The `server` extra alone supports the `naive` test baseline. Replace `hub` with another [family extra](models/index.md#dependencies), or use `full` for every family. The same CPU-first order is documented as [CPU-only install](server/pip.md#cpu-only-install). +The `server` extra alone supports the `naive` test baseline. Replace `hub` with another [family extra](models/index.md#dependencies), or use `full` for every family. ## From source -Use a source install when developing TServe or testing unreleased changes. It is also the only path where the `gpu` extra selects the torch index, because that choice lives in the repository's uv lockfile. The [From source](server/source.md) guide covers cloning the repository, editable installs, dependency extras, and GPU setup. +Use a source install when developing TServe or testing unreleased changes. The [From source](server/source.md) guide covers cloning the repository, editable installs, and dependency extras. ## Next diff --git a/docs/models/hub.md b/docs/models/hub.md index 0e13c7f..9f82539 100644 --- a/docs/models/hub.md +++ b/docs/models/hub.md @@ -6,7 +6,7 @@ Four Hugging Face families, 81 of the catalog's 117 models. The usual starting p | --- | --- | --- | --- | --- | --- | | `hub` | [`:hub`](https://hub.docker.com/r/sktime/tserve/tags?name=hub) | [`:hub-gpu`](https://hub.docker.com/r/sktime/tserve/tags?name=hub-gpu) | Chronos Bolt, Chronos T5, TTM, TimesFM 2.x | 81 | `chronos_bolt` | -Builds on [`base`](base.md), so `naive` is available here too. Every extra that pulls `hf` builds on `hub`, so those pages can load these models as well. +Builds on [`base`](base.md), so `naive` is available here too. Every extra that includes `hub` can load these models as well. ## Start a server diff --git a/docs/reference/development.md b/docs/reference/development.md index 4683c2a..3e05dd8 100644 --- a/docs/reference/development.md +++ b/docs/reference/development.md @@ -57,7 +57,7 @@ make docs-serve ## Docker images -`Dockerfile` always installs `--extra server --extra sktime` and adds whatever `TSERVE_EXTRAS` names, which is how one file produces every tag. `docker-bake.hcl` holds the published matrix: one target per tag, plus `cpu` and `gpu` groups, with `TSERVE_IMAGE` defaulting to `sktime/tserve`. +`Dockerfile` always installs `--extra server` and adds whatever `TSERVE_EXTRAS` names. `TSERVE_CPU` selects the CPU torch index; leaving it empty keeps the PyPI wheel. That is how one file produces every tag. `docker-bake.hcl` holds the published matrix: one target per tag, plus `cpu` and `gpu` groups, with `TSERVE_IMAGE` defaulting to `sktime/tserve`. ```bash TSERVE_IMAGE=sktime/tserve docker buildx bake --push hub diff --git a/docs/server/docker.md b/docs/server/docker.md index f4b7812..c2b72aa 100644 --- a/docs/server/docker.md +++ b/docs/server/docker.md @@ -90,7 +90,7 @@ The `*-gpu` tags install torch from PyPI instead of the CPU wheel index. They ne docker run --rm --gpus all -p 8000:8000 sktime/tserve:hub-gpu chronos_bolt ttm_r3 ``` -That covers Linux and Windows through WSL2. Docker on macOS has no GPU passthrough, so Apple silicon acceleration means a [local UV / Pip install](pip.md#install), which takes the MPS build of torch. +That covers Linux and Windows through WSL2. Docker on macOS has no GPU passthrough, so Apple silicon acceleration means a [local UV / Pip install](pip.md#install). ## Models from a directory @@ -113,16 +113,22 @@ cd tserve ### One image with `docker build` -The [Dockerfile](https://github.com/sktime/tserve/blob/main/Dockerfile) always installs `--extra server --extra sktime`; `TSERVE_EXTRAS` adds the heavier ones: +The [Dockerfile](https://github.com/sktime/tserve/blob/main/Dockerfile) always installs `--extra server`. `TSERVE_EXTRAS` adds the heavier ones, one word each. Leave `TSERVE_CPU` empty for the PyPI torch wheel. Any value installs torch from the CPU index, which is what the published CPU tags do: ```bash -docker build --build-arg TSERVE_EXTRAS=hub -t tserve:hub . +docker build --build-arg TSERVE_EXTRAS=hub --build-arg TSERVE_CPU=1 -t tserve:hub . +``` + +A GPU image is the same build with `TSERVE_CPU` unset: + +```bash +docker build --build-arg TSERVE_EXTRAS=chronos -t tserve:chronos-gpu . ``` Several extras go in one quoted argument: ```bash -docker build --build-arg TSERVE_EXTRAS="chronos gpu" -t tserve:chronos-gpu . +docker build --build-arg TSERVE_EXTRAS="chronos moirai" --build-arg TSERVE_CPU=1 -t tserve:custom . ``` This builds for the architecture of the machine you are on and leaves the image in the local store, which is all you need to run it locally: diff --git a/docs/server/index.md b/docs/server/index.md index 154b9cc..8afd905 100644 --- a/docs/server/index.md +++ b/docs/server/index.md @@ -28,7 +28,7 @@ A bare `tserve` loads `naive` only. Name models to load them too. `GET /models` tserve chronos_bolt ttm_r3 ``` - This installs CUDA torch (MPS on macOS). A CPU wheel: [CPU-only install](pip.md#cpu-only-install). + This installs CUDA torch (MPS on macOS). A CPU build: [CPU-only install](pip.md#cpu-only-install). Another family is the same command with that row's tag and model. `moirai_2`: diff --git a/docs/server/pip.md b/docs/server/pip.md index e856b0a..6c003d3 100644 --- a/docs/server/pip.md +++ b/docs/server/pip.md @@ -16,8 +16,6 @@ Python >= 3.12. Install TServe from PyPI with [uv](https://docs.astral.sh/uv/) o pip install "tserve[server,hub]" ``` - The `gpu` extra does not change a pip install. Family extras already install CUDA torch from PyPI (MPS on macOS). To force a CPU wheel, install torch separately first — [CPU-only install](#cpu-only-install). - `server` is enough to serve `naive` (a test baseline). The `hub` extra above covers Chronos Bolt/T5, TTM, and TimesFM 2.x. Do not add `client` on a machine that only serves. ## Dependencies @@ -26,25 +24,13 @@ Python >= 3.12. Install TServe from PyPI with [uv](https://docs.astral.sh/uv/) o Replace `hub` in the install above with another extra from the table. `full` is the union extra. `all-extras` is a pip convenience for `client,server,full` and is not a Docker tag. Each extra's command and models: [catalog](../models/index.md#start-a-server). -`gpu` is not a model family. A CPU wheel: [CPU-only install](#cpu-only-install). +A CPU build of torch: [CPU-only install](#cpu-only-install). ## CPU-only install -Family extras pull `torch`, and every install here takes the CUDA wheel from PyPI (MPS on macOS). On a GPU host that is already what you want, so nothing below is needed. - -Without a GPU, that wheel is a large download you will never use. Install torch from the CPU index first, then TServe. If a later install replaces that wheel with CUDA, run the torch line again. - -```bash -pip install torch --index-url https://download.pytorch.org/whl/cpu -``` - -```bash -pip install "tserve[server,hub]" -``` - -The same order works with `uv pip install`. Swap `hub` for any other family extra from [Dependencies](#dependencies). +Family extras pull `torch`. Pick the CPU build for your OS on the [PyTorch install page](https://pytorch.org/get-started/locally/), install it, then install TServe as above. If a later install replaces that build, run the PyTorch command again. -The `gpu` extra only selects the torch index in a clone's uv lockfile: [From source](source.md#gpu). Containers pick the wheel through the tag instead: [Docker](docker.md#gpu-images). +Swap `hub` for any other family extra from [Dependencies](#dependencies). A GPU host can also use a `*-gpu` image: [GPU images](docker.md#gpu-images). --8<-- "includes/serve.md" diff --git a/docs/server/source.md b/docs/server/source.md index 0394a02..9c3a9e0 100644 --- a/docs/server/source.md +++ b/docs/server/source.md @@ -18,8 +18,6 @@ Python >= 3.12, and a clone over HTTPS. [uv](https://docs.astral.sh/uv/) is the pip install -e ".[server,hub]" ``` - The `gpu` extra does not work with pip. Family extras already install CUDA torch from PyPI (MPS on macOS). To force a CPU wheel, install torch separately first — [GPU](#gpu). - `server` is enough to serve `naive` (a test baseline). The `hub` extra above covers Chronos Bolt/T5, TTM, and TimesFM 2.x. Do not add `client` on a machine that only serves. ## Dependencies @@ -28,28 +26,7 @@ Python >= 3.12, and a clone over HTTPS. [uv](https://docs.astral.sh/uv/) is the Replace `hub` in the install above with another extra from the table. uv repeats `--extra` (`uv sync --extra server --extra chronos`). pip takes one list (`".[server,chronos]"`). `full` is the union extra. `all-extras` is a pip convenience for `client,server,full` and is not a Docker tag. Each extra's command and models: [catalog](../models/index.md#start-a-server). -`gpu` is not a model family. Torch CPU vs GPU: [GPU](#gpu). - -## GPU - -Family extras pull `torch`. Which wheel you get depends on the installer. - -**uv** defaults to the CPU index. Add `--extra gpu` for the PyPI wheel: CUDA on Linux and Windows, MPS on Apple silicon. Pair it with the family extras you need. - -```bash -uv sync --extra server --extra hub --extra gpu -``` - -**pip** does not honor the `gpu` extra. `pip install -e ".[server,hub,gpu]"` is the same as without `gpu`. A normal pip install always takes CUDA torch from PyPI (MPS on macOS). - -To **force CPU torch with pip**, install torch from the CPU index first, then TServe. If a later `pip install` replaces that wheel with CUDA, run the torch line again. - -```bash -pip install torch --index-url https://download.pytorch.org/whl/cpu -pip install -e ".[server,hub]" -``` - -Swap `hub` for any other family extra from [Dependencies](#dependencies). Containers use `*-gpu` tags instead: [Docker](docker.md#gpu-images). +A CPU build of torch: [CPU-only install](pip.md#cpu-only-install). --8<-- "includes/serve.md" diff --git a/includes/model-dependencies.md b/includes/model-dependencies.md index 715f42a..5894de2 100644 --- a/includes/model-dependencies.md +++ b/includes/model-dependencies.md @@ -1,8 +1,8 @@ The extra name is the CPU image tag. GPU tags are `{extra}-gpu`. There is no `:base-gpu`. -`kronos` is built on `base`, so it cannot load Chronos Bolt, TTM, or TimesFM. Every extra that pulls `hf` — `hub`, `chronos`, `granite`, `moirai`, `tirex`, `tirex2`, `toto`, `mantis`, `timesfm3`, `t0`, `tafsut`, and `full` — can. +`kronos` is built on `base`, so it cannot load Chronos Bolt, TTM, or TimesFM. `hub` can, and so can every extra that includes it: `chronos`, `granite`, `moirai`, `tirex`, `tirex2`, `toto`, `mantis`, `timesfm3`, `t0`, `tafsut`, and `full`. -`full` is `chronos`, `kronos`, `granite`, `moirai`, `tirex`, `tirex2`, `toto`, `mantis`, `timesfm3`, `t0`, and `tafsut`. `client`, `http`, `gpu`, `dev`, `docs`, and `all-extras` are not model families. `gpu` selects the torch index for uv on a clone only. Pip ignores `gpu` and installs CUDA torch from PyPI (MPS on macOS). Moirai pins `gluonts`, `lightning`, and `hydra-core` when `python_version < '3.14'`. +`full` is `chronos`, `kronos`, `granite`, `moirai`, `tirex`, `tirex2`, `toto`, `mantis`, `timesfm3`, `t0`, and `tafsut`. `client`, `http`, `dev`, `docs`, and `all-extras` are not model families. Moirai pins `gluonts`, `lightning`, and `hydra-core` when `python_version < '3.14'`. **added** counts checkpoints that extra contributes. `full` is the total, including `naive`. diff --git a/pyproject.toml b/pyproject.toml index 3c3c079..3bcaa0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,17 +42,16 @@ sktime = [ "sktime>=1.2.0", "skpro", ] -# estimators-general-deps, torch excluded so CPU vs `--extra gpu` can pick an index -hf = [ +# ChronosForecaster/TinyTimeMixerForecaster/TimesFM2Forecaster. Also shared stack for the families below. +hub = [ "tserve[sktime]", "transformers", "accelerate>=0.26.0", + "torch", ] -# ChronosForecaster/TinyTimeMixerForecaster/TimesFM2Forecaster -hub = ["tserve[hf]", "torch"] # Chronos2Forecaster -chronos = ["tserve[hf]", "chronos-forecasting>=2.0.0", "torch"] -# KronosForecaster/WindFMForecaster +chronos = ["tserve[hub]", "chronos-forecasting>=2.0.0"] +# KronosForecaster/WindFMForecaster. Not built on hub. kronos = [ "tserve[sktime]", "einops", @@ -61,38 +60,34 @@ kronos = [ "torch", ] # FlowState/PatchTSMixer -granite = ["tserve[hf]", "granite-tsfm>=0.3.5", "torch"] +granite = ["tserve[hub]", "granite-tsfm>=0.3.5"] # MOIRAI/Moirai2/LagLlama moirai = [ - "tserve[hf]", + "tserve[hub]", "gluonts>=0.14.0; python_version < '3.14'", "lightning>=2.0; python_version < '3.14'", "hydra-core; python_version < '3.14'", "einops", - "torch", ] # TiRexForecaster -tirex = ["tserve[hf]", "tirex-ts", "torch"] +tirex = ["tserve[hub]", "tirex-ts"] # TiRex2Forecaster -tirex2 = ["tserve[hf]", "tirex-2", "torch"] +tirex2 = ["tserve[hub]", "tirex-2"] # Toto2Forecaster (toto-ts for Toto v1 pins transformers and is omitted) -toto = ["tserve[hf]", "toto-models", "skpro", "torch"] +toto = ["tserve[hub]", "toto-models", "skpro"] # MantisForecaster -mantis = ["tserve[hf]", "mantis-tsfm>=1.0.0", "torch"] +mantis = ["tserve[hub]", "mantis-tsfm>=1.0.0"] # TimesFM3Forecaster -timesfm3 = ["tserve[hf]", "timesfm[torch]>=3.0.0,<4.0.0", "torch"] +timesfm3 = ["tserve[hub]", "timesfm[torch]>=3.0.0,<4.0.0"] # T0Forecaster -t0 = ["tserve[hf]", "tfc-t0", "torch"] +t0 = ["tserve[hub]", "tfc-t0"] # TafsutForecaster -tafsut = ["tserve[hf]", "tafsut>=0.1.0", "torch"] +tafsut = ["tserve[hub]", "tafsut>=0.1.0"] full = [ "tserve[chronos,kronos,granite,moirai,tirex,tirex2,toto,mantis,timesfm3,t0,tafsut]", - "torch", ] # for pip (alternate for `uv sync --all-extras`) all-extras = ["tserve[client,server,full]"] -# pair with any extra above: `uv sync --extra hub --extra gpu` -gpu = ["torch"] # also extras so `pip install -e ".[dev]"` / `".[docs]"` work (no uv, no PEP 735) dev = [ "pytest", @@ -121,33 +116,6 @@ Changelog = "https://tserve.readthedocs.io/en/latest/reference/changelog/" # same packages as the extras, so `uv sync --group dev` stays valid dev = ["tserve[dev]"] docs = ["tserve[docs]"] -# empty, only exists so the lock can fork CPU vs GPU torch -cpu-fork = [] - -[tool.uv] -# pytorch-cpu also mirrors a few generic wheels at old versions; consider -# both indexes so those packages still resolve from PyPI. -index-strategy = "unsafe-best-match" -# fork the lock: default extras use the CPU index, `--extra gpu` uses PyPI -conflicts = [ - [{ extra = "gpu" }, { group = "cpu-fork" }], -] - -[tool.uv.sources] -# `--extra gpu` takes PyPI torch (CUDA on Linux/Windows, MPS on macOS). -# Without it, the extra CPU index below supplies the +cpu wheel. -torch = [ - { index = "pypi", extra = "gpu" }, -] - -[[tool.uv.index]] -name = "pypi" -url = "https://pypi.org/simple" -default = true - -[[tool.uv.index]] -name = "pytorch-cpu" -url = "https://download.pytorch.org/whl/cpu" [tool.hatch.build] # repo .gitignore has `*.html`; hatchling would drop the dashboard from