def create_config_class(
    pass_type: str,
    default_config: dict[str, PassConfigParam],
    disable_search: Optional[bool] = False,
    validators: dict[str, Callable] = None,
) -> type[BasePassConfig]:
    """Create a Pydantic model class from a configuration dictionary."""
    config = {}
    validators = validators.copy() if validators else {}
    for param, param_config in default_config.items():
        if param_config.category == ParamCategory.OBJECT:
            validators[f"validate_{param}"] = validator(param, allow_reuse=True)(validate_object)
        if param == "data_dir":
            validators[f"validate_{param}"] = validator(param, allow_reuse=True)(validate_resource_path)

        type_ = param_config.type_
        if param_config.required:
            config[param] = (type_, ...)
            continue

        # Value can be one of
        # 1. Instance of type_ if search is disabled or search_defaults is None
        # 2. Search Parameter if search is enabled and search_defaults is not None
        # 3. PassParamDefault if value is set to "DEFAULT_VALUE" or "SEARCHABLE_VALUES"
        # 4. SpecialParamValue.IGNORED if the param is ignored for a specific search point. This is used to ignore
        #    parameters that are only used conditional on other parameters. Such as static quantization parameters
        #    that are only used if the quantization mode is static.
        type_ = Optional[Union[type_, SearchParameter, PassParamDefault, SpecialParamValue]]
        if not disable_search and param_config.search_defaults is not None:
            config[param] = (type_, param_config.search_defaults)
        else:
            config[param] = (type_, param_config.default_value)

    return create_model(f"{pass_type}Config", **config, __base__=BasePassConfig, __validators__=validators)
Create a Pydantic model class from a configuration dictionary.
olive/passes/pass_config.py