def is_pipeline_last_stage(ignore_virtual=False):
    """Return True if in the last pipeline model-parallel stage, False otherwise."""
    # if not ignore_virtual:
    #     virtual_pipeline_model_parallel_world_size = (
    #         get_virtual_pipeline_model_parallel_world_size()
    #     )
    #     if virtual_pipeline_model_parallel_world_size is not None and get_virtual_pipeline_model_parallel_rank() != (
    #         virtual_pipeline_model_parallel_world_size - 1
    #     ):
    #         return False
    # return get_pipeline_model_parallel_rank() == (get_pipeline_model_parallel_world_size() - 1)
    return True
Return True if in the last pipeline model-parallel stage, False otherwise.
training/DeepSpeed-Domino/domino/parallel_state.py