Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jaideepr97
Copy link
Member

@jaideepr97 jaideepr97 commented Apr 11, 2025

allow setting a global student and teacher model id in the config, which can be overridden by cmd args

Checklist:

  • Commit Message Formatting: Commit titles and messages follow guidelines in the
    conventional commits.
  • Changelog updated with breaking and/or notable changes for the next minor release.
  • Documentation has been updated, if necessary.
  • Unit tests have been added, if necessary.
  • Functional tests have been added, if necessary.
  • E2E Workflow tests have been added, if necessary.

@mergify mergify bot added the testing Relates to testing label Apr 11, 2025
@jaideepr97 jaideepr97 force-pushed the add-global-model-id branch from e347012 to fffc671 Compare April 11, 2025 14:54
type=click.STRING,
show_default=True,
show_default=False,
config_class="general",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk if you need config_sections if its in the top level of general

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, doesnt seem to be making a difference either way

@mergify mergify bot added the ci-failure PR has at least one CI failure label Apr 11, 2025
@jaideepr97 jaideepr97 force-pushed the add-global-model-id branch from fffc671 to 533ed54 Compare April 11, 2025 15:36
@mergify mergify bot removed the ci-failure PR has at least one CI failure label Apr 11, 2025
@jaideepr97 jaideepr97 marked this pull request as ready for review April 11, 2025 15:38
description="Use legacy IBM Granite chat template (default uses 3.0 Instruct template)",
)
# Global student model id
student_model_id: str | None = Field(
Copy link
Member

@RobotSail RobotSail Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try using typing.NotRequired here, we should see whether this type can allow us to avoid explicitly include this field within the config

Suggested change
student_model_id: str | None = Field(
student_model_id: typing.NotRequired[str] = Field(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaideepr97 I see, thank you for checking this. The way you have done it is perfect

@mergify mergify bot added the ci-failure PR has at least one CI failure label Apr 11, 2025
@jaideepr97 jaideepr97 force-pushed the add-global-model-id branch from 533ed54 to 1484171 Compare April 11, 2025 15:56
@mergify mergify bot added ci-failure PR has at least one CI failure and removed ci-failure PR has at least one CI failure labels Apr 11, 2025
@jaideepr97 jaideepr97 force-pushed the add-global-model-id branch from 1484171 to 68bb5f6 Compare April 11, 2025 18:02
@mergify mergify bot added ci-failure PR has at least one CI failure and removed ci-failure PR has at least one CI failure labels Apr 11, 2025
@mergify
Copy link
Contributor

mergify bot commented Apr 11, 2025

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

@mergify mergify bot added the needs-rebase This Pull Request needs to be rebased label Apr 11, 2025
@jaideepr97 jaideepr97 force-pushed the add-global-model-id branch from 68bb5f6 to 74d3d30 Compare April 11, 2025 22:49
@mergify mergify bot added ci-failure PR has at least one CI failure and removed needs-rebase This Pull Request needs to be rebased ci-failure PR has at least one CI failure labels Apr 11, 2025
@jaideepr97 jaideepr97 force-pushed the add-global-model-id branch from 74d3d30 to e6cc71e Compare April 14, 2025 15:30
@mergify mergify bot removed the ci-failure PR has at least one CI failure label Apr 14, 2025
@mergify mergify bot added the one-approval PR has one approval from a maintainer label Apr 14, 2025
Signed-off-by: Jaideep Rao <[email protected]>
@mergify mergify bot added ci-failure PR has at least one CI failure and removed one-approval PR has one approval from a maintainer ci-failure PR has at least one CI failure labels Apr 14, 2025
@mergify mergify bot merged commit 4273964 into instructlab:main Apr 14, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Relates to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants