Speedup Gemma4 text generation (CORE-371) (#15054)

This commit is contained in:
Jukka Seppänen
2026-08-14 04:12:55 +03:00
committed by GitHub
parent a779de4d89
commit 7fe8a61385
3 changed files with 260 additions and 21 deletions

View File

@@ -1639,7 +1639,7 @@ def mixed_precision_ops(quant_config={}, compute_dtype=torch.bfloat16, full_prec
self.norm_type, self.scale_grad_by_freq, self.sparse)
target_dtype = out_dtype if out_dtype is not None else weight._params.orig_dtype
x = x.to(dtype=target_dtype)
if scale is not None and scale != 1.0:
if scale is not None:
x = x * scale.to(dtype=target_dtype)
return x