Skip to content

Commit 5ecfd7d

Browse files
Support transformer_engine v2.16.
PiperOrigin-RevId: 936695878
1 parent 81fd0de commit 5ecfd7d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/maxtext/layers/quantizations.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1012,19 +1012,27 @@ def _wrap(self, f, name=None):
10121012
"""
10131013

10141014
import transformer_engine.jax # pylint: disable=import-outside-toplevel # pytype: disable=import-error
1015+
from transformer_engine.common import recipe # pylint: disable=import-outside-toplevel # pytype: disable=import-error
10151016

10161017
fp8_recipe = self._recipe
10171018

10181019
class TEWrapper(transformer_engine.jax.flax.module.TransformerEngineBase):
10191020
"""Wrapper module for TransformerEngine quantization."""
10201021

1021-
def generate_quantizer_set(self, postfix: str = ""):
1022+
def generate_quantizer_set(self, postfix: str = "",
1023+
variable_collection: str | None = None,
1024+
quantization_checkpoint_name: str | None = None,
1025+
fp8_recipe: recipe.Recipe | None = None,
1026+
n_groups: int | None = None,
1027+
):
1028+
10221029
OVERWRITE_WITH_GRADIENT = "_overwrite_with_gradient"
10231030
return super().generate_quantizer_set( # pytype: disable=wrong-keyword-args
10241031
postfix=postfix,
10251032
variable_collection=OVERWRITE_WITH_GRADIENT,
10261033
quantization_checkpoint_name="quantization",
10271034
fp8_recipe=fp8_recipe,
1035+
n_groups=n_groups,
10281036
)
10291037

10301038
@nn.compact

0 commit comments

Comments
 (0)