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

Uploaded CPython 3.12Windows x86-64

oxbitnet-0.4.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.4.0-cp312-cp312-macosx_11_0_arm64.whl (4.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

oxbitnet-0.4.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.4.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: oxbitnet-0.4.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.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 ff91a64e37455ee2804e8ba9c428400f6d66fb47a6065203d4f36c887c76815f
MD5 329210d4e56a956e6bf334f9d21b2ce4
BLAKE2b-256 2ded540d69fe54c5445ac3cf5aed6bf857ab59b282d5762c6a66628d2f0a1e02

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for oxbitnet-0.4.0-cp312-cp312-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 c8b13799832fc37d4464cc064772eb7bcea691c5f308db006c601bd6c35d776a
MD5 36e635fce7f09966cce088044173cc37
BLAKE2b-256 13c3f56b1b95e0a99aa51677470e96e0acf2e783d9b115331b212c689d4b5b93

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for oxbitnet-0.4.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a428430bf5daf2f7ffeac48da0de95a4089a020e3731d1d6aebfe5377c60a923
MD5 a1f2d4c731a8b5d28e1ef4dce2838b1c
BLAKE2b-256 014501b0a1cf5c37cd1e43f2fb142c8fb6120fc09d739d28ccaf18f2c27ffd8f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for oxbitnet-0.4.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9a010f07dd07180a82ca9abf5a20085876ada45dc531df64378dc1e0bb8f4dbe
MD5 b032d318cba98ace1f82d99590f11cbb
BLAKE2b-256 ce57f03ade84fa53addbd6782b266a3c6d69e23d2ece044a51a3767707186f43

See more details on using hashes here.

Provenance

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