BF16 is a Python package for converting floating-point numbers to BFloat16 format using optimized Windows x86-64 assembly.
To install bf16 the 2 easiest options are either run this command:
pip install bf16or click this button to download a zip containing only necessary files to download and also extract it:
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- Windows AMD x86-64
- Python 3.6+
- cffi The package includes a compiled assembly executable for fast conversion.
- 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
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
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
bf16 now has more verified details
- added more verified details
- made SECURITY.md workflow and CODEOWNERS
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
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