Skip to main content

High-performance BFloat16 conversion powered by x64 Assembly.

Project description

bf16

BF16 is a Python package for converting floating-point numbers to BFloat16 format using optimized Windows x86-64 assembly.

Live Data

Pepy.tech data

PyPI DownloadsPyPI DownloadsPyPI Downloads

Github.com data

Stars Forks Open Issues Open PRs License Repo Size Top Language Code Size Last Commit Commit Activity Contributors Followers Watchers

Pypi.org data

PyPI Version Python Versions

Socket.dev data

Socket

Virustotal Scan Results

VirusTotal

More Badges

Platform Dependencies CPU Instruction Set Security Policy

Installation

To install bf16 the 2 easiest options are either run this command:

pip install bf16

or click this button to download a zip containing only necessary files to download and also extract it: Download bf16.zip

Usage

import bf16

x = bf16.bfloat16(3.14)
print(x)  # Outputs the BFloat16 approximation as a float and for the record it also actually output 3.125 because its a real brain-float16
print(f"Size: {len(x.data)} bytes")  # Always 2 bytes

Requirements

  • Windows AMD x86-64
  • Python 3.6+
  • cffi The package includes a compiled assembly executable for fast conversion.

Acknowledgments

  • Thank you to Tomasz Grysztar for his work on FASM which made it possible to optimize bf16.dll and make it smaller
  • Jeremy Gordon thank you for making golink which helped with earlier versions of bf16

Changelog

1.0.1

bf16 has completely changed with the last update here is the main stuff

  • added nearly all operators that function that exist within float32 to bfloat16
  • instead of bf16.obj and bf16.exe it is now just a bf16.dll
  • optimized to not have to open and exit bf16.dll everytime
  • added Changelog
  • added acknowlegement to golink I forgot

1.0.2

bf16 has gained a way for people to know they are downloading a safe package

  • corrected README.md old changelog for 1.0.1
  • added repo and its link

1.0.3

bf16 now has more verified details

  • added more verified details
  • made SECURITY.md workflow and CODEOWNERS

1.0.4

bf16 now has finished documentation.

  • Finished community Standards
  • Added downloading Zip file allowing you to only download only necessary files saving memory including README.md, LICENSE, bf16/__init__.py, and bf16/bf16.dll NOTE: go to [[CHANGELOG.md]] for more specific information on the changelog

1.0.5

bf16 is now much faster!

  • optimized bf16.dll by using vectorization merged functions and merged sections
  • switched from GoLink&NASM to FASM for increased speed and smaller dll
  • at the cost of adding a dependency uses cffi to make __init__.py much faster

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 Distribution

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

bf16-1.0.5-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file bf16-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: bf16-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bf16-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 09cf6293387cfc10fc20adf87b46c35390c9cba2d73a0fb65c24abae21295cf3
MD5 7782c62c46fcabc13c9e95d6fba2f864
BLAKE2b-256 f8ff404d2739d8d481eb9fc5e45f57ee7938e53bb3dd7097050fbb4a709a27cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for bf16-1.0.5-py3-none-any.whl:

Publisher: bf16_workflow.yml on Pythonexplorer48/bf16

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