diff --git a/src/maxtext/layers/nnx_decoders.py b/src/maxtext/layers/nnx_decoders.py index 1a9fdd48b0..bfb942d85d 100644 --- a/src/maxtext/layers/nnx_decoders.py +++ b/src/maxtext/layers/nnx_decoders.py @@ -438,7 +438,7 @@ def __init__( self.is_gemma4 = self.config.decoder_block == DecoderBlockType.GEMMA4 self.is_gemma4_small = self.config.decoder_block == DecoderBlockType.GEMMA4_SMALL - if config.mhc_expansion_rate > 1 and config.decoder_block == DecoderBlockType.DEEPSEEK4: + if getattr(config, "mhc_expansion_rate", 1) > 1 and config.decoder_block == DecoderBlockType.DEEPSEEK4: self.hc_head = mhc.DeepSeek4HyperHead( config=config, mesh=self.mesh, diff --git a/tests/utils/forward_pass_logit_checker.py b/tests/utils/forward_pass_logit_checker.py index a51b23980f..6b79e0ae02 100644 --- a/tests/utils/forward_pass_logit_checker.py +++ b/tests/utils/forward_pass_logit_checker.py @@ -379,6 +379,12 @@ def main(config, test_args): # pylint: disable=W0621 try: max_logging.log(f"Loading tokenizer from {path}.") tokenizer = AutoTokenizer.from_pretrained(path, token=hf_token, trust_remote_code=test_args.trust_remote_code) + # Mistral and Llama tokenizers ship no pad token, and the calls below pass padding=True, which + # transformers refuses without one ("Asking to pad but the tokenizer does not have a padding + # token"). Prompts are tokenized one at a time here, so nothing is ever actually padded and + # borrowing eos changes no result -- it only satisfies the check that rejects the call. + if tokenizer.pad_token is None: + tokenizer.pad_token = tokenizer.eos_token break except Exception as e: # pylint: disable=broad-except,broad-exception-caught last_exception = e