downshift-server 0.4.0__tar.gz → 0.5.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- downshift_server-0.5.1/.github/workflows/ci.yml +89 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/.github/workflows/compatibility-matrix.yml +3 -2
- {downshift_server-0.4.0 → downshift_server-0.5.1}/.github/workflows/release.yml +5 -5
- {downshift_server-0.4.0 → downshift_server-0.5.1}/.gitignore +6 -1
- downshift_server-0.5.1/AGENTS.md +49 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/CHANGELOG.md +65 -0
- downshift_server-0.5.1/PKG-INFO +639 -0
- downshift_server-0.5.1/README.md +589 -0
- downshift_server-0.5.1/bench/BLOG_APPENDIX_v0.4.0.md +200 -0
- downshift_server-0.5.1/bench/README.md +185 -0
- downshift_server-0.5.1/bench/REPORT_v0.4.0.md +563 -0
- downshift_server-0.5.1/bench/__init__.py +1 -0
- downshift_server-0.5.1/bench/_path.py +73 -0
- downshift_server-0.5.1/bench/cases.py +247 -0
- downshift_server-0.5.1/bench/factories.py +39 -0
- downshift_server-0.5.1/bench/hf_models.py +300 -0
- downshift_server-0.5.1/bench/inproc.py +163 -0
- downshift_server-0.5.1/bench/large/__init__.py +1 -0
- downshift_server-0.5.1/bench/large/bert_small.py +27 -0
- downshift_server-0.5.1/bench/large/cnn_large.py +39 -0
- downshift_server-0.5.1/bench/large/mlp_large.py +34 -0
- downshift_server-0.5.1/bench/loadgen.py +111 -0
- downshift_server-0.5.1/bench/naive_hf_server.py +83 -0
- downshift_server-0.5.1/bench/report.py +517 -0
- downshift_server-0.5.1/bench/results/v0.5.0/REPORT.md +495 -0
- downshift_server-0.5.1/bench/results/v0.5.0/chart_runs.csv +1006 -0
- downshift_server-0.5.1/bench/results/v0.5.0/chart_stages.csv +369 -0
- downshift_server-0.5.1/bench/results/v0.5.0/results.json +23212 -0
- downshift_server-0.5.1/bench/results/v0.5.0/results_hf.json +3264 -0
- downshift_server-0.5.1/bench/results_hf_tuned_minilm_v0.4.0.json +391 -0
- downshift_server-0.5.1/bench/results_hf_tuned_pg_v0.4.0.json +219 -0
- downshift_server-0.5.1/bench/results_hf_v0.4.0.json +1390 -0
- downshift_server-0.5.1/bench/results_v0.4.0.json +11905 -0
- downshift_server-0.5.1/bench/run.py +580 -0
- downshift_server-0.5.1/bench/servers.py +136 -0
- downshift_server-0.5.1/docs/code-docs/README.md +56 -0
- downshift_server-0.5.1/docs/code-docs/adapters.md +192 -0
- downshift_server-0.5.1/docs/code-docs/cli.md +225 -0
- downshift_server-0.5.1/docs/code-docs/http-api.md +484 -0
- downshift_server-0.5.1/docs/code-docs/python-api.md +412 -0
- downshift_server-0.5.1/docs/code-docs/serving.md +395 -0
- downshift_server-0.5.1/docs/compatibility.md +27 -0
- downshift_server-0.5.1/docs/production.md +281 -0
- downshift_server-0.5.1/examples/__init__.py +2 -0
- {downshift_server-0.4.0/src/downshift/demo → downshift_server-0.5.1/examples}/clean_mlp.py +1 -1
- {downshift_server-0.4.0/src/downshift/demo → downshift_server-0.5.1/examples}/data_dependent_branch.py +1 -1
- {downshift_server-0.4.0/src/downshift/demo → downshift_server-0.5.1/examples}/scatter_include_self_false.py +2 -2
- downshift_server-0.5.1/llms.txt +60 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/pyproject.toml +8 -6
- {downshift_server-0.4.0 → downshift_server-0.5.1}/scripts/gen_matrix.py +22 -21
- downshift_server-0.5.1/src/downshift/__init__.py +197 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/_imports.py +5 -4
- downshift_server-0.5.1/src/downshift/_version.py +4 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/adapters/_flatten.py +9 -7
- downshift_server-0.5.1/src/downshift/adapters/base.py +62 -0
- downshift_server-0.5.1/src/downshift/adapters/embedding.py +247 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/adapters/generic.py +14 -12
- downshift_server-0.5.1/src/downshift/adapters/hf.py +143 -0
- downshift_server-0.5.1/src/downshift/adapters/pooling.py +19 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/adapters/pyg.py +37 -18
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/adapters/registry.py +26 -21
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/adapters/text.py +19 -16
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/cli/main.py +205 -124
- downshift_server-0.5.1/src/downshift/cli/options.py +288 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/cli/render.py +140 -50
- downshift_server-0.5.1/src/downshift/cli/runtime.py +285 -0
- downshift_server-0.5.1/src/downshift/core/axes.py +130 -0
- downshift_server-0.5.1/src/downshift/core/capture.py +182 -0
- downshift_server-0.5.1/src/downshift/core/export_cache.py +215 -0
- downshift_server-0.5.1/src/downshift/core/feeds.py +28 -0
- downshift_server-0.5.1/src/downshift/core/inputs.py +25 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/core/manifest.py +28 -22
- downshift_server-0.5.1/src/downshift/core/memo.py +424 -0
- downshift_server-0.5.1/src/downshift/core/phase.py +48 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/core/prevalidated.py +26 -12
- downshift_server-0.5.1/src/downshift/core/shapes.py +209 -0
- downshift_server-0.5.1/src/downshift/core/verdict.py +480 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/core/verify.py +104 -94
- downshift_server-0.5.1/src/downshift/hf_repo.py +250 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/loading.py +66 -51
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/logs.py +20 -17
- downshift_server-0.5.1/src/downshift/serve/__init__.py +113 -0
- downshift_server-0.5.1/src/downshift/serve/app.py +557 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/serve/backends.py +65 -117
- downshift_server-0.5.1/src/downshift/serve/codec.py +180 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/serve/describe.py +76 -49
- downshift_server-0.5.1/src/downshift/serve/engine.py +602 -0
- downshift_server-0.5.1/src/downshift/serve/graphs.py +251 -0
- downshift_server-0.5.1/src/downshift/serve/middleware.py +28 -0
- downshift_server-0.5.1/src/downshift/serve/options.py +64 -0
- downshift_server-0.5.1/src/downshift/serve/predict.py +620 -0
- downshift_server-0.5.1/src/downshift/serve/reuse.py +151 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/serve/schemas.py +176 -52
- downshift_server-0.5.1/src/downshift/settings.py +188 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/sources.py +21 -20
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/conftest.py +67 -16
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/models/bf16_weights.py +3 -3
- downshift_server-0.5.1/tests/models/broken_factory.py +7 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/models/custom_autograd.py +2 -2
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/models/data_dependent_branch.py +2 -2
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/models/dict_input.py +1 -1
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/models/dropout_model.py +3 -3
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/models/gnn_gat.py +4 -3
- downshift_server-0.5.1/tests/models/gnn_output_kinds.py +42 -0
- downshift_server-0.5.1/tests/models/hf_repo.py +161 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/models/scatter_include_self_false.py +3 -3
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/models/tied_weights.py +2 -2
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/models/tiny_bert.py +1 -1
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_adapter_discovery_gating.py +6 -6
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_adapters.py +9 -12
- downshift_server-0.5.1/tests/test_axes.py +113 -0
- downshift_server-0.5.1/tests/test_binary_io.py +311 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_capture.py +41 -2
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_cli.py +196 -35
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_cli_startup.py +2 -2
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_demo.py +4 -4
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_describe.py +59 -15
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_embedding.py +144 -30
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_engine.py +55 -18
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_export.py +26 -17
- downshift_server-0.5.1/tests/test_export_cache.py +319 -0
- downshift_server-0.5.1/tests/test_export_pyg.py +83 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_fixtures.py +3 -3
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_gen_matrix.py +3 -3
- downshift_server-0.5.1/tests/test_graph_batching.py +235 -0
- downshift_server-0.5.1/tests/test_hf.py +256 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_hf_text.py +124 -28
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_inputs.py +2 -2
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_loading.py +5 -5
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_logs.py +15 -7
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_main_module.py +1 -1
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_manifest.py +21 -1
- downshift_server-0.5.1/tests/test_memo.py +357 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_package.py +2 -2
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_path_privacy.py +2 -2
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_prevalidated.py +26 -3
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_render.py +117 -7
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_review3_misc.py +12 -19
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_schemas.py +34 -4
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_serve.py +220 -27
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_serve_boot.py +46 -7
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_serve_hardening.py +109 -31
- downshift_server-0.5.1/tests/test_settings.py +148 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_shapes.py +62 -3
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/test_verify_internals.py +17 -16
- downshift_server-0.4.0/.github/workflows/ci.yml +0 -72
- downshift_server-0.4.0/PKG-INFO +0 -454
- downshift_server-0.4.0/README.md +0 -405
- downshift_server-0.4.0/docs/code-docs/README.md +0 -60
- downshift_server-0.4.0/docs/code-docs/adapters.md +0 -250
- downshift_server-0.4.0/docs/code-docs/cli.md +0 -230
- downshift_server-0.4.0/docs/code-docs/http-api.md +0 -477
- downshift_server-0.4.0/docs/code-docs/python-api.md +0 -428
- downshift_server-0.4.0/docs/code-docs/serving.md +0 -408
- downshift_server-0.4.0/docs/compatibility.md +0 -27
- downshift_server-0.4.0/docs/production.md +0 -289
- downshift_server-0.4.0/src/downshift/__init__.py +0 -112
- downshift_server-0.4.0/src/downshift/_version.py +0 -4
- downshift_server-0.4.0/src/downshift/adapters/base.py +0 -56
- downshift_server-0.4.0/src/downshift/adapters/embedding.py +0 -189
- downshift_server-0.4.0/src/downshift/adapters/hf.py +0 -108
- downshift_server-0.4.0/src/downshift/adapters/pooling.py +0 -15
- downshift_server-0.4.0/src/downshift/cli/options.py +0 -208
- downshift_server-0.4.0/src/downshift/cli/runtime.py +0 -314
- downshift_server-0.4.0/src/downshift/core/capture.py +0 -148
- downshift_server-0.4.0/src/downshift/core/inputs.py +0 -25
- downshift_server-0.4.0/src/downshift/core/phase.py +0 -48
- downshift_server-0.4.0/src/downshift/core/shapes.py +0 -99
- downshift_server-0.4.0/src/downshift/core/verdict.py +0 -324
- downshift_server-0.4.0/src/downshift/demo/__init__.py +0 -2
- downshift_server-0.4.0/src/downshift/hf_repo.py +0 -152
- downshift_server-0.4.0/src/downshift/serve/__init__.py +0 -91
- downshift_server-0.4.0/src/downshift/serve/app.py +0 -537
- downshift_server-0.4.0/src/downshift/serve/codec.py +0 -28
- downshift_server-0.4.0/src/downshift/serve/engine.py +0 -568
- downshift_server-0.4.0/src/downshift/serve/middleware.py +0 -24
- downshift_server-0.4.0/src/downshift/serve/options.py +0 -48
- downshift_server-0.4.0/src/downshift/serve/predict.py +0 -273
- downshift_server-0.4.0/src/downshift/settings.py +0 -102
- downshift_server-0.4.0/tests/models/broken_factory.py +0 -7
- downshift_server-0.4.0/tests/models/hf_repo.py +0 -86
- downshift_server-0.4.0/tests/test_export_pyg.py +0 -42
- downshift_server-0.4.0/tests/test_hf.py +0 -67
- downshift_server-0.4.0/tests/test_settings.py +0 -88
- {downshift_server-0.4.0 → downshift_server-0.5.1}/.gitattributes +0 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/LICENSE +0 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/__main__.py +0 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/adapters/__init__.py +0 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/cli/__init__.py +0 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/core/__init__.py +0 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/src/downshift/py.typed +0 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/__init__.py +0 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/models/__init__.py +0 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/models/clean_mlp.py +0 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/models/dynamic_batch_cnn.py +0 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/models/gnn_gcn.py +0 -0
- {downshift_server-0.4.0 → downshift_server-0.5.1}/tests/models/gnn_sage.py +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, develop ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main, develop ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.12", "3.13", "3.14"]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: ${{ matrix.python-version }}
|
|
20
|
+
cache: pip
|
|
21
|
+
- run: pip install torch --index-url https://download.pytorch.org/whl/cpu
|
|
22
|
+
- run: pip install -e ".[dev,gnn,hf,fast]"
|
|
23
|
+
# The HTTPS tests make a throwaway certificate with the openssl command (tests/conftest.py).
|
|
24
|
+
# The runner images have it. The install is only a fallback.
|
|
25
|
+
- name: openssl
|
|
26
|
+
run: command -v openssl || (sudo apt-get update && sudo apt-get install -y openssl); openssl version
|
|
27
|
+
- run: ruff check .
|
|
28
|
+
- run: ruff format --check .
|
|
29
|
+
- run: mypy src
|
|
30
|
+
- run: pytest -q --cov=src/downshift --cov-report=term-missing --cov-fail-under=95
|
|
31
|
+
|
|
32
|
+
floor:
|
|
33
|
+
# This job pins the oldest torch that the dynamo exporter supports (report= on
|
|
34
|
+
# torch.onnx.export is a feature of 2.5). It also pins the oldest onnx, onnxruntime and
|
|
35
|
+
# onnxscript that we verified locally for export and run with it. onnx 1.14 (the previous
|
|
36
|
+
# floor) does not install together with the requirement onnx>=1.16 of onnxscript. onnxscript
|
|
37
|
+
# below 0.5 has a real bug in the type-promotion pass of torch 2.5 on a plain Conv2d with a
|
|
38
|
+
# dynamic batch. Neither fault is specific to the code of this project. onnxruntime 1.17
|
|
39
|
+
# needs numpy<2 for its ABI.
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v4
|
|
43
|
+
- uses: actions/setup-python@v5
|
|
44
|
+
with:
|
|
45
|
+
python-version: "3.12"
|
|
46
|
+
cache: pip
|
|
47
|
+
- run: pip install "torch==2.5.1" --index-url https://download.pytorch.org/whl/cpu
|
|
48
|
+
# transformers 5.19 calls torch.accelerator (torch 2.6 and later) on import. 5.17.0 is the
|
|
49
|
+
# last release with which this job passed.
|
|
50
|
+
- run: pip install "onnx==1.16.0" "onnxruntime==1.17.0" "onnxscript==0.5.0" "numpy<2" "transformers==5.17.0"
|
|
51
|
+
- run: pip install -e ".[dev,gnn,hf,fast]"
|
|
52
|
+
# The HTTPS tests make a throwaway certificate with the openssl command (tests/conftest.py).
|
|
53
|
+
# The runner images have it. The install is only a fallback.
|
|
54
|
+
- name: openssl
|
|
55
|
+
run: command -v openssl || (sudo apt-get update && sudo apt-get install -y openssl); openssl version
|
|
56
|
+
- run: ruff check .
|
|
57
|
+
- run: ruff format --check .
|
|
58
|
+
- run: mypy src
|
|
59
|
+
- name: pytest
|
|
60
|
+
# The newest releases of transformers and torch-geometric that are compatible with these
|
|
61
|
+
# pins do not change this. The dynamo tracer of torch 2.5.1 cannot export a BertModel
|
|
62
|
+
# that is built from scratch with a dynamic sequence axis. It also cannot export a few
|
|
63
|
+
# PyG message-passing patterns (ConstraintViolationError or "Unsupported: call_method"
|
|
64
|
+
# from torch itself). These errors do not come from the code of this project, and no
|
|
65
|
+
# combination of onnx, onnxruntime and onnxscript that we tried fixes them. These tests
|
|
66
|
+
# have `@pytest.mark.needs_torch_26`. conftest.py skips them here, based on
|
|
67
|
+
# torch.__version__, until the floor moves above 2.5.x. All other tests run and pass,
|
|
68
|
+
# including the rest of the hf and gnn suites.
|
|
69
|
+
run: pytest -q
|
|
70
|
+
|
|
71
|
+
windows:
|
|
72
|
+
runs-on: windows-latest
|
|
73
|
+
steps:
|
|
74
|
+
- uses: actions/checkout@v4
|
|
75
|
+
- uses: actions/setup-python@v5
|
|
76
|
+
with:
|
|
77
|
+
python-version: "3.12"
|
|
78
|
+
cache: pip
|
|
79
|
+
- run: pip install torch --index-url https://download.pytorch.org/whl/cpu
|
|
80
|
+
- run: pip install -e ".[dev,gnn,hf,fast]"
|
|
81
|
+
# The HTTPS tests make a throwaway certificate with the openssl command (tests/conftest.py).
|
|
82
|
+
# The runner image has it. The install is only a fallback.
|
|
83
|
+
- name: openssl
|
|
84
|
+
shell: bash
|
|
85
|
+
run: command -v openssl || choco install openssl -y --no-progress; openssl version
|
|
86
|
+
- run: ruff check .
|
|
87
|
+
- run: ruff format --check .
|
|
88
|
+
- run: mypy src
|
|
89
|
+
- run: pytest -q --cov=src/downshift --cov-report=term-missing --cov-fail-under=95
|
{downshift_server-0.4.0 → downshift_server-0.5.1}/.github/workflows/compatibility-matrix.yml
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
name: Compatibility matrix
|
|
2
2
|
|
|
3
|
-
# The matrix is the
|
|
4
|
-
#
|
|
3
|
+
# The matrix is the core claim of the project. An old matrix is worse than no matrix. The job
|
|
4
|
+
# therefore regenerates it every week against the current torch and onnxruntime. It opens a PR if
|
|
5
|
+
# the matrix changes.
|
|
5
6
|
|
|
6
7
|
on:
|
|
7
8
|
schedule:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
name: Release
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
# version in pyproject.toml
|
|
5
|
-
#
|
|
3
|
+
# The publication of a GitHub Release starts this job. The tag of that release must match the
|
|
4
|
+
# version in pyproject.toml. The tests must pass on it. Only then do the sdist and the wheel go
|
|
5
|
+
# to PyPI. workflow_dispatch runs only the build gates and the test gates. It publishes nothing.
|
|
6
6
|
|
|
7
7
|
on:
|
|
8
8
|
release:
|
|
@@ -24,8 +24,8 @@ jobs:
|
|
|
24
24
|
|
|
25
25
|
- run: pip install build twine
|
|
26
26
|
|
|
27
|
-
# A release
|
|
28
|
-
#
|
|
27
|
+
# A release with the tag v0.1.9 that ships 0.2.0 cannot be repaired. PyPI never accepts
|
|
28
|
+
# a second upload of a version. Fail here and not after the upload.
|
|
29
29
|
- name: Check tag matches pyproject version
|
|
30
30
|
if: github.event_name == 'release'
|
|
31
31
|
run: |
|
|
@@ -37,6 +37,7 @@ Thumbs.db
|
|
|
37
37
|
*.onnx.data
|
|
38
38
|
artifacts/
|
|
39
39
|
tmp/
|
|
40
|
+
*.pem
|
|
40
41
|
|
|
41
42
|
# Local tooling config
|
|
42
43
|
.claude/
|
|
@@ -46,4 +47,8 @@ tmp/
|
|
|
46
47
|
# not part of the package or CI, kept out of version control on purpose.
|
|
47
48
|
scripts/validate_pypi_release.py
|
|
48
49
|
scripts/.validation/
|
|
49
|
-
|
|
50
|
+
|
|
51
|
+
# Benchmark harness: scripts and published runs are tracked; the downloaded Hugging Face
|
|
52
|
+
# checkpoints (GBs) and ad-hoc output are not. See bench/README.md.
|
|
53
|
+
bench/models/
|
|
54
|
+
bench/scratch/
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This file is for coding agents that work in this repository. To use downshift as a package, read [llms.txt](llms.txt).
|
|
4
|
+
|
|
5
|
+
## Set up
|
|
6
|
+
|
|
7
|
+
1. Install a CPU build of torch: `pip install torch --index-url https://download.pytorch.org/whl/cpu`.
|
|
8
|
+
2. Install the package in editable mode: `pip install -e ".[dev,gnn,hf,fast]"`.
|
|
9
|
+
3. If a non-editable `downshift-server` is also installed, set `PYTHONPATH=src`. If you do not, the tests import the installed copy and not your changes.
|
|
10
|
+
|
|
11
|
+
The project needs Python 3.12 to 3.14. The tests run on the CPU. A GPU is not necessary. The HTTPS tests need the `openssl` command on `PATH`. They make a throwaway certificate with it. Without `openssl`, they skip. In CI, they fail.
|
|
12
|
+
|
|
13
|
+
## Check a change
|
|
14
|
+
|
|
15
|
+
CI runs these commands. Run them before you finish:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
ruff check .
|
|
19
|
+
ruff format --check .
|
|
20
|
+
mypy src
|
|
21
|
+
pytest -q
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
CI requires 95% line coverage (`--cov-fail-under=95`). Add a test for each new code path.
|
|
25
|
+
|
|
26
|
+
While you work, run only the test files that apply to the change. Run the full suite one time, at the end.
|
|
27
|
+
|
|
28
|
+
## Layout
|
|
29
|
+
|
|
30
|
+
| Path | Contents |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `src/downshift/core/` | Export, verification, the verdict, the export cache. |
|
|
33
|
+
| `src/downshift/adapters/` | The model families: generic, pyg, hf, onnx. |
|
|
34
|
+
| `src/downshift/serve/` | The FastAPI app, the backends, the request path. |
|
|
35
|
+
| `src/downshift/cli/` | The `check`, `export` and `serve` commands. |
|
|
36
|
+
| `src/downshift/settings.py` | The defaults and the `DOWNSHIFT_*` environment variables. |
|
|
37
|
+
| `tests/` | pytest. `tests/models/` has small models with known verdicts. |
|
|
38
|
+
| `docs/` | The user documentation. |
|
|
39
|
+
| `examples/` | The models of the README commands. |
|
|
40
|
+
|
|
41
|
+
## Rules
|
|
42
|
+
|
|
43
|
+
- Keep the CLI modules free of torch at import time. `downshift --help` and `--version` must stay fast. Import heavy modules inside the function bodies.
|
|
44
|
+
- Per-request speed has priority over boot time. Do not add work to the request path without a measurement.
|
|
45
|
+
- Keep the code simple. Prefer a plain function or a small dataclass to a new class hierarchy, registry or wrapper.
|
|
46
|
+
- Give each usage error a next step. A `ValueError` from a command is exit code `4`. Its message must say what to change.
|
|
47
|
+
- Write docs, comments, CLI help and error messages in ASD-STE100 Simplified Technical English. Use short sentences and one meaning for each word. Write steps as commands. Put conditions first.
|
|
48
|
+
- Add a new `serve` option in these places: `settings.py`, `cli/options.py`, `serve_cmd`, `docs/code-docs/cli.md` and `docs/production.md`. Refer to "Add a `serve` option" in `docs/code-docs/cli.md`.
|
|
49
|
+
- Record each change that a user can see in `CHANGELOG.md`.
|
|
@@ -3,6 +3,71 @@
|
|
|
3
3
|
All notable changes to this project are documented here. Format follows
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
5
|
|
|
6
|
+
## 0.5.1 - 2026-10-11
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- HTTPS. `serve --ssl-certfile PATH --ssl-keyfile PATH` (or `DOWNSHIFT_SSL_CERTFILE` and `DOWNSHIFT_SSL_KEYFILE`) serves HTTPS with your certificate. For an encrypted key, set `DOWNSHIFT_SSL_KEYFILE_PASSWORD`. Downshift loads the files before the model. A bad file is a usage error (exit code `4`) with a next step. Downshift uses the TLS settings of `ssl.create_default_context`: TLS 1.2 or later and the cipher list of the standard library. The default of uvicorn also enables NULL and anonymous ciphers. `--workers N` works with HTTPS. The banner, the `will listen on` line and `example_curl` in `/schema` show `https://`. The `serving with:` block has a `tls` row. Refer to "HTTPS" in `docs/production.md`.
|
|
11
|
+
- `GET /`. It gives the service name, the version, `ready`, the model, all routes, and the next step (`GET /schema`). A client that knows only the base URL can find the input format. If the API key is active, this route needs the key.
|
|
12
|
+
- `llms.txt` and `AGENTS.md` at the root of the repo. `llms.txt` tells an LLM agent how to call a server and how to host a model. `AGENTS.md` tells a coding agent how to set up, test and change this repo.
|
|
13
|
+
- `--help` of `check`, `export` and `serve` shows the exit codes and an example.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- More usage errors give a next step. These errors changed:
|
|
18
|
+
- A missing adapter file.
|
|
19
|
+
- A missing or read-only `--export-cache-dir`.
|
|
20
|
+
- `export` of a `.onnx` file.
|
|
21
|
+
- `--backend torch` with no PyTorch model.
|
|
22
|
+
- A repo with `auto_map`.
|
|
23
|
+
- A pooling recipe that downshift cannot apply.
|
|
24
|
+
|
|
25
|
+
A client or script that matches the old text must change.
|
|
26
|
+
- The `400` for text that is too long had a doubled word. The message now also gives the next step: send shorter text, or split the text into more rows.
|
|
27
|
+
|
|
28
|
+
## 0.5.0 - 2026-10-10
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- Safetensors request and response bodies. `/predict` and `/predict/graph` accept `Content-Type: application/vnd.safetensors` (`application/octet-stream` is an alias). The body has one tensor for each input name. A reader that we wrote decodes it. There is no pickle, no `np.load`, no BF16 and no silent dtype cast. To get the outputs in this format, send `Accept: application/vnd.safetensors` or `"output_encoding": "safetensors"`. The predictions and the embedding information are in `__metadata__`. Any other binary content type gets a 415.
|
|
33
|
+
- Graph batches on `/predict/graph`. Send `graphs: [{x, edge_index, edge_attr?}, ...]`, or a safetensors body with `num_nodes` and `num_edges`. The batch runs as one inference. The server then splits the outputs for each graph. Verification classifies axis 0 of each output as node, edge or fixed. A model whose output cannot be split (a pooled or fixed-size output) refuses a batch of more than one graph. `/schema` lists `graph_batching` for each output.
|
|
34
|
+
- Decoder-based text embedders (Qwen3-Embedding style). A `...ForCausalLM` repo with a sentence-transformers embedding recipe, or with `--pooling`, loads its backbone without the LM head. Downshift serves the pooled output. It uses the padding side of the tokenizer and verifies it. Left padding works. Pooling with `lasttoken` and `weightedmean` is supported. `prompt_name` on a predict adds one of the named prompts of the repo at the start of the text. `/schema` lists the prompts.
|
|
35
|
+
- `--axis-max NAME=N` and `DOWNSHIFT_AXIS_MAX` lower a dynamic axis to N. They use one verification sample at exactly N. An unknown name, or a value above the ceiling of the model, is a usage error.
|
|
36
|
+
- Sampled and served ranges. The verdict, the banner, `/metadata` and `/schema` show the served bounds of each dynamic axis next to the range that verification sampled. The banner marks axes that are served beyond twice the verified range. The batch axis is an exception.
|
|
37
|
+
- An export cache. The last two verified exports stay in memory. A repeat `check()`, `export()` or `app_for()` in the same process then skips the export and the verification. A hit for a Hugging Face repo never calls `from_pretrained`. `--export-cache-dir DIR` adds a disk tier. Its key is the content of the weights, so a restart reuses the export. It uses atomic writes, hashes the manifest again when it reads it, and uses feeds without pickle. A directory that cannot be written gives exit code 4. The `Boot` row of the banner says when the cache was reused.
|
|
38
|
+
- A separate prep pool and the option `--prep-threads` (default `min(4, usable CPUs)`) for the parsing and conversion of requests. A large text request does not hold an inference slot. `Server-Timing` and the access log have two new stages: `prep_wait` and `infer_wait`. The request timeout ends when the inference starts. CPU counts follow cgroup quotas.
|
|
39
|
+
- ONNX external data. A model of more than 1.8 GB exports as `model.onnx` and `model.onnx.data`. Before, it failed. Verification, `export`, the manifest and the `--workers` handoff all follow this.
|
|
40
|
+
- `downshift serve --log-level info` prints all settings of the server as one `serving with:` block, directly before `ready`. The settings are the host, the port, the workers, the log level, all serve options, and `api_key` as `set` or `unset`. The banner and the `loading` line now name the model by its file name and not by its path.
|
|
41
|
+
- `--execution threadpool|inline` and `DOWNSHIFT_EXECUTION` (default `threadpool`). `inline` parses, infers and encodes small JSON bodies on the event loop, with no thread hop. A small body has a Content-Length of up to 64 KiB and no `text`. This mode helps only models that take less than about 1 ms for one inference. A slow model stalls `/health` and `/ready`. The banner has an `Execution` row. `/metadata` has an `execution` field.
|
|
42
|
+
- `--middleware` also accepts pure ASGI middleware classes, such as `starlette.middleware.gzip:GZipMiddleware`. It still accepts `BaseHTTPMiddleware` subclasses and `async (request, call_next)` functions.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- A predict request makes two thread hops. Before, it made four. The prep pool parses, validates and converts the body as one step. The inference thread encodes the response directly after the inference. The encoding therefore holds the inference slot. The predict routes also skip the own body handling of FastAPI. These numbers compare 0.4.0 and 0.5.0 in the same benchmark session. They are the peak requests per second at batch 1: `clean_mlp` 1030 against 866, `mlp_large` 815 against 696, `bert_small` 106 against 102. For all-MiniLM-L6-v2 with 8 clients: 282 against 239, and 483 against 434 at `--max-concurrency 4`. Refer to `bench/results/v0.5.0/REPORT.md`. `--prep-threads` now covers only the parsing and conversion of requests.
|
|
47
|
+
- `--max-concurrency` and `DOWNSHIFT_MAX_CONCURRENCY` default to 4. Before, the default was 1. At 1, a hand-written FastAPI `def` server was faster than the defaults of downshift under load. These measurements used 4 to 8 concurrent clients. For all-MiniLM-L6-v2 (batch 8): 52 req/s at 1 and 134 req/s at 4. For Qwen3-Embedding-0.6B (one query, CPU): 7.2 at 1 and 14.6 at 4. The latency of a single request did not change. Each inference in progress holds its own activation memory. To get the old behaviour, pass `--max-concurrency 1`.
|
|
48
|
+
- `--backend auto` does not export a model whose floating weights are all bfloat16. The CPU kernels of ONNX Runtime have no bf16 Gemm. The export always ended in a graph that ONNX Runtime could not load. For Qwen3-Embedding-0.6B, this wasted 89 s and 1.35 GB of RAM at boot. Downshift now serves torch immediately, and the banner gives the reason. `check` and `--backend onnxruntime` still try the export.
|
|
49
|
+
- The description of `--intra-op-threads` is now correct. It sets the number of threads inside one operation, for the backend that serves (ONNX Runtime, or `torch.set_num_threads`). More threads decrease the latency of one request. They decrease throughput under concurrent load.
|
|
50
|
+
- `--max-body-bytes` defaults to 32 MiB. Before, it was 64 MiB.
|
|
51
|
+
- Breaking change for third-party adapters. `Adapter.prepare(model, example_inputs)` is now `prepare(model, example_inputs, axis_max=None)`. Add the parameter. To support `--axis-max`, lower the named `torch.export.Dim` objects with `downshift.core.shapes.lower_axis_max`. Then pin verification sample 1 at those sizes (`pin_vary_fn`). An adapter that ignores the parameter serves its own bounds.
|
|
52
|
+
- Breaking change: an adapter has one identity, its `name`. `Adapter.family` is removed. `model_family` is now the adapter name. This applies to the manifest, `check --json`, `family` in `/metadata`, and `/schema`. `hf` was `hf-transformers`. `generic` was `generic-torch`. `pyg` and `onnx` do not change. To upgrade, remove `family` from a custom adapter. Build its `Prepared` with `family=self.name`.
|
|
53
|
+
- Breaking change: `execution` in `/metadata` is a plain string (`"threadpool"` or `"inline"`). Before, it was `{"mode": ...}`. `limits` in `/metadata` is a typed block. `limits` in `/schema` now has the same five fields. Before, it had only the two byte limits.
|
|
54
|
+
- Breaking change: a failed request is a 400 only when ONNX Runtime rejects the input itself (`InvalidArgument`). Every other failure inside the inference is a 500. Downshift now checks the rank and the fixed axes of the input against the model before the inference (`"x axis 1 is 5; this model takes 16"`). The common mistakes of clients are therefore still 400 errors on both backends. An error that torch raises from inside the model is no longer a client error because of its message.
|
|
55
|
+
- Breaking change: `ExportVerdict.status` is a `Status` string enum (`downshift.core.verdict.Status`). It is still equal to `"CLEAN"` and the other values. It serializes in the same way.
|
|
56
|
+
- Breaking change: `NumericsReport.session` is removed. The verdict keeps the ONNX Runtime session that verification used, as a private value. It gives the session to the server one time.
|
|
57
|
+
- Breaking change: `downshift.loading` no longer re-exports `IN_PROCESS_MODULE` and `SOURCE_KIND_HELP`. Import them from `downshift.sources`. `downshift.cli.main._serve_app_factory` is removed. It is now in `downshift.cli.runtime`.
|
|
58
|
+
- Breaking change: the `downshift.demo` models are no longer in the wheel. They are in `examples/` at the root of the repo. The README commands run from a clone as `examples.scatter_include_self_false:make_model`.
|
|
59
|
+
- The wording of error messages changed in the prose rewrite. This includes the `detail` text of 400 responses (for example `"x axis 1 is 5; this model takes 16"`), the CLI help, and the errors of the model loader. A load error now starts with `unknown file type` or `incomplete Hugging Face repo`, and an import error starts with `cannot import`. Before, these started with `don't know how to load`, `can't load` and `can't import`. A client or script that matches the old text must change.
|
|
60
|
+
- `check`, `export` and `serve` on the command line do not hash all weights for the in-process export memo. One export for each process cannot reuse it. With `--export-cache-dir`, downshift still computes the key for the disk tier.
|
|
61
|
+
- `export` writes the graph that it already serialized. It does not serialize it a second time.
|
|
62
|
+
- `serve --workers N`: the parent reuses the ONNX Runtime session of the verification. Before, it built a second session only to print the banner. Workers boot from the export of the parent in the same way as for a cache hit.
|
|
63
|
+
- A batched safetensors body on `/predict/graph` is no longer cut into one piece for each graph and then joined again. Downshift checks and offsets the node ids in one pass.
|
|
64
|
+
- Downshift decodes a safetensors request body one time and gives it to the route as it is. An unknown `output_encoding` in its `__metadata__` gives a 400.
|
|
65
|
+
- A bad `DOWNSHIFT_BACKEND` or `DOWNSHIFT_OUTPUT_ENCODING` fails at startup. The error gives the name of the variable and the accepted values.
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
|
|
69
|
+
- A stored export failure no longer keeps all `torch.export` frames (and the model) alive. Before, this happened for the whole life of a server that falls back to torch.
|
|
70
|
+
|
|
6
71
|
## 0.4.0 - 2026-09-26
|
|
7
72
|
|
|
8
73
|
### Fixed
|