Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert: Support DT_BF16 tensors #1309

Merged
merged 4 commits into from
May 4, 2023
Merged

Convert: Support DT_BF16 tensors #1309

merged 4 commits into from
May 4, 2023

Conversation

ivanstepanovftw
Copy link
Collaborator

@ivanstepanovftw ivanstepanovftw commented May 4, 2023

For models like PygmalionAI/metharme-7b and PygmalionAI/pygmalion-7b

By default, converts BF16 to FP32 for better precision.

image


🤖 Generated by Copilot at c47b349

Add bfloat16 support for PyTorch models in convert.py. Define a new data type constant, a conversion function, and update the tensor handling logic.

  • Add support for bfloat16 tensors in PyTorch models (link, link, link, link)
  • Update the custom handlers for unpickling PyTorch tensors (link, link, link)

@ivanstepanovftw ivanstepanovftw changed the title Support DT_BF16 tensors Convert: Support DT_BF16 tensors May 4, 2023
ivanstepanovftw and others added 3 commits May 4, 2023 13:46
Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
remove useless comment
@ivanstepanovftw
Copy link
Collaborator Author

Tested it before, works great. Before these changes it was neccessary to convert pytorch model to fp32 pytorch model, and then to ggml. There is also discussions on model's hf page about BF16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants