def ensure_directory_exists(filename):
    """Build filename's path if it does not already exists."""
    dirname = os.path.dirname(filename)
    os.makedirs(dirname, exist_ok = True)
Build filename's path if it does not already exists.
training/DeepSpeed-Domino/megatron/checkpointing.py