def remove_global_step(directory):
    """
    Removes directories that start with 'global_step' within the specified directory.

    This function traverses the given directory and its subdirectories in a bottom-up manner.
    If it finds any directory whose name starts with 'global_step', it deletes that directory
    and all its contents.

    Args:
        directory (str): The path to the directory to be traversed and cleaned.

    Returns:
        None
    """
    for root, dirs, _ in os.walk(directory, topdown=False):
        for name in dirs:
            if name.startswith("global_step"):
                folder_path = os.path.join(root, name)
                print(f"Removing folder: {folder_path}")
                shutil.rmtree(folder_path)

    Removes directories that start with 'global_step' within the specified directory.

    This function traverses the given directory and its subdirectories in a bottom-up manner.
    If it finds any directory whose name starts with 'global_step', it deletes that directory
    and all its contents.

    Args:
        directory (str): The path to the directory to be traversed and cleaned.

    Returns:
        None
    
src/autotrain/trainers/common.py