Skip to content

fix: construct BF16 checkpoints in FP16 on pre-Ampere GPUs - #200

Open
Matt Van Horn (mvanhorn) wants to merge 1 commit into
microsoft:mainfrom
mvanhorn:fix/23-trellis2-pre-ampere-bf16
Open

Matt Van Horn (mvanhorn) wants to merge 1 commit into
microsoft:mainfrom
mvanhorn:fix/23-trellis2-pre-ampere-bf16

Conversation

@mvanhorn

Copy link
Copy Markdown

For checkpoints configured as bf16 or bfloat16, from_pretrained now substitutes float16 before model construction when CUDA is available and the current device has compute capability below 8.0. The fallback emits a warning about FP16 overflow and numerical instability. The README explains the fallback, its dependence on the current CUDA device on mixed-GPU systems, and the separate backend failures older GPUs may still encounter. Loading a BF16 checkpoint on a pre-Ampere GPU can fail during attention because the available backend cannot process BF16 inputs. from_pretrained passed the checkpoint's configured dtype directly to the model constructor without checking the current CUDA device's compute capability.

Testing: The test check found no tests for the touched modules, so no runtime behavior was verified.

Fixes #23

For checkpoints configured as bf16 or bfloat16, from_pretrained now
substitutes float16 before model construction when CUDA is available and
the current device has compute capability below 8.0. The fallback emits
a warning about FP16 overflow and numerical instability. The README
explains the fallback, its dependence on the current CUDA device on
mixed-GPU systems, and the separate backend failures older GPUs may
still encounter.

Fixes microsoft#23

This branch has not been deployed

No deployments
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.

Error: bf16 is only supported on A100+ GPUs

1 participant