-
Notifications
You must be signed in to change notification settings - Fork 450
Adds support for simple global/general model configuration #3197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cdoern
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few preliminary comments
| "-dt", "--detached", is_flag=True, help="Run ilab data generate in the background" | ||
| ) | ||
| @click.option( | ||
| "--student-model-id", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so with the new:
cls=clickext.ConfigOption,
config_class="command_name",
config_sections="sub_class_in_other_command_class",
)
structure, you can point to defaults from elsewhere in the cfg. I'd set the default for all of these to the model_path from the train cfg for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i think thats a good idea
after speaking with @RobotSail we decided to keep the first PR fairly barebones so that this logic at least gets in
I have plans to work on a follow up PR where among other things, all the model references in the config are updated to be ids instead of paths and then it would make sense to wire the click defaults up the way you suggested
src/instructlab/model/chat.py
Outdated
| logs_dir, | ||
| vi_mode, | ||
| visible_overflow, | ||
| models: List[cfg._model_config], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmmm, so it would be preferable to keep config class types out of the model pkg since its a "cli" only related structure.
but if its not possible that's fine. Could we resolve the model before getting down into this file and just pass it in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cdoern This is just so we can do type-checking. How can we structure it so we can reuse the types later throughout the library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could move things around so that we have a dedicated place for datatypes that can be used everywhere so it doesnt feel like a front end construct is "bleeding into" the backend in a follow up PR maybe
would that be better @cdoern?
| models: List[_model_config] = Field( | ||
| default_factory=lambda: [], | ||
| description="User-defined custom set of models. This allows people to use their own models for the InstructLab model customization process.", | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, I not sure about the purpose and may not understand correctly, based on the code, user defined models, and then need to specify the model id in the models?
why not just specify the model id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reidliu41 Not sure if I follow your question
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reidliu41 it would look something like
chat: ...
generate: ...
models:
- id: 'ibm/granite-7b-lab'
path: <local/hf path>
ctx_size: 4096
- id: ...
and then the long term goal would be to have model references in other sections (like in chat.model or generate.model) start pointing to these model ids instead of having the path directly so we can centralize all the model info in one place for a given model
67d4fb2 to
22af5e7
Compare
Signed-off-by: Jaideep Rao <[email protected]>
Signed-off-by: Jaideep Rao <[email protected]>
22af5e7 to
b3146a9
Compare
b3146a9 to
61478cc
Compare
61478cc to
a06b32f
Compare
Signed-off-by: Jaideep Rao <[email protected]>
a06b32f to
48dc384
Compare
RobotSail
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaideepr97 This looks good! I just have 2 very short comments, but otherwise it should be good to go.
Signed-off-by: Oleg <[email protected]>
cdoern
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comments on defaults specifically, looks good so far
| @click.option( | ||
| "--student-model-id", | ||
| # help="ID of the custom model you want to use as the student model.", | ||
| default=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want this to default to the model in the train part of the cfg or are we getting rid of those defaults?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to leave this blank for now.
| show_default=True, | ||
| ) | ||
| @click.option( | ||
| "--teacher-model-id", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here for default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cdoern We should leave it blank for now and figure out the best way for this later.
| system_prompt = get_sysprompt(student_model_arch) | ||
| system_prompt, legacy_pretraining_format = None, None | ||
| if not student_model_id: | ||
| student_model_path = pathlib.Path(ctx.obj.config.train.model_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this can be the default in the flag using config_class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please avoid this for now? I would like to leave it as something where it's merely a lookup for models in the config, rather than something with a known default that will be referenced in the existing system. This way we can keep the logic simple and change it later as needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not quite - this default is a path, not a model id yet
the way im imagining it, if we dont have to care about breaking changes as such we can rename all the model_path fields to either model_id or just model and have them reference model ids instead of paths. Until we do that, setting defaults in the click flags wont achieve much
| required=True, # default from config | ||
| ) | ||
| @click.option( | ||
| "--base-model-id", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default from cfg?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave it blank to keep logic simple
| type=click.STRING, | ||
| ) | ||
| @click.option( | ||
| "--judge-model-id", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should be leaving it blank to keep it simple
| system_prompt (str | None): The initial message used to prompt the conversation with this model. | ||
| """ | ||
|
|
||
| id: str = Field( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default_factory for these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and default for id is missing even if None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be a user-specified field for now, we shouldn't have a default here.
Signed-off-by: Jaideep Rao <[email protected]>
003898e to
88bd0d0
Compare
Checklist:
conventional commits.