Skip to content

mantis

Mantis embeddings with an sklearn head, plus every hub model.

extra CPU tag GPU tag families models example
mantis :mantis :mantis-gpu Mantis 3 mantis_8m

past needs more than 127 rows

context_length is 127. The examples below send 150 rows; the five-row series used on other pages fails here.

Start a server

docker run --rm -p 8000:8000 sktime/tserve:mantis mantis_8m
uv pip install "tserve[server,mantis]"
uv run tserve mantis_8m
pip install "tserve[server,mantis]"
tserve mantis_8m

Check what loaded:

curl -s http://127.0.0.1:8000/models

Predict

150 rows of history, because context_length is 127. Python needs the client extra on the caller.

python - <<'PY'
import datetime, json

start = datetime.date(2024, 1, 1)
past = {
    "timestamp": [(start + datetime.timedelta(days=i)).isoformat() for i in range(150)],
    "sales": [120 + (i % 7) * 3 for i in range(150)],
}
payload = {"past": past, "time": "timestamp", "target": ["sales"], "fh": 3,
           "model": "mantis_8m"}
json.dump(payload, open("mantis.json", "w"))
PY

curl -s http://127.0.0.1:8000/predict \
  -H "Content-Type: application/json" -d @mantis.json

Save the Python from the other tab as make_payload.py, then:

python make_payload.py
curl.exe -s http://127.0.0.1:8000/predict -H "Content-Type: application/json" -d "@mantis.json"
import datetime

from tserve.client import Client

start = datetime.date(2024, 1, 1)
past = {
    "timestamp": [(start + datetime.timedelta(days=i)).isoformat() for i in range(150)],
    "sales": [120 + (i % 7) * 3 for i in range(150)],
}

with Client("http://127.0.0.1:8000") as client:
    result = client.predict(
        past=past,
        time="timestamp",
        target=["sales"],
        fh=3,
        model="mantis_8m",
    )
print(result.predictions)

Models

Mantis

MantisForecaster extra mantis 3 models

Embeddings plus an sklearn head. context_length is 127, so past must be longer than that.

model checkpoint
mantis paris-noah/MantisV2
mantis_8m paris-noah/Mantis-8M
mantis_plus paris-noah/MantisPlus

Also loadable here

Next steps