feat: add serve config for teacher model in ilab data generate - #1777
Conversation
|
Adding the |
3f9d799 to
ab070ae
Compare
leseb
left a comment
There was a problem hiding this comment.
The change looks ok to me but I'm missing some context. Can you explain how is configured the teacher model? Thanks
|
I guess I just don’t feel this is necessary. Here’s how I think about it: something has to go in the serve config. What is the majority use case that is fair to expect should be in there? My thought: the teacher model config. An alternative answer to that could be “the target model to be trained, for use with ilab chat to test model behavior.” Is the latter what you were thinking? I’ll also say that I don’t like “general inference use cases” as an answer here because I don’t think using ilab makes much sense for that vs running vllm directly (via systemd). I’m not sure what value ilab provides in that case. |
|
@leseb The teacher model can be a separate model that specializes just generating the data from the taxonomy. One model you could use for example is Mixtral. This is similar to how we have a judge model just for MT-Bench in evaluation. The model is prometheus. The teacher model could have it's own set of configuration, ex: |
The alternative answer along with inference use cases is what I was thinking. Here's how I see the entire ilab workflow along with when models are served:
As I mentioned above I think since the teacher model can be viewed as something static similar to the judge model, that's a good reason for it to have it's own config in the @leseb @n1hility do you have anything to add about the inference use case? |
|
OK - I buy that the base model is a better thing to assume stays in the base serve config. Thanks. |
| return get_api_base(self.host_port) | ||
|
|
||
|
|
||
| class _generate(BaseModel): |
There was a problem hiding this comment.
any reason you needed to move this? It makes it harder to see what actually changed.
If you feel it needs to move, I would generally recommend doing that type of refactoring in a dedicated commit that includes no functional changes. That way you can still see the real code changes in the commit series.
There was a problem hiding this comment.
I moved it below the _serve classes because those need to be declared first in order for _generate to have a member of that type. Without this move I get a NameError whenever ilab is invoked.
I wish I didn't have to move the class, but the only thing that has changed in the _generate class is just the addition of the teacher_serve_config variable.
There was a problem hiding this comment.
I think you can reference via string, as described here
class Foo(BaseModel):
bar: 'Bar'
class Bar(BaseModel):
pass
(though I'm fine with the class being moved too)
| taxonomy_base: StrictStr | ||
|
|
||
| # additional fields with defaults | ||
| teacher_serve_config: _serve |
There was a problem hiding this comment.
Can you please look into backwards compatibility? I haven't tested this, but I'm guessing that old configs will be broken by this?
My preference would be to use the default serve config if it is not specified in this section.
There was a problem hiding this comment.
The addition of this in the _serve config would not make the data generate command able to work with older configs. Especially since the code change I made in generate.py now expects the teacher_serve_config.
Backwards compatibility within the older config wasn't something I considered when I made this PR simply because I thought there have been so many changes to the config that we're not expecting the older configs to be fowards compatible.
It's for this reason I think #1749 should include a check that causes ilab to error out if a config doesn't have the version field.
What I could do is add a check in generate.py to see if the config has the teacher_serve_config section in the generate section and if it doesn't fall back to using the serve section of the config. How does that sound?
There was a problem hiding this comment.
That config versioning PR merged (#1749) -- are you planning to update this PR to bump the version in some way?
There was a problem hiding this comment.
My understanding is that the config version if for the release and not meant to be changed between PRs before v0.18.0.
This is not meant to be a take on when the config version should be changed, just that it should not be changed before the v0.18.0 release.
| taxonomy_path: StrictStr | ||
| taxonomy_base: StrictStr | ||
|
|
||
| # additional fields with defaults |
There was a problem hiding this comment.
The new section doesn't seem to have a default value set in the model. Should it be defined elsewhere, so that this comment doesn't apply to it? (But see below.)
| taxonomy_base: StrictStr | ||
|
|
||
| # additional fields with defaults | ||
| teacher_serve_config: _serve |
There was a problem hiding this comment.
IMO the name for the new section is not ideal. I don't think it should have _config suffix (it's redundant - the context here is well known already). Perhaps even the _serve mid-prefix could also be dropped, to simplify the name even more. What exactly does it communicate to the user beyond what teacher name could already do?
| model=DEFAULTS.DEFAULT_MODEL, | ||
| taxonomy_path=DEFAULTS.TAXONOMY_DIR, | ||
| taxonomy_base=DEFAULTS.TAXONOMY_BASE, | ||
| teacher_serve_config=_serve( |
There was a problem hiding this comment.
The default section seems to be identical to what is used for serve section. I suggest to avoid the duplication of the code here and in lines 413+: put the default value for both sections in a variable, then refer from both locations.
(That said, I think these defaults belong to the model spec, see above.)
| taxonomy_base: StrictStr | ||
|
|
||
| # additional fields with defaults | ||
| teacher_serve_config: _serve |
There was a problem hiding this comment.
I think you could specify a default value for the field, and make all the nested models provide reasonable defaults; then you wouldn't need to pass the teacher argument below in get_default_config. To see what I mean, refer to: https://gist.github.com/booxter/e1332bbe3a5344ee217409d133a13776
I believe this will tackle the backwards compatibility concern by Russell too.
ab070ae to
fe85b64
Compare
fe85b64 to
fc46dd4
Compare
fc46dd4 to
bbcdd17
Compare
bbcdd17 to
bbd8824
Compare
|
Note: the last patch should be squashed before merging. |
bbd8824 to
710190a
Compare
|
@booxter Ran the branch by hand, and serving worked as expected. I've removed the hold label. |
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Ali Maredia <amaredia@redhat.com>
Passing this flag ensures that the stdout and stderr of vLLM will be output when ilab data generate is run. This is useful for debugging purposes. Signed-off-by: Ali Maredia <amaredia@redhat.com>
If the teacher section is not included in the config.yaml and read by ilab, the value of ctx.obj.generate.teacher is set to the default value of teacher in _generate. Signed-off-by: Ali Maredia <amaredia@redhat.com>
0c21abc to
6e05cfa
Compare
My preference would be to adopt more disciplined handling of config file changes instead of waiting until some point in the future since I don't think it's a ton of extra work. However, I will just bow out of this review so I'm not blocking anything.
booxter
left a comment
There was a problem hiding this comment.
Thank you for quick respin.
| chunk_word_count: PositiveInt = DEFAULTS.CHUNK_WORD_COUNT | ||
| # DEPRECATED: see sdg_scale_factor instead | ||
| # Left in place so that we can still detect and give a warning if its | ||
| # specified in an old configuraiton file. |
- Add entry for --enable-serving-output flag for ilab data generate - Add entry for new teacher section in the generate section of the config Signed-off-by: Ali Maredia <amaredia@redhat.com>
6e05cfa to
e6744d2
Compare
|
@russellb could you approve this PR so it merges? |
| default=-1, deprecated="see 'sdg_scale_factor' instead", exclude=True | ||
| ) | ||
| sdg_scale_factor: Optional[PositiveInt] = DEFAULTS.SDG_SCALE_FACTOR | ||
| output_dir: StrictStr = Field(default_factory=lambda: DEFAULTS.DATASETS_DIR) |
There was a problem hiding this comment.
You can remove these Fields as they were previously used to prevent the config values from being cached before we ran tests. Nowadays, each test will reset the home directories to point to the temporary path fixture.
| output_dir: StrictStr = Field(default_factory=lambda: DEFAULTS.DATASETS_DIR) | |
| output_dir: StrictStr = DEFAULTS.DATASETS_DIR |
There was a problem hiding this comment.
@RobotSail The entire _generate section was moved in this PR, and one addition was made, the addition of the teacher member.
The line you mentioned is the same as what's in main here (https://github.com/instructlab/instructlab/blob/main/src/instructlab/configuration.py#L266). To keep the scope of this PR focused I'd prefer to open up a follow up PR with that change, and possibly changes to any other variables in this section.
There was a problem hiding this comment.
Makes sense, let's approve this then and then fix it later.
RobotSail
left a comment
There was a problem hiding this comment.
I have one comment but once that's addressed we can merge this.
Currently
ilab data generateuses the configuration from theservesection of configuration file to serve the teacher model in the background.In the case where a user is using a specific model only as the teacher model, the user would have to edit the
servesection of the config with the teacher model's settings.Since the teacher model and it's configuration is static, and the serve section is dynamic, the teacher model and it's configuration should live in the
generatesection of the configuration.Giving the teacher model it's own configuration section also prevents the user from accidentally serving the teacher model, if they have not changed the
servesection.This PR is meant to be a starting point. Further work should evolve the configuration of the teacher model in
ilab data generateto be similar to how theilab model evaluatecommand configures the judge model for MT-Bench.This PR also includes a commit that adds the
--enable-serving-outputflag toilab data generate. This flag serves the same purpose as it does inilab model evaluate.Checklist:
conventional commits.