def create_tensorboard_writer(exp_dir: str) -> SummaryWriter:
    """
    Create a tensorboard writer.

    Args:
        exp_dir (str): The directory to save tensorboard logs.

    Returns:
        SummaryWriter: The tensorboard writer.
    """
    tensorboard_dir = f"{exp_dir}/tensorboard"
    os.makedirs(tensorboard_dir, exist_ok=True)
    writer = SummaryWriter(tensorboard_dir)
    return writer

    Create a tensorboard writer.

    Args:
        exp_dir (str): The directory to save tensorboard logs.

    Returns:
        SummaryWriter: The tensorboard writer.
    
opensora/utils/misc.py