def get_file_name(args) -> str:
    """Creates the base file name for this experiment from the command line arguments."""
    if args.override_name is not None and args.override_name != "":
        if args.name_suffix != "":
            raise ValueError("Cannot set --override_name and --name_suffix.")
        return args.override_name

    split_prefix = "S" if args.disable_split_fix else "SF"
    batch_size_text = "BSn" if args.minibatch_size is None else f"BS{args.minibatch_size}"
    if args.encoder_minibatch_size is not None:
        batch_size_text += f"_EBS{args.encoder_minibatch_size}"

    if args.mode == "IWAE":
        dreg_text = "_dreg" if args.use_dreg else ""
        file_name = (
            f"{args.dataset}_{args.configuration}_{args.mode}_{split_prefix}{args.split}"
            f"_K{args.num_IW_samples}_{batch_size_text}{dreg_text}"
        )
    elif args.mode == "VI":
        file_name = f"{args.dataset}_{args.configuration}_{args.mode}_{split_prefix}{args.split}_{batch_size_text}"
    elif args.mode == "CIWAE":
        file_name = (
            f"{args.dataset}_{args.configuration}_{args.mode}_{split_prefix}{args.split}"
            f"_K{args.num_IW_samples}_B{args.beta}_{batch_size_text}"
        )
    else:
        raise ValueError(f"Unknown mode: {args.mode}")

    if not args.use_nat_grad_for_final_layer:
        file_name += "_finvarnotnat"

    if args.name_suffix != "":
        file_name += f"_{args.name_suffix}"

    return file_name