def save_module_files(
    config: "PretrainedConfig", model_name_or_path: str, output_dir: str, **kwargs
) -> tuple["PretrainedConfig", list[str]]:
    """Save module files for the given model_name_or_path.

    Returns updated config and list of saved module files.
    """
    # check if auto_map is present in the config
    auto_map = getattr(config, "auto_map", None)
    if not auto_map:
        return config, []

    # save the module files
    module_files = set()
    for key, value in config.auto_map.items():
        try:
            class_reference, module_file = get_module_file(value, model_name_or_path, **kwargs)

            # save the module file
            save_path = Path(output_dir) / Path(module_file).name
            hardlink_copy_file(module_file, save_path)
            module_files.add(str(save_path))

            # -- is attached with hf-id, don't save it in config, from_pretrained will try to load it
            # from the model hub
            config.auto_map[key] = class_reference
        except Exception as e:
            logger.warning(
                "Failed to save module file for %s: %s. Loading config with `trust_remote_code=True` will fail!",
                value,
                e,
            )
    # set _auto_class to None to avoid saving the module file again and causing SameFileError error
    config._auto_class = None  # pylint: disable=protected-access

    return config, list(module_files)
Save module files for the given model_name_or_path.

    Returns updated config and list of saved module files.
    
olive/common/hf/utils.py