Skip to main content

Welvet for Python

Python package 1.1.2 · powered by the Welvet Go AI engine v1.7.3

ctypes bindings over a prebuilt C ABI (welvet.so / welvet.dylib). Same volumetric grids, layers, dtypes/quants, training, and cameral modes as Go — plus optional Linux/macOS accelerators (CUDA, ROCm, Vulkan, Metal, …) selected at runtime.

Replaces the Loom-era PyPI line (welvet==0.80.0). Prefer create_grid + place_* over legacy Loom network helpers.


Install

pip install welvet==1.1.2

Wheels ship with the matching native CABI:

Wheel Includes
Linux x86_64 (manylinux) welvet.so + cuda / rocm / vulkan / cpp siblings
macOS arm64 welvet.dylib + Metal sibling
import welvet as w

print(w.__version__)       # 1.1.2  (Python / CABI contract)
print(w.engine_version())  # 1.1.2  (embedded CABI string)
# Engine behind the ABI: Welvet Go v1.7.3

Quick start

import welvet as w

w.assert_engine_version()

# See what this machine can run
for b in w.list_backends():
    mark = "✓" if b["available"] else "·"
    print(f"  {mark} {b['id']}")

g = w.create_grid(backend="cpu_tiled")  # or cuda / metal / vulkan / …
w.place_dense(g, {"in": 8, "out": 8, "act": "relu", "dtype": w.DType.FLOAT32})

x = [0.1] * 8
y = [0.0] * 7 + [1.0]
print("out", w.forward(g, x)[:4])
print("loss", w.train_sgd(g, x, y, lr=0.05))

blob = w.serialize_entity(g)   # .entity checkpoint bytes
w.free_grid(g)

g2 = w.deserialize_entity(blob)
w.free_grid(g2)

GPU / accelerator backend

import welvet as w

# Pick any available backend from list_backends()
g = w.create_grid(backend="cuda")       # Linux + NVIDIA
# g = w.create_grid(backend="metal")    # macOS Apple silicon
# g = w.create_grid(backend="vulkan")   # Linux Vulkan
# g = w.create_grid(backend="rocm")     # Linux AMD ROCm
# g = w.create_grid(backend="native_cpu")

w.place_dense(g, {"in": 16, "out": 16, "act": "relu", "dtype": 1})
out = w.forward(g, [0.05] * 16)
w.free_grid(g)

Routed backends (cuda / metal / rocm / vulkan) enable Go EnableRouting inside the CABI. For qnn / mlx, call w.prepare_grid(g) after place_* (SyncTo* before forward).

Attention layer

import welvet as w

g = w.create_grid()
w.place(g, "mha", {
    "dim": 8,
    "DModel": 8,
    "NumHeads": 2,
    "SeqLen": 4,
    "dtype": w.DType.FLOAT32,
})
# batch=1, seq=4, dim=8
out = w.forward(g, [0.1] * 32, shape=[1, 4, 8])
print(len(out))  # 32
w.free_grid(g)

Cameral / bicameral train

import welvet as w

stack = w.create_bicameral(in_=4, hidden=8, out=4, dtype=1)
w.set_child_modes(stack, ["NormalBP", "NormalBP"])
meta = w.train_stack_mse(stack, [0.1, 0.2, 0.3, 0.4], [0, 0, 0, 1], mode="NormalBP", lr=0.05)
print(meta)
w.free_stack(stack)

Backends

backend= Typical host Notes
cpu_tiled everywhere Default
simd CPU Plan 9 / SIMD paths
webgpu desktop Needs a WebGPU device
native_cpu Linux / macOS welvet.cpp via linked libwelvet
cuda Linux amd64 Needs NVIDIA driver + libwelvet_cuda
rocm Linux amd64 Needs ROCm + libwelvet_rocm
vulkan Linux amd64 Needs Vulkan + libwelvet_vulkan
metal macOS arm64 Needs libwelvet_metal
mlx macOS arm64 Forward-oriented; prepare_grid
qnn Windows/Android arm64 Hexagon HTP; prepare_grid
w.list_backends()   # rich probe: id, available, routing, note
w.enable_backend("cuda")
w.set_grid_backend(g, "vulkan")

Layers (place / place_dense)

dense · mha · swiglu · rmsnorm · layernorm · embedding · softmax · sequential · residual · cnn1/cnn2/cnn3 · rnn · lstm · convt1/convt2/convt3 · parallel · stack · kmeans · mamba · metacognition · gdn

w.place(g, "swiglu", {"dim": 32, "dtype": 1})
w.place_dense(g, {"in": 32, "out": 10, "act": "relu", "dtype": 1})

Use w.DType.FLOAT32 (or integer ids from w.list_dtypes()).


Training helpers

Call Role
train_sgd / train_tween Grid SGD / tween step
train_stack_mse / train_parallel_mse Cameral MSE
serialize_entity / deserialize_entity .entity checkpoints
run_suite / run_all_suites Go w2a suites via CABI
python -m welvet.cabi_verify          # smoke: version, dense, MHA, backends
python -m welvet.w2a run --quick      # suite smoke set
python -m welvet.w2a catalog

Versions

Component Version
PyPI / Python package 1.1.2
Embedded CABI (engine_version()) 1.1.2
Welvet Go engine (source of this build) v1.7.3

CABI 1.1.2 adds runtime backend selection (runtime/accel: cuda · metal · rocm · vulkan · native_cpu · qnn · mlx) on top of the Welvet v1.7.3 engine.



Dev / maintainers

# Fetch prebuilts into the checkout (gitignored)
cd w2a
./scripts/fetch_cabi.sh --all cabi-v1.1.2

# Or build Linux CABI from Go
./scripts/pack_cabi_linux.sh --build

pip install -e python/
python -m welvet.cabi_verify

# Wheels → PyPI
./scripts/build_pypi_wheels.sh
twine upload python/dist/*.whl

License: Apache-2.0

Metadata

Release files for welvet 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for welvet 1.1.2
File Interpreter ABI Platform Actions
welvet-1.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for welvet-1.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
welvet-1.1.2-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for welvet-1.1.2-py3-none-macosx_11_0_arm64.whl

Total release size: 36.2 MB

Release files / welvet-1.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL welvet-1.1.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 24.8 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
34eec1382fa4328104a6beb68cfd12fb2f4f21ac27dbd75ffd695863cb5ed38d
BLAKE2b-256 checksum
How to use checksums
3ade44054a454219d1ccb083b2b40a3fe34bbc3fa7f9086160ae79a7378a86a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / welvet-1.1.2-py3-none-macosx_11_0_arm64.whl

Download URL welvet-1.1.2-py3-none-macosx_11_0_arm64.whl
Size 11.4 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
d7e55527a3b1078f74980ccc53924bf5471eab2cb04f414f80223ad158016edb
BLAKE2b-256 checksum
How to use checksums
3e83b95e8f5dd6730c15796f1f21eaca85c6aa8fa73ff6299174d514d4c6ce82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Security for welvet 1.1.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page