def model_parallel_is_initialized():
    """Check if model and data parallel groups are initialized."""
    if _MODEL_PARALLEL_GROUP is None or _DATA_PARALLEL_GROUP is None:
        return False
    return True
Check if model and data parallel groups are initialized.
megatron_lm/megatron/mpu/initialize.py