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.5.0-cp312-cp312-win_amd64.whl (4.6 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.38+ x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

oxbitnet-0.5.0-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.5.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: oxbitnet-0.5.0-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.5.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 dd55f6bcd6d4a0ae2e5c9905f19edaabe59c6eafdf3f47a1c4f1105ffee6f750
MD5 226d3fb0238b971813ba5daf55d0b9a0
BLAKE2b-256 10d86a94e86c1a150bdc4633df438d8827b59be0fb9885711ac9a14770e54c93

See more details on using hashes here.

Provenance

The following attestation bundles were made for oxbitnet-0.5.0-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.5.0-cp312-cp312-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for oxbitnet-0.5.0-cp312-cp312-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 1fed5ef764dfd1403082e3e3c869db4ddc9c23b7b26e226f64dd202ee119c501
MD5 9b88a9fdd57ca85e42828d67cb43f440
BLAKE2b-256 7a8eeb4d14bf29a3c3b6578ad50699aa6105cee5bc05946ca39ac6ed062f6d64

See more details on using hashes here.

Provenance

The following attestation bundles were made for oxbitnet-0.5.0-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.5.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for oxbitnet-0.5.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 598c439b4ab2840c6b254efb6229dbc717e3d377b91b1bd825e92e5c3f5a386c
MD5 c0d8eb74258b3801bd5148429d7b4efe
BLAKE2b-256 3281c184a1df38948e3de74fefa8b8638b48b24a1f5ab44df8c1578bfb1bd58d

See more details on using hashes here.

Provenance

The following attestation bundles were made for oxbitnet-0.5.0-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.5.0-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for oxbitnet-0.5.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 92db08fb987c6fc7673c5d0ca0279b0c6b107e834d95ec40b870ec798e68c120
MD5 12bb93aa6c6cdd41ce05872d83f83bc2
BLAKE2b-256 568775f160b9e25ff93813620aebc4804822b63d875d2a90be9189d8aada5d11

See more details on using hashes here.

Provenance

The following attestation bundles were made for oxbitnet-0.5.0-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