transformers
f35aeb93 - This PR fixes Gemma3n fp16 loading when missing weights need to be in… (#49147)

Commit
52 days ago
This PR fixes Gemma3n fp16 loading when missing weights need to be in… (#49147) * This PR fixes Gemma3n fp16 loading when missing weights need to be initialized. `Gemma3nAudioConfig.gradient_clipping` defaults to `1e10`. Gemma3n audio modules previously stored this value as a non-persistent tensor buffer, so loading the model with `torch_dtype=torch.float16` converted the buffer to fp16. If the checkpoint had missing weights, `initialize_weights()` then tried to fill that fp16 buffer with `1e10`, which overflows fp16 and crashes: RuntimeError: value cannot be converted to type c10::Half without overflow Signed-off-by: Wang, Yi A <yi.a.wang@intel.com> * update Signed-off-by: Wang, Yi A <yi.a.wang@intel.com> * add test Signed-off-by: Wang, Yi A <yi.a.wang@intel.com> --------- Signed-off-by: Wang, Yi A <yi.a.wang@intel.com>
Author
Parents
Loading