SpiralTorch Python bindings
A Rust-first learning stack, with a Python door into Z-space.
Native tensors, autograd, neural modules, geometry, and runtime contracts live in Rust. Python connects them to experiments and other ML libraries without making NumPy, PyTorch, Transformers, or provider SDKs mandatory dependencies.
Install
python -m pip install -U spiraltorch
Source package version: Version 0.4.33. Wheels target CPython 3.8+, Linux x86_64, Windows x86_64, and macOS 14+ universal2. The default wheel includes WGPU with CPU fallback; a compatible GPU and the appropriate execution route are still required for GPU use. Source metadata does not confirm publication; check the PyPI release history for available versions before using APIs introduced after your installed version.
Source version metadata does not prove publication; check the PyPI release history for available wheels. This source tree can be ahead of PyPI. The documentation links below follow main and identify source-only paths where applicable. Check the package changelog and your installed version before using a new API.
First Model
import spiraltorch as st
from spiraltorch.nn import Linear, Sequential
print("CPU:", st.describe_device("cpu")["backend"])
model = Sequential()
model.add(Linear(2, 2, name="head"))
print(model(st.Tensor(1, 2, [0.25, 0.75])).tolist())
Native Gradients
Differentiate a squared norm with Rust-owned autograd, without NumPy or PyTorch:
import spiraltorch as st
x = st.AutogradTensor.variable(st.Tensor(1, 2, [1.0, -2.0]))
x.hadamard(x).sum().backward()
assert x.grad().tolist() == [[2.0, -4.0]]
print(x.grad().tolist())
This uses host tensors. Continue with learning recipes, geometric learning, or direct Rust use.
Find Your Entry Point
| Surface | Purpose |
|---|---|
Tensor, AutogradTensor |
Native tensors and Rust-owned reverse-mode differentiation |
nn, optim, SpiralSession |
Modules, training, optimization, and runtime planning |
nn.ByteDecoderPlan, nn.ByteDecoderGeometryPlan |
Explicit resident byte-LM learning, geometry mixtures, and model checkpoints |
nn.ByteCorpusStudy |
Shared Rust/WASM paired studies, geometry controls, and request-bound pause/resume |
SafeTensorArchive, NdTensor |
Native bounded checkpoint-tensor loading without Python safetensors |
NativeCausalLm, NativeCausalLmTrainer, NativeCausalLmGenerator |
Supported GPT-2 CPU inference, attached-geometry learning, and resumable generation |
NativeGeometryRuntime, NativeGeometryAdamW |
Rust-owned geometry evaluation, gradients, and optimizer state |
ecosystem |
Explicit tensor exchange with other ML libraries |
ApiLLMZSpaceRuntime |
Connect hosted-model responses to Z-space runtime traces |
runtime_import_preflight_report |
Check optional HF/Torch/PEFT dependencies before a larger run |
- Getting started: tensors, models, and learning loops.
- Python recipes: sessions, trainers, geometry, API inference, and ecosystem bridges.
- Capability reference: runtime contracts, numerical APIs, optional surfaces, and source-only additions.
- Model zoo: runnable language-model and other learning examples.
- Resident NN training: explicit GPU-resident execution and weight handoff.
- Geometric byte language models: Rust-owned QKV learning, four metrics, query routing, and exact model resume.
- Paired byte-corpus studies: the shared experiment runner and geometry-control preparation, available from 0.4.31.
- DLPack interoperability: ownership and copy policies for tensor exchange.
Native Language Models
The 0.4.33 source exposes NativeCausalLm, NativeCausalLmTrainer and
NativeCausalLmGenerator for supported GPT-2 CPU execution, geometry-only
learning, corpus evaluation and generation without Torch or NumPy. Base weights
remain frozen. The importer is not an arbitrary HF architecture loader or PEFT
executor, and this CPU path is separate from resident WGPU byte-LM training.
See the native/HF execution boundary
for supported configurations, native learning/generation recipes and remaining
foreign-model dependencies. These newer APIs are not in the immutable 0.4.32
wheels; check the installed version and publication history above.
Supported affine, WaveGate, elliptic, Topos and fractional geometry recipes can
also execute and learn directly through NativeGeometryRuntime, without Torch,
Transformers or NumPy. See
native geometry training
for saved-state reuse, Rust-owned updates and the still-optional HF boundary.
Optional HF Integration
Use the optional HF clients when execution should remain in Transformers/Torch. They are explicit interoperability paths, not hidden fallbacks for unsupported native models:
python -m pip install 'spiraltorch[hf-runtime]'
Optional runtime packages do not download a model or start training. See the HF optimizer study for matched experiments, supported routes, and limitations. Geometric interventions and conventional backend speed are separate evaluation questions.
Build, Test, and Release
Use the wheel build and validation guide for source builds, an explicit CPU-only feature set, and smoke commands. The release runbook keeps immutable tags, signed wheels, and verified PyPI publication together.
Full documentation · Z-space introduction · GNU AGPL-3.0-or-later
Metadata
Release files for spiraltorch 0.4.33
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| spiraltorch-0.4.33-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details for spiraltorch-0.4.33-cp38-abi3-win_amd64.whl |
| spiraltorch-0.4.33-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details for spiraltorch-0.4.33-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| spiraltorch-0.4.33-cp38-abi3-macosx_14_0_x86_64.macosx_14_0_arm64.macosx_14_0_universal2.whl | CPython 3.8 | abi3 | macOS 14.0+ universal2 (ARM64, x86-64), macOS 14.0+ ARM64, macOS 14.0+ x86-64 | Details for spiraltorch-0.4.33-cp38-abi3-macosx_14_0_x86_64.macosx_14_0_arm64.macosx_14_0_universal2.whl |
Total release size: 52.3 MB
Release files / spiraltorch-0.4.33-cp38-abi3-win_amd64.whl
| Download URL | spiraltorch-0.4.33-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 14.2 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
edb22637e2a01cbfa3b224e967187b5514a216d417933cd5cc416042aedad853
|
|
BLAKE2b-256 checksum How to use checksums |
d78781ca6cf1d0b2f160aa05ec50c36e1cd11468f5d868b09b506f58efccbb6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / spiraltorch-0.4.33-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | spiraltorch-0.4.33-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 13.3 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
52b5ba77f139d2bad3853588dbcf808ad4df11cf0cf3829185424092daaf8e10
|
|
BLAKE2b-256 checksum How to use checksums |
02ec2e6cbbb032b60bb07279f8b509b1b94c4ee1673522067f2bec4348e74106
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / spiraltorch-0.4.33-cp38-abi3-macosx_14_0_x86_64.macosx_14_0_arm64.macosx_14_0_universal2.whl
| Download URL | spiraltorch-0.4.33-cp38-abi3-macosx_14_0_x86_64.macosx_14_0_arm64.macosx_14_0_universal2.whl |
|---|---|
| Size | 24.8 MB |
| Tags | CPython 3.8 abi3 macOS 14.0+ ARM64 macOS 14.0+ universal2 (ARM64, x86-64) macOS 14.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
1a6ba0054644ce380b0206cc1b8c62932a80e2b4cb989947a4459b7fd399357c
|
|
BLAKE2b-256 checksum How to use checksums |
1a84b11b64829083cc3fd6dc290b17420980831270fead7a5c67a850084dc525
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for spiraltorch 0.4.33
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.