Problem
When using target_modules: all in a YAML config, bakery fails with:
ValueError: Target modules all not found in the base model.
The LoraConfig.target_modules field is typed as List[str], so YAML scalar all gets parsed as the string "all" and passed directly to PEFT, which doesn't recognize it.
Expected behavior
target_modules: all (or target_modules: all-linear) in YAML should work and map to PEFT's "all-linear" string, which targets all linear layers.
Suggested fix
In config.py, add a __post_init__ to LoraConfig that normalizes the value:
def __post_init__(self):
if self.target_modules == "all" or self.target_modules == ["all"]:
self.target_modules = "all-linear"
elif self.target_modules == ["all-linear"]:
self.target_modules = "all-linear"
The type annotation may also need to accept Optional[Union[str, List[str]]] or similar to handle both forms from HfArgumentParser.
Workaround
Use a list with the PEFT-recognized string:
target_modules:
- all-linear
Problem
When using
target_modules: allin a YAML config, bakery fails with:The
LoraConfig.target_modulesfield is typed asList[str], so YAML scalarallgets parsed as the string"all"and passed directly to PEFT, which doesn't recognize it.Expected behavior
target_modules: all(ortarget_modules: all-linear) in YAML should work and map to PEFT's"all-linear"string, which targets all linear layers.Suggested fix
In
config.py, add a__post_init__toLoraConfigthat normalizes the value:The type annotation may also need to accept
Optional[Union[str, List[str]]]or similar to handle both forms from HfArgumentParser.Workaround
Use a list with the PEFT-recognized string: