maxtext.experimental.agent.ckpt_conversion_agent.ground_truth.qwen3 module

maxtext.experimental.agent.ckpt_conversion_agent.ground_truth.qwen3 module#

Qwen3 ckpt conversation agent ground truth hook functions.

maxtext.experimental.agent.ckpt_conversion_agent.ground_truth.qwen3.QWEN3_MAXTEXT_TO_HF_PARAM_HOOK_FN(config, scan_layers=False, saving_to_hf=False)[source]#

Creates parameter transformation functions for Qwen3.

This function provides a dictionary of transformation functions (hooks) for converting Qwen3 model parameters between MaxText and Hugging Face formats. It handles embedding padding and kernel reshaping.

Parameters:
  • config (dict) – Model configuration dictionary, including ‘num_hidden_layers’ and optionally ‘num_experts’.

  • scan_layers (bool, optional) – Whether the model uses scanned layers. Defaults to False.

  • saving_to_hf (bool, optional) – The direction of conversion. True for MaxText to Hugging Face, False for the reverse. Defaults to False.

Returns:

A dictionary mapping MaxText parameter names to their corresponding

transformation functions.

Return type:

dict