pick up model id defaults from config yaml#3286
pick up model id defaults from config yaml#3286mergify[bot] merged 2 commits intoinstructlab:mainfrom
Conversation
e347012 to
fffc671
Compare
| type=click.STRING, | ||
| show_default=True, | ||
| show_default=False, | ||
| config_class="general", |
There was a problem hiding this comment.
idk if you need config_sections if its in the top level of general
There was a problem hiding this comment.
hmmm, doesnt seem to be making a difference either way
fffc671 to
533ed54
Compare
| description="Use legacy IBM Granite chat template (default uses 3.0 Instruct template)", | ||
| ) | ||
| # Global student model id | ||
| student_model_id: str | None = Field( |
There was a problem hiding this comment.
Try using typing.NotRequired here, we should see whether this type can allow us to avoid explicitly include this field within the config
| student_model_id: str | None = Field( | |
| student_model_id: typing.NotRequired[str] = Field( |
There was a problem hiding this comment.
Specifically today all config fields will be rendered in the default on-disk config which is super confusing. I want to see if using this type will prevent this field from being listed there entirely until it's necessary.
There was a problem hiding this comment.
i dont think thats compatible with pydantic
The error "`NotRequired[] can be only used in a TypedDict definition`" is occurring because `typing.NotRequired` is being used in a `pydantic` model, which is not allowed. `NotRequired` is specifically designed for use in `TypedDict` definitions, not in `pydantic` models.
In your code, the problematic line is:
teacher_model_id: typing.NotRequired[str] = Field(
default_factory=lambda: None,
description="ID of the teacher model to be used for data generation.",
exclude=True,
)
---
### Why This is Happening
`pydantic` models use `Optional` or `default_factory` to define optional fields. The `NotRequired` type hint is not compatible with `pydantic` models because it is meant for `TypedDict` definitions.
There was a problem hiding this comment.
@jaideepr97 I see, thank you for checking this. The way you have done it is perfect
533ed54 to
1484171
Compare
1484171 to
68bb5f6
Compare
|
This pull request has merge conflicts that must be resolved before it can be merged. @jaideepr97 please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork |
68bb5f6 to
74d3d30
Compare
Signed-off-by: Jaideep Rao <[email protected]>
74d3d30 to
e6cc71e
Compare
Signed-off-by: Jaideep Rao <[email protected]>
allow setting a global student and teacher model id in the config, which can be overridden by cmd args
Checklist:
conventional commits.