in scripts/launcher_distributed_kd.py [0:0]
def run_quant() -> None:
"""
Run quantization on the model.
This function sets up the environment, displays the configuration,
and runs the quantization command if it's on the primary node.
Args:
args: An object containing command-line arguments.
Returns:
None
Raises:
subprocess.CalledProcessError: If any subprocess command fails.
"""
print("***** Starting model quantization *****")
# Construct the quantization command
full_command = f"tune run quantize --config {args.tune_quant_yaml}"
if GLOBAL_RANK in {-1, 0}:
print("Running quantization on primary node...")
run_command(full_command)
else:
print("Not on primary node. Skipping quantization.")