Skip to main content

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

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

oxbitnet-0.3.1-cp312-cp312-win_amd64.whl (4.6 MB view details)

Uploaded CPython 3.12Windows x86-64

oxbitnet-0.3.1-cp312-cp312-manylinux_2_38_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.38+ x86-64

oxbitnet-0.3.1-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

oxbitnet-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

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

Hashes for oxbitnet-0.3.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 baff2216e4d228d8a4e8c1e3c36405b1545437dd82f30ee7bb13cfc7700ed7b3
MD5 d6705eb1dd774675bb7c121f3695987b
BLAKE2b-256 1c5c89d94355104effc5f5d6d9980caaa9db50118abb72f87af8f69ce119bad8

See more details on using hashes here.

Provenance

The following attestation bundles were made for oxbitnet-0.3.1-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on m96-chan/0xBitNet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file oxbitnet-0.3.1-cp312-cp312-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for oxbitnet-0.3.1-cp312-cp312-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 7fe55aefb0820dead7baacd41b4f4425f41c6cbd3fdba8f47cb93f6bc6b97b28
MD5 daf9cbee4f2bae075c9638c409aef1d7
BLAKE2b-256 86febe9fd341e5ccb2c64f25299a91547da81432fd6720ef9a313816d1485596

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file oxbitnet-0.3.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for oxbitnet-0.3.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b87851d62e87b46145bc0022017795f7239b6c0b5d6a5b455a1fc60123a17b31
MD5 e0887a5e7ca6fa52a95fff9bd1847d3c
BLAKE2b-256 6cc58a67a37c2843aa7b39784f99e4c5f7651a7234b2d23753a58f38d7a1b1e3

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file oxbitnet-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for oxbitnet-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9df86610a8980aa74771eb964f8417cadf5458ba9d79abad2701843e34b589d5
MD5 c0762bd3c5c43481ea2e56d346959dc3
BLAKE2b-256 b92e14288de7c192dd158047720296840ce5a83345580764435e6ac7b2d47241

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page