spikeforge-hub 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.
- spikeforge_hub-0.1.0/LICENSE +30 -0
- spikeforge_hub-0.1.0/PKG-INFO +126 -0
- spikeforge_hub-0.1.0/README.md +94 -0
- spikeforge_hub-0.1.0/pyproject.toml +96 -0
- spikeforge_hub-0.1.0/setup.cfg +4 -0
- spikeforge_hub-0.1.0/spikeforge_hub/CURATION.md +77 -0
- spikeforge_hub-0.1.0/spikeforge_hub/__init__.py +132 -0
- spikeforge_hub-0.1.0/spikeforge_hub/artifact_readers.py +155 -0
- spikeforge_hub-0.1.0/spikeforge_hub/artifact_report.py +78 -0
- spikeforge_hub-0.1.0/spikeforge_hub/cache.py +56 -0
- spikeforge_hub-0.1.0/spikeforge_hub/catalog.py +183 -0
- spikeforge_hub-0.1.0/spikeforge_hub/cli.py +160 -0
- spikeforge_hub-0.1.0/spikeforge_hub/compat.py +189 -0
- spikeforge_hub-0.1.0/spikeforge_hub/download_cli.py +111 -0
- spikeforge_hub-0.1.0/spikeforge_hub/downloads.py +142 -0
- spikeforge_hub-0.1.0/spikeforge_hub/entry.py +190 -0
- spikeforge_hub-0.1.0/spikeforge_hub/errors.py +97 -0
- spikeforge_hub-0.1.0/spikeforge_hub/expected.py +47 -0
- spikeforge_hub-0.1.0/spikeforge_hub/hf_api.py +27 -0
- spikeforge_hub-0.1.0/spikeforge_hub/import_model.py +243 -0
- spikeforge_hub-0.1.0/spikeforge_hub/inspect.py +93 -0
- spikeforge_hub-0.1.0/spikeforge_hub/mismatches.py +113 -0
- spikeforge_hub-0.1.0/spikeforge_hub/models.json +115 -0
- spikeforge_hub-0.1.0/spikeforge_hub/probe.py +53 -0
- spikeforge_hub-0.1.0/spikeforge_hub/registry.py +663 -0
- spikeforge_hub-0.1.0/spikeforge_hub/registry_cli.py +189 -0
- spikeforge_hub-0.1.0/spikeforge_hub/registry_errors.py +140 -0
- spikeforge_hub-0.1.0/spikeforge_hub/verify.py +109 -0
- spikeforge_hub-0.1.0/spikeforge_hub/weight_map.py +139 -0
- spikeforge_hub-0.1.0/spikeforge_hub.egg-info/PKG-INFO +126 -0
- spikeforge_hub-0.1.0/spikeforge_hub.egg-info/SOURCES.txt +34 -0
- spikeforge_hub-0.1.0/spikeforge_hub.egg-info/dependency_links.txt +1 -0
- spikeforge_hub-0.1.0/spikeforge_hub.egg-info/entry_points.txt +3 -0
- spikeforge_hub-0.1.0/spikeforge_hub.egg-info/not-zip-safe +1 -0
- spikeforge_hub-0.1.0/spikeforge_hub.egg-info/requires.txt +8 -0
- spikeforge_hub-0.1.0/spikeforge_hub.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Capsize LLC
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
* Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
+
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spikeforge-hub
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Curated SNN model hub (catalog, cache, download, import) for spikeforge.
|
|
5
|
+
Author-email: Capsize LLC <contact@capsizegames.com>
|
|
6
|
+
Maintainer-email: Capsize LLC <contact@capsizegames.com>
|
|
7
|
+
License-Expression: BSD-3-Clause
|
|
8
|
+
Project-URL: Homepage, https://github.com/capsize-games/spikeforge
|
|
9
|
+
Project-URL: Repository, https://github.com/capsize-games/spikeforge
|
|
10
|
+
Keywords: spiking neural networks,model hub,huggingface,catalog
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: spikeforge~=0.3.0
|
|
25
|
+
Requires-Dist: torch>=2.5
|
|
26
|
+
Requires-Dist: huggingface_hub>=0.20
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# spikeforge
|
|
34
|
+
|
|
35
|
+
[](https://github.com/capsize-games/spikeforge/actions/workflows/ci.yml)
|
|
36
|
+
[](OPEN_SOURCE_CHECKLIST.md)
|
|
37
|
+
[](LICENSE)
|
|
38
|
+
[](https://www.python.org/downloads/)
|
|
39
|
+
[](https://github.com/astral-sh/ruff)
|
|
40
|
+
[](https://github.com/capsize-games/spikeforge/blob/main/CONTRIBUTING.md)
|
|
41
|
+
[](documentation/README.md)
|
|
42
|
+
|
|
43
|
+
A spiking-neural-network (SNN) toolkit built on
|
|
44
|
+
[snnTorch](https://snntorch.readthedocs.io/) and PyTorch. Loads MNIST-style
|
|
45
|
+
and neuromorphic event datasets, encodes them into rate, latency, delta, and
|
|
46
|
+
random spikes, and trains, validates, exports, and deploys LIF networks —
|
|
47
|
+
with a live browser dashboard served over WebSockets.
|
|
48
|
+
|
|
49
|
+
> **Pre-1.0 and unpublished.** `install.sh` is the supported path today;
|
|
50
|
+
> PyPI ships once the distributions are published. Before trusting any
|
|
51
|
+
> number this produces, read
|
|
52
|
+
> [Implications and boundaries](documentation/implications-and-boundaries.md).
|
|
53
|
+
|
|
54
|
+
## Quickstart
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
git clone https://github.com/capsize-games/spikeforge.git
|
|
58
|
+
cd spikeforge
|
|
59
|
+
docker compose up --build
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Open <http://localhost:8877> — the dashboard connects to the WebSocket on
|
|
63
|
+
the same host and port. No separate backend or proxy to run.
|
|
64
|
+
|
|
65
|
+
Prefer a local install, a headless example, or the CLI tools instead? See
|
|
66
|
+
[Usage](documentation/usage.md) and [Quickstart](documentation/quickstart.md)
|
|
67
|
+
for every path (`./install.sh`, local dev with Vite, `examples/`, and the
|
|
68
|
+
eight `spikeforge-*` console scripts).
|
|
69
|
+
|
|
70
|
+
## Features
|
|
71
|
+
|
|
72
|
+
- **Encoding** — rate, latency, delta, and random spike coders.
|
|
73
|
+
- **Training** — fully-connected and convolutional LIF networks with
|
|
74
|
+
surrogate-gradient cross-entropy, checkpointing, and opt-in AMP / gradient
|
|
75
|
+
checkpointing / truncated BPTT / multi-GPU.
|
|
76
|
+
- **Topologies** — `fc_legacy`, `fc_small`, `conv_net`, `recurrent_net`, plus
|
|
77
|
+
the sequence presets `sequence_mlp` and `sequence_attn`.
|
|
78
|
+
- **Datasets** — MNIST, Fashion-MNIST, KMNIST, QMNIST, USPS, EMNIST,
|
|
79
|
+
CIFAR-10, and (via the `events` extra) N-MNIST, DVS128 Gesture,
|
|
80
|
+
CIFAR10-DVS, and Spiking Speech Commands.
|
|
81
|
+
- **Interpreter spine** — NIR export, an independent NIR interpreter, and
|
|
82
|
+
numerical drift validation.
|
|
83
|
+
- **Introspection** — educational-mode `U[t]`/`I[t]`/`S[t]` traces,
|
|
84
|
+
trajectory metrics, and surrogate-derivative curves.
|
|
85
|
+
- **Deployment** — a capability matrix, weight quantization, energy
|
|
86
|
+
accounting, and executable `reference`, `norse`, and `lava_loihi2`
|
|
87
|
+
backends.
|
|
88
|
+
- **Model hub** — a curated, offline-first catalog plus optional live
|
|
89
|
+
Hugging Face search.
|
|
90
|
+
- **Dashboard** — a React + TypeScript UI with training, introspection,
|
|
91
|
+
analysis, targets, energy, and hub panels, and seven guided walkthroughs.
|
|
92
|
+
|
|
93
|
+
## Packages
|
|
94
|
+
|
|
95
|
+
This repository is a single workspace that publishes four distributions:
|
|
96
|
+
|
|
97
|
+
| Distribution | Import root | Purpose |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| `spikeforge` | `spikeforge` | Core package: encoders, topologies, training, simulator, NIR bridge, tracking |
|
|
100
|
+
| `spikeforge-targets` | `spikeforge_targets` | Deployment targets, quantization, energy accounting, sparse event runtime |
|
|
101
|
+
| `spikeforge-hub` | `spikeforge_hub` | Curated model hub and optional Hugging Face access |
|
|
102
|
+
| `spikeforge-server` | `server` | FastAPI + WebSocket server and dashboard hosting |
|
|
103
|
+
|
|
104
|
+
## Documentation
|
|
105
|
+
|
|
106
|
+
This README stays short on purpose.
|
|
107
|
+
[`documentation/`](documentation/README.md) is the full reference — install
|
|
108
|
+
paths, the CLI tools, architecture, module layout, and the dev workflow —
|
|
109
|
+
written for contributors and coding agents alike. Also see
|
|
110
|
+
[COOKBOOK.md](COOKBOOK.md) for copy-pasteable recipes,
|
|
111
|
+
[examples/](examples/) for runnable end-to-end scripts, and
|
|
112
|
+
[plans/](plans/) for design documents and the roadmap.
|
|
113
|
+
|
|
114
|
+
See [CONTRIBUTING.md](https://github.com/capsize-games/spikeforge/blob/main/CONTRIBUTING.md)
|
|
115
|
+
and [rules.md](rules.md) before opening a pull request.
|
|
116
|
+
|
|
117
|
+
## Citing
|
|
118
|
+
|
|
119
|
+
If spikeforge is useful in your research, please cite it — see
|
|
120
|
+
[CITATION.cff](CITATION.cff) (GitHub renders a "Cite this repository"
|
|
121
|
+
button from it automatically).
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
Released under the **BSD 3-Clause License** — see [LICENSE](LICENSE) and
|
|
126
|
+
[AUTHORS](AUTHORS).
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# spikeforge
|
|
2
|
+
|
|
3
|
+
[](https://github.com/capsize-games/spikeforge/actions/workflows/ci.yml)
|
|
4
|
+
[](OPEN_SOURCE_CHECKLIST.md)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://www.python.org/downloads/)
|
|
7
|
+
[](https://github.com/astral-sh/ruff)
|
|
8
|
+
[](https://github.com/capsize-games/spikeforge/blob/main/CONTRIBUTING.md)
|
|
9
|
+
[](documentation/README.md)
|
|
10
|
+
|
|
11
|
+
A spiking-neural-network (SNN) toolkit built on
|
|
12
|
+
[snnTorch](https://snntorch.readthedocs.io/) and PyTorch. Loads MNIST-style
|
|
13
|
+
and neuromorphic event datasets, encodes them into rate, latency, delta, and
|
|
14
|
+
random spikes, and trains, validates, exports, and deploys LIF networks —
|
|
15
|
+
with a live browser dashboard served over WebSockets.
|
|
16
|
+
|
|
17
|
+
> **Pre-1.0 and unpublished.** `install.sh` is the supported path today;
|
|
18
|
+
> PyPI ships once the distributions are published. Before trusting any
|
|
19
|
+
> number this produces, read
|
|
20
|
+
> [Implications and boundaries](documentation/implications-and-boundaries.md).
|
|
21
|
+
|
|
22
|
+
## Quickstart
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
git clone https://github.com/capsize-games/spikeforge.git
|
|
26
|
+
cd spikeforge
|
|
27
|
+
docker compose up --build
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Open <http://localhost:8877> — the dashboard connects to the WebSocket on
|
|
31
|
+
the same host and port. No separate backend or proxy to run.
|
|
32
|
+
|
|
33
|
+
Prefer a local install, a headless example, or the CLI tools instead? See
|
|
34
|
+
[Usage](documentation/usage.md) and [Quickstart](documentation/quickstart.md)
|
|
35
|
+
for every path (`./install.sh`, local dev with Vite, `examples/`, and the
|
|
36
|
+
eight `spikeforge-*` console scripts).
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- **Encoding** — rate, latency, delta, and random spike coders.
|
|
41
|
+
- **Training** — fully-connected and convolutional LIF networks with
|
|
42
|
+
surrogate-gradient cross-entropy, checkpointing, and opt-in AMP / gradient
|
|
43
|
+
checkpointing / truncated BPTT / multi-GPU.
|
|
44
|
+
- **Topologies** — `fc_legacy`, `fc_small`, `conv_net`, `recurrent_net`, plus
|
|
45
|
+
the sequence presets `sequence_mlp` and `sequence_attn`.
|
|
46
|
+
- **Datasets** — MNIST, Fashion-MNIST, KMNIST, QMNIST, USPS, EMNIST,
|
|
47
|
+
CIFAR-10, and (via the `events` extra) N-MNIST, DVS128 Gesture,
|
|
48
|
+
CIFAR10-DVS, and Spiking Speech Commands.
|
|
49
|
+
- **Interpreter spine** — NIR export, an independent NIR interpreter, and
|
|
50
|
+
numerical drift validation.
|
|
51
|
+
- **Introspection** — educational-mode `U[t]`/`I[t]`/`S[t]` traces,
|
|
52
|
+
trajectory metrics, and surrogate-derivative curves.
|
|
53
|
+
- **Deployment** — a capability matrix, weight quantization, energy
|
|
54
|
+
accounting, and executable `reference`, `norse`, and `lava_loihi2`
|
|
55
|
+
backends.
|
|
56
|
+
- **Model hub** — a curated, offline-first catalog plus optional live
|
|
57
|
+
Hugging Face search.
|
|
58
|
+
- **Dashboard** — a React + TypeScript UI with training, introspection,
|
|
59
|
+
analysis, targets, energy, and hub panels, and seven guided walkthroughs.
|
|
60
|
+
|
|
61
|
+
## Packages
|
|
62
|
+
|
|
63
|
+
This repository is a single workspace that publishes four distributions:
|
|
64
|
+
|
|
65
|
+
| Distribution | Import root | Purpose |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| `spikeforge` | `spikeforge` | Core package: encoders, topologies, training, simulator, NIR bridge, tracking |
|
|
68
|
+
| `spikeforge-targets` | `spikeforge_targets` | Deployment targets, quantization, energy accounting, sparse event runtime |
|
|
69
|
+
| `spikeforge-hub` | `spikeforge_hub` | Curated model hub and optional Hugging Face access |
|
|
70
|
+
| `spikeforge-server` | `server` | FastAPI + WebSocket server and dashboard hosting |
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
This README stays short on purpose.
|
|
75
|
+
[`documentation/`](documentation/README.md) is the full reference — install
|
|
76
|
+
paths, the CLI tools, architecture, module layout, and the dev workflow —
|
|
77
|
+
written for contributors and coding agents alike. Also see
|
|
78
|
+
[COOKBOOK.md](COOKBOOK.md) for copy-pasteable recipes,
|
|
79
|
+
[examples/](examples/) for runnable end-to-end scripts, and
|
|
80
|
+
[plans/](plans/) for design documents and the roadmap.
|
|
81
|
+
|
|
82
|
+
See [CONTRIBUTING.md](https://github.com/capsize-games/spikeforge/blob/main/CONTRIBUTING.md)
|
|
83
|
+
and [rules.md](rules.md) before opening a pull request.
|
|
84
|
+
|
|
85
|
+
## Citing
|
|
86
|
+
|
|
87
|
+
If spikeforge is useful in your research, please cite it — see
|
|
88
|
+
[CITATION.cff](CITATION.cff) (GitHub renders a "Cite this repository"
|
|
89
|
+
button from it automatically).
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
Released under the **BSD 3-Clause License** — see [LICENSE](LICENSE) and
|
|
94
|
+
[AUTHORS](AUTHORS).
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# PEP 621 packaging authority for the spikeforge-hub distribution (ARCH-0001 Phase 4).
|
|
2
|
+
#
|
|
3
|
+
# The distribution owns the ``spikeforge_hub`` import root, which absorbs the former
|
|
4
|
+
# ``spikeforge.hub`` subpackage (catalog, cache, live Hugging Face access,
|
|
5
|
+
# isolated download worker, and the inspect/compat/promote import funnel). It
|
|
6
|
+
# depends on core, but core never depends on it. The optional
|
|
7
|
+
# ``huggingface_hub`` dependency is a base dependency here, isolated in
|
|
8
|
+
# ``spikeforge_hub.probe`` so the offline catalog still works without network access.
|
|
9
|
+
#
|
|
10
|
+
# ``spikeforge_hub/`` stays at its repository-root path and is exposed to the build via
|
|
11
|
+
# the ``spikeforge_hub`` symlink next to this file (the same pattern the core, server,
|
|
12
|
+
# and targets distributions use; see the ``packages.find`` table below).
|
|
13
|
+
|
|
14
|
+
[build-system]
|
|
15
|
+
requires = ["setuptools>=68"]
|
|
16
|
+
build-backend = "setuptools.build_meta"
|
|
17
|
+
|
|
18
|
+
[project]
|
|
19
|
+
name = "spikeforge-hub"
|
|
20
|
+
version = "0.1.0"
|
|
21
|
+
description = "Curated SNN model hub (catalog, cache, download, import) for spikeforge."
|
|
22
|
+
# ``README.md`` and ``LICENSE`` are committed symlinks to the repository-root
|
|
23
|
+
# files, mirroring the core, server, and targets distributions' metadata.
|
|
24
|
+
readme = "README.md"
|
|
25
|
+
requires-python = ">=3.10"
|
|
26
|
+
license = "BSD-3-Clause"
|
|
27
|
+
license-files = ["LICENSE"]
|
|
28
|
+
authors = [
|
|
29
|
+
{ name = "Capsize LLC", email = "contact@capsizegames.com" },
|
|
30
|
+
]
|
|
31
|
+
maintainers = [
|
|
32
|
+
{ name = "Capsize LLC", email = "contact@capsizegames.com" },
|
|
33
|
+
]
|
|
34
|
+
keywords = [
|
|
35
|
+
"spiking neural networks",
|
|
36
|
+
"model hub",
|
|
37
|
+
"huggingface",
|
|
38
|
+
"catalog",
|
|
39
|
+
]
|
|
40
|
+
classifiers = [
|
|
41
|
+
"Development Status :: 4 - Beta",
|
|
42
|
+
"Intended Audience :: Developers",
|
|
43
|
+
"Intended Audience :: Science/Research",
|
|
44
|
+
"Operating System :: OS Independent",
|
|
45
|
+
"Programming Language :: Python :: 3",
|
|
46
|
+
"Programming Language :: Python :: 3.10",
|
|
47
|
+
"Programming Language :: Python :: 3.11",
|
|
48
|
+
"Programming Language :: Python :: 3.12",
|
|
49
|
+
"Programming Language :: Python :: 3.13",
|
|
50
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
51
|
+
]
|
|
52
|
+
dependencies = [
|
|
53
|
+
# The core library owns the interpreter/simulator, ``nir_bridge``, and the
|
|
54
|
+
# hub cache configuration; this distribution owns catalog/network I/O. The
|
|
55
|
+
# pin is a pre-1.0 compatible-release: >=0.3.0,<0.4.0.
|
|
56
|
+
"spikeforge~=0.3.0",
|
|
57
|
+
"torch>=2.5",
|
|
58
|
+
"huggingface_hub>=0.20",
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
[project.optional-dependencies]
|
|
62
|
+
dev = [
|
|
63
|
+
"pytest",
|
|
64
|
+
"pytest-cov",
|
|
65
|
+
"ruff",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
[project.scripts]
|
|
69
|
+
spikeforge-hub = "spikeforge_hub.cli:main"
|
|
70
|
+
# PT-W7 registry governance. The plan offers `spikeforge-registry` as a new
|
|
71
|
+
# distribution *or* an extension of the hub; this "extend hub" option owns the
|
|
72
|
+
# script here, so the promotion registry (stages/approver/signature/lineage)
|
|
73
|
+
# ships without a separate import root.
|
|
74
|
+
spikeforge-registry = "spikeforge_hub.registry_cli:main"
|
|
75
|
+
|
|
76
|
+
[project.urls]
|
|
77
|
+
Homepage = "https://github.com/capsize-games/spikeforge"
|
|
78
|
+
Repository = "https://github.com/capsize-games/spikeforge"
|
|
79
|
+
|
|
80
|
+
[tool.setuptools]
|
|
81
|
+
zip-safe = false
|
|
82
|
+
|
|
83
|
+
[tool.setuptools.packages.find]
|
|
84
|
+
# Mirror the core/server/targets distributions: the `spikeforge_hub` import root is
|
|
85
|
+
# exposed next to this file as a symlink to `../../spikeforge_hub` so the default
|
|
86
|
+
# via-sdist `python -m build` produces a complete wheel. Discovery depends only
|
|
87
|
+
# on this top-level package, never on core.
|
|
88
|
+
where = ["."]
|
|
89
|
+
include = ["spikeforge_hub*"]
|
|
90
|
+
exclude = ["spikeforge", "server*", "spikeforge_targets*", "tests*"]
|
|
91
|
+
|
|
92
|
+
[tool.setuptools.package-data]
|
|
93
|
+
# The catalog and its curation policy are runtime data, not code: without
|
|
94
|
+
# these lines a `pip install spikeforge-hub` wheel would ship `spikeforge_hub/` with no
|
|
95
|
+
# `models.json`, so the offline catalog could not load.
|
|
96
|
+
spikeforge_hub = ["models.json", "CURATION.md"]
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Hub catalog curation policy
|
|
2
|
+
|
|
3
|
+
The shipped catalog [`models.json`](models.json) is a **curated allow-list**, not
|
|
4
|
+
a directory of everything that exists. Every entry must be something the project
|
|
5
|
+
can stand behind: a real source and a license that has actually been read. An
|
|
6
|
+
invented repository id or an unnamed license is a fabrication and must never be
|
|
7
|
+
committed here.
|
|
8
|
+
|
|
9
|
+
The record schema is enforced by
|
|
10
|
+
[`hub/entry.py`](entry.py:1) and validated on load by
|
|
11
|
+
[`hub/catalog.py`](catalog.py:1); anything that fails validation is reported
|
|
12
|
+
through `catalog.issues()` and dropped from `entries()` rather than silently
|
|
13
|
+
accepted.
|
|
14
|
+
|
|
15
|
+
## Adding a bundled entry
|
|
16
|
+
|
|
17
|
+
A bundled artifact is authored by this project (for example a NIR graph rendered
|
|
18
|
+
from a shipped topology preset). To add one:
|
|
19
|
+
|
|
20
|
+
1. Add an entry object to [`models.json`](models.json) with `"source":
|
|
21
|
+
"bundled"`.
|
|
22
|
+
2. Set the concrete SPDX id for **your** artifact (`"license":
|
|
23
|
+
"BSD-3-Clause"` for this project's own presets).
|
|
24
|
+
3. Set `"topology"` to the shipped preset the graph is rendered from, and
|
|
25
|
+
`"input_shape"` to its expected input.
|
|
26
|
+
4. Describe the provenance in `"notes"` so a reader can tell why it is bundled.
|
|
27
|
+
|
|
28
|
+
## Adding a remote entry
|
|
29
|
+
|
|
30
|
+
A remote entry (`"source": "url"` or `"source": "hf_repo"`) points at bytes
|
|
31
|
+
somewhere else. To add one **you must verify the source first**:
|
|
32
|
+
|
|
33
|
+
1. **Name a real repository or reference.** Use the exact, resolvable locator —
|
|
34
|
+
the full `url`, or the real `org/repo` id for `hf_repo`. Do not invent a
|
|
35
|
+
namespace or a "seed" repository id. If you cannot point at a real upstream,
|
|
36
|
+
there is no entry to add.
|
|
37
|
+
2. **State a verified license.** Read the upstream license and put its concrete
|
|
38
|
+
SPDX-style id in `"license"` (for example `"Apache-2.0"`,
|
|
39
|
+
`"BSD-3-Clause"`, `"MIT"`). A compound term such as `"MIT OR Apache-2.0"` is
|
|
40
|
+
accepted. Free-text escapes — `"see upstream"`, `"unknown"`, `"TBD"` — are
|
|
41
|
+
rejected by validation.
|
|
42
|
+
3. **Publish a checksum where one is available.** Prefer `"sha256"` (and
|
|
43
|
+
`"size_bytes"` when known) so a download can verify as `verified`. When the
|
|
44
|
+
source publishes no checksum, it is honest to omit it — the download then
|
|
45
|
+
reports as `unverified`, never as verified.
|
|
46
|
+
|
|
47
|
+
## Unverified candidates must not be presented as ready
|
|
48
|
+
|
|
49
|
+
If a candidate is known-but-not-yet-verified, it may be recorded **only** with
|
|
50
|
+
the explicit marker:
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
"license": "unverified-candidate"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
That marker disables the entry: [`catalog.availability()`](catalog.py:106)
|
|
57
|
+
reports it `available: false` with the named reason *"unverified candidate:
|
|
58
|
+
upstream repository and license are not confirmed …"*, and it must never be
|
|
59
|
+
described as ready to use. Candidates are a record of work to do, not a
|
|
60
|
+
recommendation. When the real source and license are confirmed, replace the
|
|
61
|
+
marker with the concrete SPDX id (and add a checksum where available); if the
|
|
62
|
+
source cannot be verified, delete the entry.
|
|
63
|
+
|
|
64
|
+
An `hf_repo` or `url` entry that omits a real locator, or whose `"license"` is
|
|
65
|
+
free-text rather than a concrete id or the marker, fails validation and appears
|
|
66
|
+
in `catalog.issues()` instead of in `entries()`.
|
|
67
|
+
|
|
68
|
+
## Why the shipped catalog is small
|
|
69
|
+
|
|
70
|
+
The catalog ships only artifacts the project can stand behind. The Hugging Face
|
|
71
|
+
ingestion capability stays fully available — [`probe.py`](probe.py:1),
|
|
72
|
+
[`hf_api.py`](hf_api.py:1), [`download_cli.py`](download_cli.py:1), and the
|
|
73
|
+
`hub` extra let a user download any **vetted** repository they choose to add.
|
|
74
|
+
The catalog itself is not the downloader; it is the list of things already
|
|
75
|
+
checked.
|
|
76
|
+
|
|
77
|
+
See also [`NOTICE.md`](../../../NOTICE.md) for the metadata-only weights policy.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""Public API for the curated model hub.
|
|
2
|
+
|
|
3
|
+
The offline catalog, capability probe, cache, isolated download worker, and the
|
|
4
|
+
inspect/import funnel are wired here. Live Hugging Face access and artifact
|
|
5
|
+
import build on this core in later phases; anything unavailable is reported,
|
|
6
|
+
never faked.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from typing import Any, Dict, List, Optional
|
|
10
|
+
|
|
11
|
+
from spikeforge_hub import cache, probe
|
|
12
|
+
from spikeforge_hub.catalog import (
|
|
13
|
+
entries,
|
|
14
|
+
get,
|
|
15
|
+
issues,
|
|
16
|
+
list_entries,
|
|
17
|
+
search,
|
|
18
|
+
)
|
|
19
|
+
from spikeforge_hub.download_cli import download_entry
|
|
20
|
+
from spikeforge_hub.entry import HubEntry
|
|
21
|
+
from spikeforge_hub.errors import (
|
|
22
|
+
HubArtifactError,
|
|
23
|
+
HubCatalogError,
|
|
24
|
+
HubDownloadCancelledError,
|
|
25
|
+
HubDownloadError,
|
|
26
|
+
HubError,
|
|
27
|
+
HubExtraMissingError,
|
|
28
|
+
HubImportError,
|
|
29
|
+
)
|
|
30
|
+
from spikeforge_hub.import_model import import_model as _run_import
|
|
31
|
+
from spikeforge_hub.inspect import inspect_artifact, resolve_path
|
|
32
|
+
from spikeforge_hub.registry import (
|
|
33
|
+
REGISTRY_SCHEMA_VERSION,
|
|
34
|
+
STAGES,
|
|
35
|
+
STATUSES,
|
|
36
|
+
Registry,
|
|
37
|
+
RegistryEntry,
|
|
38
|
+
lineage_report,
|
|
39
|
+
promote,
|
|
40
|
+
sign_entry,
|
|
41
|
+
verify_artifact,
|
|
42
|
+
verify_entry,
|
|
43
|
+
)
|
|
44
|
+
from spikeforge_hub.registry_errors import (
|
|
45
|
+
RegistryApprovalError,
|
|
46
|
+
RegistryCompatibilityError,
|
|
47
|
+
RegistryError,
|
|
48
|
+
RegistryIntegrityError,
|
|
49
|
+
RegistryLifecycleError,
|
|
50
|
+
RegistryPromotionError,
|
|
51
|
+
RegistrySchemaError,
|
|
52
|
+
RegistrySignatureError,
|
|
53
|
+
RegistryVersionError,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
__all__ = [
|
|
57
|
+
"REGISTRY_SCHEMA_VERSION",
|
|
58
|
+
"STAGES",
|
|
59
|
+
"STATUSES",
|
|
60
|
+
"HubArtifactError",
|
|
61
|
+
"HubCatalogError",
|
|
62
|
+
"HubDownloadCancelledError",
|
|
63
|
+
"HubDownloadError",
|
|
64
|
+
"HubEntry",
|
|
65
|
+
"HubError",
|
|
66
|
+
"HubExtraMissingError",
|
|
67
|
+
"HubImportError",
|
|
68
|
+
"Registry",
|
|
69
|
+
"RegistryApprovalError",
|
|
70
|
+
"RegistryCompatibilityError",
|
|
71
|
+
"RegistryEntry",
|
|
72
|
+
"RegistryError",
|
|
73
|
+
"RegistryIntegrityError",
|
|
74
|
+
"RegistryLifecycleError",
|
|
75
|
+
"RegistryPromotionError",
|
|
76
|
+
"RegistrySchemaError",
|
|
77
|
+
"RegistrySignatureError",
|
|
78
|
+
"RegistryVersionError",
|
|
79
|
+
"available",
|
|
80
|
+
"catalog",
|
|
81
|
+
"download",
|
|
82
|
+
"entries",
|
|
83
|
+
"get",
|
|
84
|
+
"import_model",
|
|
85
|
+
"inspect",
|
|
86
|
+
"issues",
|
|
87
|
+
"lineage_report",
|
|
88
|
+
"promote",
|
|
89
|
+
"search",
|
|
90
|
+
"sign_entry",
|
|
91
|
+
"verify_artifact",
|
|
92
|
+
"verify_entry",
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def available() -> bool:
|
|
97
|
+
"""Return True when live Hugging Face access (the ``hub`` extra) works."""
|
|
98
|
+
return probe.available()
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def catalog() -> List[Dict[str, object]]:
|
|
102
|
+
"""Return every entry card, with availability and cache state."""
|
|
103
|
+
return list_entries()
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def download(entry_id: str, dest: Optional[str] = None) -> Dict[str, Any]:
|
|
107
|
+
"""Download ``entry_id`` synchronously and return the worker report.
|
|
108
|
+
|
|
109
|
+
The async :class:`~spikeforge_hub.downloads.HubDownloadManager` runs
|
|
110
|
+
the same worker in a child process with progress and cancellation.
|
|
111
|
+
"""
|
|
112
|
+
entry = get(entry_id)
|
|
113
|
+
if entry is None:
|
|
114
|
+
raise HubDownloadError(entry_id, "unknown catalog entry")
|
|
115
|
+
return download_entry(entry, dest or cache.entry_dir(entry.id))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def inspect(entry_id: str) -> Dict[str, Any]:
|
|
119
|
+
"""Return the structural report for ``entry_id``'s resolved artifact."""
|
|
120
|
+
entry = get(entry_id)
|
|
121
|
+
if entry is None:
|
|
122
|
+
raise HubArtifactError(entry_id, "unknown catalog entry")
|
|
123
|
+
return inspect_artifact(resolve_path(entry)).to_dict()
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def import_model(
|
|
127
|
+
entry_id: str,
|
|
128
|
+
topology: Optional[str] = None,
|
|
129
|
+
promote: bool = True,
|
|
130
|
+
) -> Dict[str, Any]:
|
|
131
|
+
"""Inspect, classify, and (when compatible) promote a catalog artifact."""
|
|
132
|
+
return _run_import(entry_id=entry_id, topology=topology, promote=promote)
|