modelpolis 0.1.0__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.
Files changed (32) hide show
  1. modelpolis-0.1.0/LICENSE +21 -0
  2. modelpolis-0.1.0/PKG-INFO +223 -0
  3. modelpolis-0.1.0/README.md +206 -0
  4. modelpolis-0.1.0/pyproject.toml +38 -0
  5. modelpolis-0.1.0/setup.cfg +4 -0
  6. modelpolis-0.1.0/src/modelpolis/__init__.py +31 -0
  7. modelpolis-0.1.0/src/modelpolis/builder/__init__.py +1 -0
  8. modelpolis-0.1.0/src/modelpolis/builder/image.def.tmpl +25 -0
  9. modelpolis-0.1.0/src/modelpolis/builder/image.py +221 -0
  10. modelpolis-0.1.0/src/modelpolis/builder/model_toml.py +100 -0
  11. modelpolis-0.1.0/src/modelpolis/builder/publish.py +303 -0
  12. modelpolis-0.1.0/src/modelpolis/builder/verify.py +226 -0
  13. modelpolis-0.1.0/src/modelpolis/builder/weights.py +212 -0
  14. modelpolis-0.1.0/src/modelpolis/cli.py +679 -0
  15. modelpolis-0.1.0/src/modelpolis/paths.py +39 -0
  16. modelpolis-0.1.0/src/modelpolis/runner/__init__.py +1 -0
  17. modelpolis-0.1.0/src/modelpolis/runner/api.py +525 -0
  18. modelpolis-0.1.0/src/modelpolis/runner/conformance.py +375 -0
  19. modelpolis-0.1.0/src/modelpolis/runner/launch.py +165 -0
  20. modelpolis-0.1.0/src/modelpolis/runner/model.py +382 -0
  21. modelpolis-0.1.0/src/modelpolis/runner/store.py +297 -0
  22. modelpolis-0.1.0/src/modelpolis/worker/__init__.py +5 -0
  23. modelpolis-0.1.0/src/modelpolis/worker/adapter.py +45 -0
  24. modelpolis-0.1.0/src/modelpolis/worker/main.py +85 -0
  25. modelpolis-0.1.0/src/modelpolis/worker/serve.py +332 -0
  26. modelpolis-0.1.0/src/modelpolis/worker/torch_gpu.py +128 -0
  27. modelpolis-0.1.0/src/modelpolis.egg-info/PKG-INFO +223 -0
  28. modelpolis-0.1.0/src/modelpolis.egg-info/SOURCES.txt +30 -0
  29. modelpolis-0.1.0/src/modelpolis.egg-info/dependency_links.txt +1 -0
  30. modelpolis-0.1.0/src/modelpolis.egg-info/entry_points.txt +2 -0
  31. modelpolis-0.1.0/src/modelpolis.egg-info/requires.txt +5 -0
  32. modelpolis-0.1.0/src/modelpolis.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Tan Lab
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,223 @@
1
+ Metadata-Version: 2.4
2
+ Name: modelpolis
3
+ Version: 0.1.0
4
+ Summary: Run sequence-to-function models through one model-agnostic API, each in its own Apptainer image.
5
+ Author: Tan Lab
6
+ License-Expression: MIT
7
+ Project-URL: Repository, https://github.com/tanjiminlab/modelpolis-sequence
8
+ Project-URL: Issues, https://github.com/tanjiminlab/modelpolis-sequence/issues
9
+ Requires-Python: >=3.11
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: numpy>=1.26
13
+ Provides-Extra: dev
14
+ Requires-Dist: pytest; extra == "dev"
15
+ Requires-Dist: ruff; extra == "dev"
16
+ Dynamic: license-file
17
+
18
+ # modelpolis-sequence
19
+
20
+ One Python API for sequence-to-function prediction. Each model runs in its own
21
+ Apptainer image, with its framework and weights inside.
22
+
23
+ ## Prerequisites
24
+
25
+ Run these checks in Bash before installing. The quickstart uses NVIDIA GPU 0.
26
+
27
+ | Need | One-line check |
28
+ | --- | --- |
29
+ | Linux on x86-64 | `uname -sm` |
30
+ | NVIDIA GPU and a driver compatible with CUDA 12.8 (tested driver: 580.178.04) | `nvidia-smi` |
31
+ | Apptainer on PATH; user namespaces enabled (tested: 1.4.5). Building an image yourself also needs builds without root using `--fakeroot` | `apptainer version && unshare -Ur true` |
32
+ | conda, initialized for this shell | `conda --version` |
33
+ | Git and curl | `git --version && curl --version` |
34
+ | HTTPS access to GitHub, conda-forge, PyPI, Docker Hub and Google Cloud Storage | `curl -I https://github.com https://conda.anaconda.org/conda-forge/ https://pypi.org https://registry-1.docker.io/v2/ https://storage.googleapis.com` |
35
+ | Budget 10 GiB free for the environment and the first image (40 GiB to build an image yourself); check each filesystem if separate | `df -h . "$HOME" /tmp` |
36
+
37
+ The registry probe normally returns HTTP 401 and the storage root HTTP 400;
38
+ both confirm connectivity.
39
+ `unshare` checks user namespaces. No host PyTorch, JAX or CUDA toolkit is needed.
40
+
41
+ ## Install
42
+
43
+ ```bash
44
+ git clone https://github.com/tanjiminlab/modelpolis-sequence
45
+ cd modelpolis-sequence
46
+ conda env create -f environment.yml
47
+ conda activate modelpolis-sequence
48
+ pip install -e .
49
+ ```
50
+
51
+ ## First prediction
52
+
53
+ Malinois predicts MPRA activity in K562, HepG2 and SK-N-SH as log2 RNA/DNA fold
54
+ change from an oligo of 1–200 bases.
55
+
56
+ Fetch its image from the registry, then predict. Run from the checkout with the
57
+ conda environment active:
58
+
59
+ ```bash
60
+ modelpolis fetch malinois
61
+ python examples/quickstart.py
62
+ ```
63
+
64
+ `fetch` downloads one 4.8 GB file from Docker Hub with Apptainer and checks its
65
+ sha256 against [catalog.toml](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/catalog.toml). On stderr, before a pull it prints
66
+ `Pulling <name> <version> from <reference>`; after a catalogue pull it prints
67
+ the image's licence (see [Licences and downloading](#licences-and-downloading)),
68
+ or after a pull by rule, `Licence and citation: https://hub.docker.com/r/tanlab/modelpolis-<name>`.
69
+ No pull means neither line. No registry login, data root or input file is needed.
70
+ `mp.load("malinois")` fetches a missing image itself; `fetch` does it ahead of time.
71
+ Every `load` prints `Loading <name> <version> from <sif> on <device>` on stderr
72
+ before starting the worker, using the name and version from the image's spec.
73
+
74
+ The example generates one seeded random 200-base DNA sequence and prints on stdout:
75
+
76
+ ```text
77
+ activity (1, 3)
78
+ K562: -0.088692
79
+ HepG2: -0.056804
80
+ SK-N-SH: 0.084662
81
+ ```
82
+
83
+ The shape is exact; the three prediction values can differ slightly between GPUs
84
+ and runs.
85
+
86
+ The commands leave the conda environment and editable checkout installed and the
87
+ image under `~/.cache/modelpolis/images/malinois/`. Set `MODELPOLIS_HOME` before
88
+ fetching to put the store elsewhere. The example prints predictions without
89
+ saving an output file.
90
+
91
+ ### Building an image yourself
92
+
93
+ Every model can also be built from its directory, and AlphaGenome, PARM and
94
+ motif ensemble score must be:
95
+
96
+ ```bash
97
+ modelpolis build malinois
98
+ modelpolis verify malinois
99
+ modelpolis publish malinois
100
+ ```
101
+
102
+ `publish` places the verified SIF in the local store, where `mp.load` finds it,
103
+ and rewrites the model's entry in the checkout's `catalog.toml` with your SIF's
104
+ checksum, marked `local`; rebuilds have different checksums. Nothing is pushed.
105
+ A Malinois build took about 5 minutes on both an RTX PRO 6000 and an RTX 5090
106
+ with the PyTorch base image cached. With `precision = "auto"`, the build tries
107
+ `bf16-mixed` first; if its reference check fails, it discards that image and
108
+ builds `fp32`, so two build logs and `FAIL` lines for the trial can be expected.
109
+ See [Adding a model](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/docs/adding-a-model.md).
110
+
111
+ **Note:** Enformer, Borzoi and AlphaGenome pass `verify` only on the GPU model
112
+ that made their references (RTX PRO 6000 Blackwell) and fail P1 on an RTX 5090.
113
+ The other six GPU models verify on both; other GPU hardware is untested.
114
+ See [ROADMAP, M6.T6](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/plan/ROADMAP.md#m6t6-have-someone-else-follow-the-readme-on-another-machine)
115
+ for the numbers. A fetched image is not verified on your GPU.
116
+
117
+ ## Models
118
+
119
+ One row per entry in [catalog.toml](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/catalog.toml). Versions identify these images,
120
+ not upstream releases. Inputs are uppercase DNA (`ACGTN`), lengths are in bases,
121
+ and output shapes are for full-length inputs, without the leading batch axis.
122
+ CUDA means an NVIDIA GPU; the listed CPU alternatives may be slower. Model links
123
+ include reference and publication checks.
124
+
125
+ | Model | Version | Input length | Outputs per sequence | Device | Paper or source |
126
+ | --- | --- | --- | --- | --- | --- |
127
+ | [AlphaGenome](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/alphagenome/reference/publication_check.md) (`alphagenome`) | 2.0.0 | 2,048 (default) or 16,384 | Human CAGE, RNA-seq, DNase, ATAC: length × 546, 667, 305, 167 tracks respectively | CUDA | [Avsec et al., 2026](https://doi.org/10.1038/s41586-025-10014-0) |
128
+ | [Borzoi](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/borzoi/reference/publication_check.md) (`borzoi`) | 2.0.0 | 524,288 | `human`: 6,144 bins × 7,611 tracks, 32 bp/bin; four-replicate mean | CUDA | [Linder et al., 2025](https://doi.org/10.1038/s41588-024-02053-6) |
129
+ | [ChromBPNet](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/chrombpnet/reference/publication_check.md) (`chrombpnet`) | 1.0.0 | 2,114 | K562 ATAC-seq `profile`: 1,000 probabilities; `log_count`: 1 value (fold 0, bias-corrected) | CUDA, CPU | [ENCODE model ENCFF984RAF](https://www.encodeproject.org/files/ENCFF984RAF/) |
130
+ | [Enformer](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/enformer/reference/publication_check.md) (`enformer`) | 2.0.0 | 196,608 | `human`: 896 × 5,313; `mouse`: 896 × 1,643 (bins × tracks, 128 bp/bin) | CUDA, CPU | [Avsec et al., 2021](https://doi.org/10.1038/s41592-021-01252-x) |
131
+ | [Malinois](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/malinois/reference/publication_check.md) (`malinois`) | 1.1.0 | 1–200 | `activity`: 3 MPRA values (K562, HepG2, SK-N-SH), log2 RNA/DNA fold change | CUDA, CPU | [Gosai et al., 2024](https://doi.org/10.1038/s41586-024-08070-z) |
132
+ | [Motif ensemble score](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/motif_ensemble_score/reference/publication_check.md) (`motif_ensemble_score`) | 1.0.0 | ≤256; ≥50 non-N bases | `score`, `score_dedup`, `score_panel`: 1 K562 value each | CPU | [Supplied scoring script; unpublished](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/motif_ensemble_score/source_checksums.json) |
133
+ | [Orca](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/orca/reference/publication_check.md) (`orca`) | 1.0.0 | 32,000,000 | `h1esc`, `hff`: 6 scales × 250 × 250 contact-map bins (32 Mb down to 1 Mb), log fold over the distance background | CUDA | [Zhou, 2022](https://doi.org/10.1038/s41588-022-01065-4) |
134
+ | [PARM](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/parm/reference/publication_check.md) (`parm`) | 1.0.0 | 1–600 | `activity`: 1 K562 promoter value, log2 RPM; five-fold mean | CUDA, CPU | [Barbadilla-Martínez et al., 2026](https://doi.org/10.1038/s41586-025-10093-z) |
135
+ | [Puffin-D](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/puffin/reference/publication_check.md) (`puffin`) | 1.0.0 | 100,000 | `initiation`: 100,000 bases × 10 strand-specific tracks, log10(signal + 1) | CUDA, CPU | [Dudnyk et al., 2024](https://doi.org/10.1126/science.adj0116) |
136
+ | [Sei](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/sei/reference/publication_check.md) (`sei`) | 1.0.0 | 4,096 | `chromatin`: 21,907 probabilities; `sequence_class`: 40 scores | CUDA, CPU | [Chen et al., 2022](https://doi.org/10.1038/s41588-022-01102-2) |
137
+
138
+ See [Licences and downloading](#licences-and-downloading) for image availability,
139
+ terms and local build inputs. Padding, cropping and options are described in the
140
+ model spec and the [API guide](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/docs/api.md).
141
+
142
+ ## Licences and downloading
143
+
144
+ Seven images are published at Docker Hub under `tanlab`, as
145
+ `tanlab/modelpolis-<name>`. `modelpolis fetch <name>` or `mp.load("<name>")`
146
+ pulls one under the terms below and checks its sha256 against
147
+ [catalog.toml](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/catalog.toml). The other three are not distributed.
148
+
149
+ | Model | How to get it | Code and weight licences | Restrictions | Citation |
150
+ | --- | --- | --- | --- | --- |
151
+ | `alphagenome` | Not distributed: protected weights; project policy | [Apache-2.0 (code)](https://github.com/google-deepmind/alphagenome_research/blob/936f89ba48f5c0f1b1450ac93815d28840cea928/LICENSE), [AlphaGenome model terms (weights)](https://storage.googleapis.com/alphagenome/terms/AlphaGenome-Model-Terms-of-Use.pdf) | Non-commercial organizations and purposes only; no clinical use or circumvention of access restrictions; comply with model/output terms and supply the terms, modification notices and Notice file when distributing. | [Avsec et al., 2026](https://doi.org/10.1038/s41586-025-10014-0) |
152
+ | `borzoi` | `modelpolis fetch borzoi` | [Apache-2.0 (code: borzoi-pytorch)](https://files.pythonhosted.org/packages/16/e5/9b0458b7e5b2c341b626aa2ed885074a64abfd2e8122591bf015469baef1/borzoi-pytorch-0.4.4.tar.gz), [CC-BY-4.0 (weights)](https://creativecommons.org/licenses/by/4.0/legalcode) | Attribution only | [Linder et al., 2025](https://doi.org/10.1038/s41588-024-02053-6) |
153
+ | `chrombpnet` | `modelpolis fetch chrombpnet` | [MIT (code)](https://github.com/kundajelab/chrombpnet/blob/09938fdb4397ec0006510e5251e48920a505d4de/LICENSE), [ENCODE data-use policy (weights: ENCFF984RAF)](https://www.encodeproject.org/about/data-use-policy/) | Attribution only | [Pampari et al., 2024 (preprint)](https://doi.org/10.1101/2024.12.25.630221) |
154
+ | `enformer` | `modelpolis fetch enformer` | [MIT (code: enformer-pytorch)](https://files.pythonhosted.org/packages/7a/73/81c9a4d7590c0e14d4c18d293257dc5a267bf59bd875d04967e37e5861f9/enformer_pytorch-0.8.10.tar.gz), [CC-BY-4.0 (weights)](https://creativecommons.org/licenses/by/4.0/legalcode) | Attribution only | [Avsec et al., 2021](https://doi.org/10.1038/s41592-021-01252-x) |
155
+ | `malinois` | `modelpolis fetch malinois` | [MIT (model code and weights)](https://github.com/sjgosai/boda2/blob/d74deca7a754f98f5dfefc1fd3f4506fed764947/LICENSE.mit), [AGPL-3.0 (other boda2 code)](https://github.com/sjgosai/boda2/blob/d74deca7a754f98f5dfefc1fd3f4506fed764947/LICENSE) | AGPL-3.0 code: retain notices and provide corresponding source; modified covered code must follow AGPL-3.0, including its network-source requirement. | [Gosai et al., 2024](https://doi.org/10.1038/s41586-024-08070-z) |
156
+ | `motif_ensemble_score` | Not distributed: unpublished method; no redistribution grant | [No licence specified (supplied code and fitted weights)](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/docs/decisions/2026-11-28-model-licences.md#motif_ensemble_score) | No licence grants permission to redistribute the supplied code or fitted weights. | Supplied score, unpublished, 2026; scanner: [Grant, Bailey and Noble, 2011 (FIMO)](https://doi.org/10.1093/bioinformatics/btr064) |
157
+ | `orca` | `modelpolis fetch orca` | [Academic research use only (code)](https://github.com/jzhoulab/orca/blob/42aea5eed4214641d717b02351389d631f01c1d8/LICENSE), [CC-BY-4.0 (weights)](https://creativecommons.org/licenses/by/4.0/legalcode) | Academic research use only; no commercial use; no use or redistribution by a for-profit entity. | [Zhou, 2022](https://doi.org/10.1038/s41588-022-01065-4) |
158
+ | `parm` | Not distributed: evaluation agreement restricts redistribution | [Oncode evaluation licence (code), no separate licence specified (weights)](https://github.com/vansteensellab/PARM/blob/260a27082942060364c1c4e2393018a0fa128844/LICENSE) | Accept the Oncode evaluation agreement; academic research purposes only; non-transferable and non-sublicensable; distribution, publication and services for consideration are restricted. | [Barbadilla-Martínez et al., 2026](https://doi.org/10.1038/s41586-025-10093-z) |
159
+ | `puffin` | `modelpolis fetch puffin` | [Academic research use only (code)](https://github.com/jzhoulab/puffin/blob/9bc81eb922f44556879d1d2afd4c757a1d6c291e/LICENSE), [CC-BY-4.0 (weights)](https://creativecommons.org/licenses/by/4.0/legalcode) | Academic research use only; no commercial use; no use or redistribution by a for-profit entity. | [Dudnyk et al., 2024](https://doi.org/10.1126/science.adj0116) |
160
+ | `sei` | `modelpolis fetch sei` | [Academic and research use only (code)](https://github.com/FunctionLab/sei-framework/blob/1e16bff9b1618af7065a23f82c4a3bb82aaeb689/LICENSE.txt), [CC-BY-4.0 (weights)](https://creativecommons.org/licenses/by/4.0/legalcode) | Academic and research use only. | [Chen et al., 2022](https://doi.org/10.1038/s41588-022-01102-2) |
161
+
162
+ Pulling or loading an image means accepting its licence. Sei, Puffin and Orca are
163
+ for academic research only; Puffin and Orca also prohibit use or redistribution
164
+ by a for-profit entity. Malinois includes AGPL-3.0 boda2 code: its source is in
165
+ the image at `/opt/boda2` and at the [pinned upstream revision](https://github.com/sjgosai/boda2/blob/d74deca7a754f98f5dfefc1fd3f4506fed764947/README.md).
166
+ Please cite the model's paper when using its predictions.
167
+
168
+ AlphaGenome, PARM and motif ensemble score are not distributed. To build locally:
169
+
170
+ - **AlphaGenome:** obtain the weights under their own terms, then run
171
+ `modelpolis build alphagenome --weights <path>`; the [build inputs](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/alphagenome/WEIGHTS.md)
172
+ also require the pinned XLA cache at the data root.
173
+ - **PARM:** accept the linked Oncode evaluation agreement and run
174
+ `modelpolis build parm`, which obtains the pinned code and five K562 weight files.
175
+ - **Motif ensemble score:** obtain permission to use the supplied method and
176
+ fitted files, follow the [input instructions](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/motif_ensemble_score/WEIGHTS.md),
177
+ then run `modelpolis build motif_ensemble_score --weights <fitted-directory>`.
178
+ Its [MEME tools](https://meme-suite.org/meme/doc/copyright.html) have separate
179
+ educational, research and non-profit terms.
180
+
181
+ **Attribution accompanying the images.** These notices supplement those inside
182
+ the images, as agreed in the [approved licence note](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/docs/decisions/2026-11-28-model-licences.md#maintainers-decisions).
183
+ The following five weight sets are under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/legalcode):
184
+
185
+ - **Enformer:** Avsec et al./DeepMind; converted to PyTorch by EleutherAI, used
186
+ with Phil Wang's enformer-pytorch port. The [pinned weight files](https://huggingface.co/EleutherAI/enformer-official-rough/blob/affe5713ae9017460706a44108289b13c5fee16c/README.md)
187
+ are unmodified from that conversion.
188
+ - **Borzoi:** Linder et al./Calico; PyTorch conversion and port by `johahi`.
189
+ The four pinned replicates ([0](https://huggingface.co/johahi/borzoi-replicate-0/blob/521db103372769581b8d1d616e6a3b496da490c5/README.md),
190
+ [1](https://huggingface.co/johahi/borzoi-replicate-1/blob/ad05f7a1c7d5b033149e4bd68620c4b54c557b2d/README.md),
191
+ [2](https://huggingface.co/johahi/borzoi-replicate-2/blob/871a31b59e976b17a11d1f221b0907b0c593a57a/README.md),
192
+ [3](https://huggingface.co/johahi/borzoi-replicate-3/blob/da3b900237f3914cf36859ff455cd63f5a7ecc9c/README.md))
193
+ are unmodified from those conversions; predictions are averaged across replicates.
194
+ - **Sei:** Kathleen Chen and the Sei authors; [Zenodo record 4906997](https://zenodo.org/records/4906997).
195
+ `sei.pth` and `projvec_targets.npy` are extracted unchanged from `sei_model.tar.gz`.
196
+ - **Puffin-D:** Kseniia Dudnyk, Chenlai Shi and Jian Zhou; [Zenodo record 7941729](https://zenodo.org/records/7941729).
197
+ `puffin_D.pth` is unmodified.
198
+ - **Orca:** Jian Zhou; [Zenodo record 6234936](https://zenodo.org/records/6234936).
199
+ Only the 16 H1-ESC/HFF state dictionaries and two distance-background arrays
200
+ are extracted from `resources_core.tar.gz`, all unmodified; the genome and
201
+ other resources are omitted.
202
+
203
+ Enformer's human/mouse track lists are unchanged from [Calico's Basenji source](https://github.com/calico/basenji/tree/24403ec79bc71c803c258efce9e98ddc2ca9a48d/manuscripts/cross2020)
204
+ ([Apache-2.0](https://github.com/calico/basenji/blob/24403ec79bc71c803c258efce9e98ddc2ca9a48d/LICENSE));
205
+ Borzoi's human track list is unchanged from [Calico's Borzoi source](https://github.com/calico/borzoi/blob/f10f8c799639dd2cfc0c1eb09499bfc47ab9cf8a/examples/targets_human.txt)
206
+ ([Apache-2.0](https://github.com/calico/borzoi/blob/f10f8c799639dd2cfc0c1eb09499bfc47ab9cf8a/LICENSE)).
207
+ ChromBPNet's K562 fold-0 weights are from the Kundaje lab and ENCODE:
208
+ [ENCFF984RAF](https://www.encodeproject.org/files/ENCFF984RAF/),
209
+ annotation ENCSR467RSV, experiment ENCSR868FGK.
210
+
211
+ The eight PyTorch model images use the public PyTorch base with NVIDIA runtime
212
+ libraries under NVIDIA's [CUDA](https://docs.nvidia.com/cuda/archive/12.8.0/eula/index.html)
213
+ and [cuDNN](https://docs.nvidia.com/deeplearning/cudnn/backend/v9.10.2/reference/eula.html)
214
+ terms; AlphaGenome uses NVIDIA's CUDA base and motif ensemble score uses Python's base.
215
+ All images contain open-source packages under their own licences, whose texts
216
+ are inside each image. Modelpolis itself is under the [MIT licence](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/LICENSE).
217
+
218
+ ## More
219
+
220
+ - [API guide](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/docs/api.md)
221
+ - [Adding a model](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/docs/adding-a-model.md)
222
+ - [Development setup and data root](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/docs/setup.md)
223
+ - [Examples](https://github.com/tanjiminlab/modelpolis-sequence/tree/main/examples/): synthetic input, FASTA regions and variant effects
@@ -0,0 +1,206 @@
1
+ # modelpolis-sequence
2
+
3
+ One Python API for sequence-to-function prediction. Each model runs in its own
4
+ Apptainer image, with its framework and weights inside.
5
+
6
+ ## Prerequisites
7
+
8
+ Run these checks in Bash before installing. The quickstart uses NVIDIA GPU 0.
9
+
10
+ | Need | One-line check |
11
+ | --- | --- |
12
+ | Linux on x86-64 | `uname -sm` |
13
+ | NVIDIA GPU and a driver compatible with CUDA 12.8 (tested driver: 580.178.04) | `nvidia-smi` |
14
+ | Apptainer on PATH; user namespaces enabled (tested: 1.4.5). Building an image yourself also needs builds without root using `--fakeroot` | `apptainer version && unshare -Ur true` |
15
+ | conda, initialized for this shell | `conda --version` |
16
+ | Git and curl | `git --version && curl --version` |
17
+ | HTTPS access to GitHub, conda-forge, PyPI, Docker Hub and Google Cloud Storage | `curl -I https://github.com https://conda.anaconda.org/conda-forge/ https://pypi.org https://registry-1.docker.io/v2/ https://storage.googleapis.com` |
18
+ | Budget 10 GiB free for the environment and the first image (40 GiB to build an image yourself); check each filesystem if separate | `df -h . "$HOME" /tmp` |
19
+
20
+ The registry probe normally returns HTTP 401 and the storage root HTTP 400;
21
+ both confirm connectivity.
22
+ `unshare` checks user namespaces. No host PyTorch, JAX or CUDA toolkit is needed.
23
+
24
+ ## Install
25
+
26
+ ```bash
27
+ git clone https://github.com/tanjiminlab/modelpolis-sequence
28
+ cd modelpolis-sequence
29
+ conda env create -f environment.yml
30
+ conda activate modelpolis-sequence
31
+ pip install -e .
32
+ ```
33
+
34
+ ## First prediction
35
+
36
+ Malinois predicts MPRA activity in K562, HepG2 and SK-N-SH as log2 RNA/DNA fold
37
+ change from an oligo of 1–200 bases.
38
+
39
+ Fetch its image from the registry, then predict. Run from the checkout with the
40
+ conda environment active:
41
+
42
+ ```bash
43
+ modelpolis fetch malinois
44
+ python examples/quickstart.py
45
+ ```
46
+
47
+ `fetch` downloads one 4.8 GB file from Docker Hub with Apptainer and checks its
48
+ sha256 against [catalog.toml](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/catalog.toml). On stderr, before a pull it prints
49
+ `Pulling <name> <version> from <reference>`; after a catalogue pull it prints
50
+ the image's licence (see [Licences and downloading](#licences-and-downloading)),
51
+ or after a pull by rule, `Licence and citation: https://hub.docker.com/r/tanlab/modelpolis-<name>`.
52
+ No pull means neither line. No registry login, data root or input file is needed.
53
+ `mp.load("malinois")` fetches a missing image itself; `fetch` does it ahead of time.
54
+ Every `load` prints `Loading <name> <version> from <sif> on <device>` on stderr
55
+ before starting the worker, using the name and version from the image's spec.
56
+
57
+ The example generates one seeded random 200-base DNA sequence and prints on stdout:
58
+
59
+ ```text
60
+ activity (1, 3)
61
+ K562: -0.088692
62
+ HepG2: -0.056804
63
+ SK-N-SH: 0.084662
64
+ ```
65
+
66
+ The shape is exact; the three prediction values can differ slightly between GPUs
67
+ and runs.
68
+
69
+ The commands leave the conda environment and editable checkout installed and the
70
+ image under `~/.cache/modelpolis/images/malinois/`. Set `MODELPOLIS_HOME` before
71
+ fetching to put the store elsewhere. The example prints predictions without
72
+ saving an output file.
73
+
74
+ ### Building an image yourself
75
+
76
+ Every model can also be built from its directory, and AlphaGenome, PARM and
77
+ motif ensemble score must be:
78
+
79
+ ```bash
80
+ modelpolis build malinois
81
+ modelpolis verify malinois
82
+ modelpolis publish malinois
83
+ ```
84
+
85
+ `publish` places the verified SIF in the local store, where `mp.load` finds it,
86
+ and rewrites the model's entry in the checkout's `catalog.toml` with your SIF's
87
+ checksum, marked `local`; rebuilds have different checksums. Nothing is pushed.
88
+ A Malinois build took about 5 minutes on both an RTX PRO 6000 and an RTX 5090
89
+ with the PyTorch base image cached. With `precision = "auto"`, the build tries
90
+ `bf16-mixed` first; if its reference check fails, it discards that image and
91
+ builds `fp32`, so two build logs and `FAIL` lines for the trial can be expected.
92
+ See [Adding a model](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/docs/adding-a-model.md).
93
+
94
+ **Note:** Enformer, Borzoi and AlphaGenome pass `verify` only on the GPU model
95
+ that made their references (RTX PRO 6000 Blackwell) and fail P1 on an RTX 5090.
96
+ The other six GPU models verify on both; other GPU hardware is untested.
97
+ See [ROADMAP, M6.T6](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/plan/ROADMAP.md#m6t6-have-someone-else-follow-the-readme-on-another-machine)
98
+ for the numbers. A fetched image is not verified on your GPU.
99
+
100
+ ## Models
101
+
102
+ One row per entry in [catalog.toml](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/catalog.toml). Versions identify these images,
103
+ not upstream releases. Inputs are uppercase DNA (`ACGTN`), lengths are in bases,
104
+ and output shapes are for full-length inputs, without the leading batch axis.
105
+ CUDA means an NVIDIA GPU; the listed CPU alternatives may be slower. Model links
106
+ include reference and publication checks.
107
+
108
+ | Model | Version | Input length | Outputs per sequence | Device | Paper or source |
109
+ | --- | --- | --- | --- | --- | --- |
110
+ | [AlphaGenome](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/alphagenome/reference/publication_check.md) (`alphagenome`) | 2.0.0 | 2,048 (default) or 16,384 | Human CAGE, RNA-seq, DNase, ATAC: length × 546, 667, 305, 167 tracks respectively | CUDA | [Avsec et al., 2026](https://doi.org/10.1038/s41586-025-10014-0) |
111
+ | [Borzoi](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/borzoi/reference/publication_check.md) (`borzoi`) | 2.0.0 | 524,288 | `human`: 6,144 bins × 7,611 tracks, 32 bp/bin; four-replicate mean | CUDA | [Linder et al., 2025](https://doi.org/10.1038/s41588-024-02053-6) |
112
+ | [ChromBPNet](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/chrombpnet/reference/publication_check.md) (`chrombpnet`) | 1.0.0 | 2,114 | K562 ATAC-seq `profile`: 1,000 probabilities; `log_count`: 1 value (fold 0, bias-corrected) | CUDA, CPU | [ENCODE model ENCFF984RAF](https://www.encodeproject.org/files/ENCFF984RAF/) |
113
+ | [Enformer](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/enformer/reference/publication_check.md) (`enformer`) | 2.0.0 | 196,608 | `human`: 896 × 5,313; `mouse`: 896 × 1,643 (bins × tracks, 128 bp/bin) | CUDA, CPU | [Avsec et al., 2021](https://doi.org/10.1038/s41592-021-01252-x) |
114
+ | [Malinois](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/malinois/reference/publication_check.md) (`malinois`) | 1.1.0 | 1–200 | `activity`: 3 MPRA values (K562, HepG2, SK-N-SH), log2 RNA/DNA fold change | CUDA, CPU | [Gosai et al., 2024](https://doi.org/10.1038/s41586-024-08070-z) |
115
+ | [Motif ensemble score](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/motif_ensemble_score/reference/publication_check.md) (`motif_ensemble_score`) | 1.0.0 | ≤256; ≥50 non-N bases | `score`, `score_dedup`, `score_panel`: 1 K562 value each | CPU | [Supplied scoring script; unpublished](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/motif_ensemble_score/source_checksums.json) |
116
+ | [Orca](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/orca/reference/publication_check.md) (`orca`) | 1.0.0 | 32,000,000 | `h1esc`, `hff`: 6 scales × 250 × 250 contact-map bins (32 Mb down to 1 Mb), log fold over the distance background | CUDA | [Zhou, 2022](https://doi.org/10.1038/s41588-022-01065-4) |
117
+ | [PARM](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/parm/reference/publication_check.md) (`parm`) | 1.0.0 | 1–600 | `activity`: 1 K562 promoter value, log2 RPM; five-fold mean | CUDA, CPU | [Barbadilla-Martínez et al., 2026](https://doi.org/10.1038/s41586-025-10093-z) |
118
+ | [Puffin-D](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/puffin/reference/publication_check.md) (`puffin`) | 1.0.0 | 100,000 | `initiation`: 100,000 bases × 10 strand-specific tracks, log10(signal + 1) | CUDA, CPU | [Dudnyk et al., 2024](https://doi.org/10.1126/science.adj0116) |
119
+ | [Sei](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/sei/reference/publication_check.md) (`sei`) | 1.0.0 | 4,096 | `chromatin`: 21,907 probabilities; `sequence_class`: 40 scores | CUDA, CPU | [Chen et al., 2022](https://doi.org/10.1038/s41588-022-01102-2) |
120
+
121
+ See [Licences and downloading](#licences-and-downloading) for image availability,
122
+ terms and local build inputs. Padding, cropping and options are described in the
123
+ model spec and the [API guide](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/docs/api.md).
124
+
125
+ ## Licences and downloading
126
+
127
+ Seven images are published at Docker Hub under `tanlab`, as
128
+ `tanlab/modelpolis-<name>`. `modelpolis fetch <name>` or `mp.load("<name>")`
129
+ pulls one under the terms below and checks its sha256 against
130
+ [catalog.toml](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/catalog.toml). The other three are not distributed.
131
+
132
+ | Model | How to get it | Code and weight licences | Restrictions | Citation |
133
+ | --- | --- | --- | --- | --- |
134
+ | `alphagenome` | Not distributed: protected weights; project policy | [Apache-2.0 (code)](https://github.com/google-deepmind/alphagenome_research/blob/936f89ba48f5c0f1b1450ac93815d28840cea928/LICENSE), [AlphaGenome model terms (weights)](https://storage.googleapis.com/alphagenome/terms/AlphaGenome-Model-Terms-of-Use.pdf) | Non-commercial organizations and purposes only; no clinical use or circumvention of access restrictions; comply with model/output terms and supply the terms, modification notices and Notice file when distributing. | [Avsec et al., 2026](https://doi.org/10.1038/s41586-025-10014-0) |
135
+ | `borzoi` | `modelpolis fetch borzoi` | [Apache-2.0 (code: borzoi-pytorch)](https://files.pythonhosted.org/packages/16/e5/9b0458b7e5b2c341b626aa2ed885074a64abfd2e8122591bf015469baef1/borzoi-pytorch-0.4.4.tar.gz), [CC-BY-4.0 (weights)](https://creativecommons.org/licenses/by/4.0/legalcode) | Attribution only | [Linder et al., 2025](https://doi.org/10.1038/s41588-024-02053-6) |
136
+ | `chrombpnet` | `modelpolis fetch chrombpnet` | [MIT (code)](https://github.com/kundajelab/chrombpnet/blob/09938fdb4397ec0006510e5251e48920a505d4de/LICENSE), [ENCODE data-use policy (weights: ENCFF984RAF)](https://www.encodeproject.org/about/data-use-policy/) | Attribution only | [Pampari et al., 2024 (preprint)](https://doi.org/10.1101/2024.12.25.630221) |
137
+ | `enformer` | `modelpolis fetch enformer` | [MIT (code: enformer-pytorch)](https://files.pythonhosted.org/packages/7a/73/81c9a4d7590c0e14d4c18d293257dc5a267bf59bd875d04967e37e5861f9/enformer_pytorch-0.8.10.tar.gz), [CC-BY-4.0 (weights)](https://creativecommons.org/licenses/by/4.0/legalcode) | Attribution only | [Avsec et al., 2021](https://doi.org/10.1038/s41592-021-01252-x) |
138
+ | `malinois` | `modelpolis fetch malinois` | [MIT (model code and weights)](https://github.com/sjgosai/boda2/blob/d74deca7a754f98f5dfefc1fd3f4506fed764947/LICENSE.mit), [AGPL-3.0 (other boda2 code)](https://github.com/sjgosai/boda2/blob/d74deca7a754f98f5dfefc1fd3f4506fed764947/LICENSE) | AGPL-3.0 code: retain notices and provide corresponding source; modified covered code must follow AGPL-3.0, including its network-source requirement. | [Gosai et al., 2024](https://doi.org/10.1038/s41586-024-08070-z) |
139
+ | `motif_ensemble_score` | Not distributed: unpublished method; no redistribution grant | [No licence specified (supplied code and fitted weights)](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/docs/decisions/2026-11-28-model-licences.md#motif_ensemble_score) | No licence grants permission to redistribute the supplied code or fitted weights. | Supplied score, unpublished, 2026; scanner: [Grant, Bailey and Noble, 2011 (FIMO)](https://doi.org/10.1093/bioinformatics/btr064) |
140
+ | `orca` | `modelpolis fetch orca` | [Academic research use only (code)](https://github.com/jzhoulab/orca/blob/42aea5eed4214641d717b02351389d631f01c1d8/LICENSE), [CC-BY-4.0 (weights)](https://creativecommons.org/licenses/by/4.0/legalcode) | Academic research use only; no commercial use; no use or redistribution by a for-profit entity. | [Zhou, 2022](https://doi.org/10.1038/s41588-022-01065-4) |
141
+ | `parm` | Not distributed: evaluation agreement restricts redistribution | [Oncode evaluation licence (code), no separate licence specified (weights)](https://github.com/vansteensellab/PARM/blob/260a27082942060364c1c4e2393018a0fa128844/LICENSE) | Accept the Oncode evaluation agreement; academic research purposes only; non-transferable and non-sublicensable; distribution, publication and services for consideration are restricted. | [Barbadilla-Martínez et al., 2026](https://doi.org/10.1038/s41586-025-10093-z) |
142
+ | `puffin` | `modelpolis fetch puffin` | [Academic research use only (code)](https://github.com/jzhoulab/puffin/blob/9bc81eb922f44556879d1d2afd4c757a1d6c291e/LICENSE), [CC-BY-4.0 (weights)](https://creativecommons.org/licenses/by/4.0/legalcode) | Academic research use only; no commercial use; no use or redistribution by a for-profit entity. | [Dudnyk et al., 2024](https://doi.org/10.1126/science.adj0116) |
143
+ | `sei` | `modelpolis fetch sei` | [Academic and research use only (code)](https://github.com/FunctionLab/sei-framework/blob/1e16bff9b1618af7065a23f82c4a3bb82aaeb689/LICENSE.txt), [CC-BY-4.0 (weights)](https://creativecommons.org/licenses/by/4.0/legalcode) | Academic and research use only. | [Chen et al., 2022](https://doi.org/10.1038/s41588-022-01102-2) |
144
+
145
+ Pulling or loading an image means accepting its licence. Sei, Puffin and Orca are
146
+ for academic research only; Puffin and Orca also prohibit use or redistribution
147
+ by a for-profit entity. Malinois includes AGPL-3.0 boda2 code: its source is in
148
+ the image at `/opt/boda2` and at the [pinned upstream revision](https://github.com/sjgosai/boda2/blob/d74deca7a754f98f5dfefc1fd3f4506fed764947/README.md).
149
+ Please cite the model's paper when using its predictions.
150
+
151
+ AlphaGenome, PARM and motif ensemble score are not distributed. To build locally:
152
+
153
+ - **AlphaGenome:** obtain the weights under their own terms, then run
154
+ `modelpolis build alphagenome --weights <path>`; the [build inputs](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/alphagenome/WEIGHTS.md)
155
+ also require the pinned XLA cache at the data root.
156
+ - **PARM:** accept the linked Oncode evaluation agreement and run
157
+ `modelpolis build parm`, which obtains the pinned code and five K562 weight files.
158
+ - **Motif ensemble score:** obtain permission to use the supplied method and
159
+ fitted files, follow the [input instructions](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/models/motif_ensemble_score/WEIGHTS.md),
160
+ then run `modelpolis build motif_ensemble_score --weights <fitted-directory>`.
161
+ Its [MEME tools](https://meme-suite.org/meme/doc/copyright.html) have separate
162
+ educational, research and non-profit terms.
163
+
164
+ **Attribution accompanying the images.** These notices supplement those inside
165
+ the images, as agreed in the [approved licence note](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/docs/decisions/2026-11-28-model-licences.md#maintainers-decisions).
166
+ The following five weight sets are under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/legalcode):
167
+
168
+ - **Enformer:** Avsec et al./DeepMind; converted to PyTorch by EleutherAI, used
169
+ with Phil Wang's enformer-pytorch port. The [pinned weight files](https://huggingface.co/EleutherAI/enformer-official-rough/blob/affe5713ae9017460706a44108289b13c5fee16c/README.md)
170
+ are unmodified from that conversion.
171
+ - **Borzoi:** Linder et al./Calico; PyTorch conversion and port by `johahi`.
172
+ The four pinned replicates ([0](https://huggingface.co/johahi/borzoi-replicate-0/blob/521db103372769581b8d1d616e6a3b496da490c5/README.md),
173
+ [1](https://huggingface.co/johahi/borzoi-replicate-1/blob/ad05f7a1c7d5b033149e4bd68620c4b54c557b2d/README.md),
174
+ [2](https://huggingface.co/johahi/borzoi-replicate-2/blob/871a31b59e976b17a11d1f221b0907b0c593a57a/README.md),
175
+ [3](https://huggingface.co/johahi/borzoi-replicate-3/blob/da3b900237f3914cf36859ff455cd63f5a7ecc9c/README.md))
176
+ are unmodified from those conversions; predictions are averaged across replicates.
177
+ - **Sei:** Kathleen Chen and the Sei authors; [Zenodo record 4906997](https://zenodo.org/records/4906997).
178
+ `sei.pth` and `projvec_targets.npy` are extracted unchanged from `sei_model.tar.gz`.
179
+ - **Puffin-D:** Kseniia Dudnyk, Chenlai Shi and Jian Zhou; [Zenodo record 7941729](https://zenodo.org/records/7941729).
180
+ `puffin_D.pth` is unmodified.
181
+ - **Orca:** Jian Zhou; [Zenodo record 6234936](https://zenodo.org/records/6234936).
182
+ Only the 16 H1-ESC/HFF state dictionaries and two distance-background arrays
183
+ are extracted from `resources_core.tar.gz`, all unmodified; the genome and
184
+ other resources are omitted.
185
+
186
+ Enformer's human/mouse track lists are unchanged from [Calico's Basenji source](https://github.com/calico/basenji/tree/24403ec79bc71c803c258efce9e98ddc2ca9a48d/manuscripts/cross2020)
187
+ ([Apache-2.0](https://github.com/calico/basenji/blob/24403ec79bc71c803c258efce9e98ddc2ca9a48d/LICENSE));
188
+ Borzoi's human track list is unchanged from [Calico's Borzoi source](https://github.com/calico/borzoi/blob/f10f8c799639dd2cfc0c1eb09499bfc47ab9cf8a/examples/targets_human.txt)
189
+ ([Apache-2.0](https://github.com/calico/borzoi/blob/f10f8c799639dd2cfc0c1eb09499bfc47ab9cf8a/LICENSE)).
190
+ ChromBPNet's K562 fold-0 weights are from the Kundaje lab and ENCODE:
191
+ [ENCFF984RAF](https://www.encodeproject.org/files/ENCFF984RAF/),
192
+ annotation ENCSR467RSV, experiment ENCSR868FGK.
193
+
194
+ The eight PyTorch model images use the public PyTorch base with NVIDIA runtime
195
+ libraries under NVIDIA's [CUDA](https://docs.nvidia.com/cuda/archive/12.8.0/eula/index.html)
196
+ and [cuDNN](https://docs.nvidia.com/deeplearning/cudnn/backend/v9.10.2/reference/eula.html)
197
+ terms; AlphaGenome uses NVIDIA's CUDA base and motif ensemble score uses Python's base.
198
+ All images contain open-source packages under their own licences, whose texts
199
+ are inside each image. Modelpolis itself is under the [MIT licence](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/LICENSE).
200
+
201
+ ## More
202
+
203
+ - [API guide](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/docs/api.md)
204
+ - [Adding a model](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/docs/adding-a-model.md)
205
+ - [Development setup and data root](https://github.com/tanjiminlab/modelpolis-sequence/blob/main/docs/setup.md)
206
+ - [Examples](https://github.com/tanjiminlab/modelpolis-sequence/tree/main/examples/): synthetic input, FASTA regions and variant effects
@@ -0,0 +1,38 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.3"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "modelpolis"
7
+ version = "0.1.0"
8
+ description = "Run sequence-to-function models through one model-agnostic API, each in its own Apptainer image."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ authors = [{ name = "Tan Lab" }]
13
+ requires-python = ">=3.11"
14
+ dependencies = ["numpy>=1.26"]
15
+
16
+ [project.urls]
17
+ Repository = "https://github.com/tanjiminlab/modelpolis-sequence"
18
+ Issues = "https://github.com/tanjiminlab/modelpolis-sequence/issues"
19
+
20
+ [project.scripts]
21
+ modelpolis = "modelpolis.cli:main"
22
+
23
+ [project.optional-dependencies]
24
+ dev = ["pytest", "ruff"]
25
+
26
+ [tool.setuptools.packages.find]
27
+ where = ["src"]
28
+
29
+ [tool.setuptools.package-data]
30
+ "modelpolis.builder" = ["image.def.tmpl"]
31
+
32
+ [tool.pytest.ini_options]
33
+ testpaths = ["tests"]
34
+ markers = ["gpu: needs a GPU"]
35
+
36
+ [tool.ruff]
37
+ target-version = "py311"
38
+ line-length = 100
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,31 @@
1
+ """modelpolis: one model-agnostic API for sequence-to-function models."""
2
+
3
+ from importlib.metadata import version
4
+
5
+ __version__ = version("modelpolis")
6
+
7
+
8
+ # The runner is imported on first use, so that ``import modelpolis.runner.api`` inside an image
9
+ # does not pull in the launcher.
10
+ def fetch(name, catalog=None):
11
+ """Return the catalogued SIF path, pulling and checking it if it is missing."""
12
+ from .runner.store import fetch
13
+
14
+ return fetch(name, catalog)
15
+
16
+
17
+ def load(name_or_path, device=None, sha256=None):
18
+ """Start a model by name or SIF path and return a ``Model``.
19
+
20
+ ``device=None`` means ``cuda:0`` if the spec's first device is ``cuda``, else ``cpu``.
21
+ """
22
+ from .runner.model import load
23
+
24
+ return load(name_or_path, device, sha256)
25
+
26
+
27
+ def describe(name_or_path):
28
+ """Return a model's ``Spec`` without loading it."""
29
+ from .runner.model import describe
30
+
31
+ return describe(name_or_path)
@@ -0,0 +1 @@
1
+ """Build machine only: turns a model directory into a verified SIF."""
@@ -0,0 +1,25 @@
1
+ Bootstrap: docker
2
+ From: {{base}}
3
+
4
+ # The one definition template for every model (plan/DESIGN.md section 6), filled by
5
+ # builder/image.py. {{stage}} holds the model directory (model/), the spec JSON (spec.json),
6
+ # requirements.lock and a wheel of modelpolis built at the current commit (build/).
7
+ # The weights line becomes one "<verified file> <dest>/<path>" line per weight file of [weights]
8
+ # (builder/weights.py), or nothing for source = "none".
9
+
10
+ %files
11
+ {{stage}} /opt/modelpolis
12
+ {{weights}}
13
+
14
+ %post
15
+ set -eu
16
+ export PIP_NO_CACHE_DIR=1 PIP_DISABLE_PIP_VERSION_CHECK=1
17
+ # The model's own post.sh, if any, runs first (section 6), e.g. to add Python to a CUDA base.
18
+ if [ -f /opt/modelpolis/model/post.sh ]; then sh -eu /opt/modelpolis/model/post.sh; fi
19
+ PY=$(command -v python{{python}})
20
+ # The lock first, then modelpolis without its dependencies, so the lock pins win.
21
+ "$PY" -m pip install --no-cache-dir -r /opt/modelpolis/build/requirements.lock
22
+ "$PY" -m pip install --no-cache-dir --no-deps /opt/modelpolis/build/*.whl
23
+ rm -rf /opt/modelpolis/build /root/.cache/pip
24
+ printf '#!/bin/sh\nexec %s -m modelpolis.worker.main "$@"\n' "$PY" > /opt/modelpolis/worker
25
+ chmod 755 /opt/modelpolis/worker