Spaces:
Running
config.py patch
https://huggingface.co/spaces/Naphula/model_tools/blob/main/config.py
This custom config.py patch extends MergeKit's configuration system to support string and boolean parameter values in addition to the existing numeric and gradient list support.
Key Changes
Extended Type Definitions
The patch modifies the type aliases to include additional primitive types:
ScalarOrGradientnow includesstrandbooltypes alongsidefloatandList[float]ParameterSettingalso includesstras a valid parameter type
Enhanced Parameter Evaluation
The evaluate_setting function is updated to handle these new types:
- Direct return for
strandboolvalues (line 29-30) - Support for lists containing mixed types including
strandbool(line 39-40) - The function maintains backward compatibility with existing numeric and gradient interpolation logic
Impact
This patch allows MergeKit configurations to use:
- String parameters for categorical settings
- Boolean parameters for toggle/flag settings
- Mixed-type lists for more complex parameter definitions
The change maintains full backward compatibility with existing numeric and gradient-based parameter systems while adding flexibility for non-numeric configuration options.
Notes
The rest of the configuration system remains unchanged - all the Pydantic models, validation logic, and the ConfigReader class work with these extended parameter types seamlessly. This is a targeted enhancement to the type system and parameter evaluation logic only.