Run BitNet b1.58 ternary LLMs with wgpu
Project description
oxbitnet
Run BitNet b1.58 ternary LLMs with GPU acceleration (wgpu).
Python bindings for 0xBitNet — also available as 0xbitnet (npm) and oxbitnet (Rust).
Install
pip install oxbitnet
Quick Start
from oxbitnet import BitNet
model = BitNet.load_sync("model.gguf")
# Chat with streaming output
model.chat(
[("system", "You are a helpful assistant."), ("user", "Hello!")],
on_token=lambda t: print(t, end="", flush=True),
temperature=0.7,
top_k=40,
)
model.dispose()
API
| Method | Description |
|---|---|
BitNet.load_sync(source) |
Load a GGUF model from URL or path |
model.chat(messages, on_token, ...) |
Chat with template + streaming callback |
model.generate(prompt, on_token, ...) |
Generate with streaming callback |
model.generate_sync(prompt, ...) |
Generate, return full string |
model.generate_tokens_sync(prompt, ...) |
Generate, return list of token strings |
model.dispose() |
Release GPU resources |
Parameters
All generate methods accept:
max_tokens(default: 256)temperature(default: 1.0)top_k(default: 50)repeat_penalty(default: 1.1)
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oxbitnet-0.3.1-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: oxbitnet-0.3.1-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 4.6 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baff2216e4d228d8a4e8c1e3c36405b1545437dd82f30ee7bb13cfc7700ed7b3
|
|
| MD5 |
d6705eb1dd774675bb7c121f3695987b
|
|
| BLAKE2b-256 |
1c5c89d94355104effc5f5d6d9980caaa9db50118abb72f87af8f69ce119bad8
|
Provenance
The following attestation bundles were made for oxbitnet-0.3.1-cp312-cp312-win_amd64.whl:
Publisher:
publish.yml on m96-chan/0xBitNet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oxbitnet-0.3.1-cp312-cp312-win_amd64.whl -
Subject digest:
baff2216e4d228d8a4e8c1e3c36405b1545437dd82f30ee7bb13cfc7700ed7b3 - Sigstore transparency entry: 974626182
- Sigstore integration time:
-
Permalink:
m96-chan/0xBitNet@e80a0bcf09d2d805c6ee3e939c68f62e243a62f0 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/m96-chan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e80a0bcf09d2d805c6ee3e939c68f62e243a62f0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file oxbitnet-0.3.1-cp312-cp312-manylinux_2_38_x86_64.whl.
File metadata
- Download URL: oxbitnet-0.3.1-cp312-cp312-manylinux_2_38_x86_64.whl
- Upload date:
- Size: 7.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.38+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fe55aefb0820dead7baacd41b4f4425f41c6cbd3fdba8f47cb93f6bc6b97b28
|
|
| MD5 |
daf9cbee4f2bae075c9638c409aef1d7
|
|
| BLAKE2b-256 |
86febe9fd341e5ccb2c64f25299a91547da81432fd6720ef9a313816d1485596
|
Provenance
The following attestation bundles were made for oxbitnet-0.3.1-cp312-cp312-manylinux_2_38_x86_64.whl:
Publisher:
publish.yml on m96-chan/0xBitNet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oxbitnet-0.3.1-cp312-cp312-manylinux_2_38_x86_64.whl -
Subject digest:
7fe55aefb0820dead7baacd41b4f4425f41c6cbd3fdba8f47cb93f6bc6b97b28 - Sigstore transparency entry: 974626198
- Sigstore integration time:
-
Permalink:
m96-chan/0xBitNet@e80a0bcf09d2d805c6ee3e939c68f62e243a62f0 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/m96-chan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e80a0bcf09d2d805c6ee3e939c68f62e243a62f0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file oxbitnet-0.3.1-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: oxbitnet-0.3.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 4.2 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b87851d62e87b46145bc0022017795f7239b6c0b5d6a5b455a1fc60123a17b31
|
|
| MD5 |
e0887a5e7ca6fa52a95fff9bd1847d3c
|
|
| BLAKE2b-256 |
6cc58a67a37c2843aa7b39784f99e4c5f7651a7234b2d23753a58f38d7a1b1e3
|
Provenance
The following attestation bundles were made for oxbitnet-0.3.1-cp312-cp312-macosx_11_0_arm64.whl:
Publisher:
publish.yml on m96-chan/0xBitNet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oxbitnet-0.3.1-cp312-cp312-macosx_11_0_arm64.whl -
Subject digest:
b87851d62e87b46145bc0022017795f7239b6c0b5d6a5b455a1fc60123a17b31 - Sigstore transparency entry: 974626189
- Sigstore integration time:
-
Permalink:
m96-chan/0xBitNet@e80a0bcf09d2d805c6ee3e939c68f62e243a62f0 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/m96-chan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e80a0bcf09d2d805c6ee3e939c68f62e243a62f0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file oxbitnet-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: oxbitnet-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 4.3 MB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9df86610a8980aa74771eb964f8417cadf5458ba9d79abad2701843e34b589d5
|
|
| MD5 |
c0762bd3c5c43481ea2e56d346959dc3
|
|
| BLAKE2b-256 |
b92e14288de7c192dd158047720296840ce5a83345580764435e6ac7b2d47241
|
Provenance
The following attestation bundles were made for oxbitnet-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl:
Publisher:
publish.yml on m96-chan/0xBitNet
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oxbitnet-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl -
Subject digest:
9df86610a8980aa74771eb964f8417cadf5458ba9d79abad2701843e34b589d5 - Sigstore transparency entry: 974626204
- Sigstore integration time:
-
Permalink:
m96-chan/0xBitNet@e80a0bcf09d2d805c6ee3e939c68f62e243a62f0 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/m96-chan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e80a0bcf09d2d805c6ee3e939c68f62e243a62f0 -
Trigger Event:
push
-
Statement type: