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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

oxbitnet-0.5.2-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.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: oxbitnet-0.5.2-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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9117c697c2923174f90ef092aa5bbc6119aab8b09f45dacb66aa3e9f28618407
MD5 c49457fa78a1a015611a2960f22d6405
BLAKE2b-256 b73510397837333d5bd95fc5c3891cf59744227ad50574699228fd32b82a4658

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for oxbitnet-0.5.2-cp312-cp312-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 ea1cf3f33bf44a9a2beaf9b6508d94ebf3536d241af802e807bb53168c17dcb1
MD5 849a1df122dc88283548a9d6620a855b
BLAKE2b-256 732740268364b3f5082f56a38cf79d386c842215deb4f72839e5c5b2f93078d1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for oxbitnet-0.5.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3bee326d580429a759eb556adcb57cf55d3e7e94c6f8379f52872b2837dd2446
MD5 47e54ffb98ad32e9a7086dc7dc9c116a
BLAKE2b-256 021ec0ae70ef9ab6a2fb928b598e7c9adf42b842523ac83d22613c8e8d80582a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for oxbitnet-0.5.2-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4f65322462fec75e9b5a0e442747a7527984e367854ad2cea7e2ccef162e6d82
MD5 40cf216a5676441c97d1dfb0f01b7c6c
BLAKE2b-256 321d66d69430542336d278a522a36713bc632469913a669d0507f635a25c485d

See more details on using hashes here.

Provenance

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