Repository navigation
#174 Context window is advertised in OpenAI chat server. - #183
Conversation
|
Thanks for the pr and apologies on late feedback. I had GLM-5.3 flash spin up a one liner to recursively parse all 92 models on disk to see what was in their config.json: Basically we only need I am also thinking this feature should be opt in only, as if we set context_window to the max any client that reads it will assume a larger context than available which might not solve the issue in the first place. I would really love a way to actually count tokens per model and get a concrete size based on whats actually available that would print when loading the model into openarc server instead of trying to guess and the set that as the max... but this wont be possible without an upstream change or we roll our own runtime, I think. What do you think? @ecky-l |
|
Hi @SearchSavior ,
Hm, isn't that just basically a
Yes true. I had this idea just from inspecting the sources of OVMS. I don't know if the other parameters ("n_positions", "seq_len", "seq_length", "n_ctx", "sliding_window") are used and in which context - just thought they might know it better than me, so it cannot hurt to read them as well. And one more thing I found out meanwhile: This means, even if you could, memory wise, increase the
Yes true, but I think the other case, a --context-window larger than max_position_embeddings, is more dangerous. Regarding the other way around (
Yes that would be nice. It would at least give clear indications for the danger of a runtime OOM, when less VRAM space is available than is required for the context_window (whatever value is set there). Maybe this value could be calculated somehow from the actual, current VRAM usage... but as of now I don't even get the current VRAM usage reported from the card driver at all. Hopefully this will change with a future driver version or (firmware upgrade). |
|
I am not very keen on the other model parameters to read from the config ("n_positions", "seq_len", "seq_length", "n_ctx", "sliding_window"). I think they cannot hurt, but many could as well live without them. Do you want me to remove them? Also, do you think we could merge this PR soon? My other work on running the models in worker subprocesses has moved on and I got it finished (even works on windows now). The changes are in my main branch, but the commits are based on the one we have here. I would like to create a new PR that substitutes #182 for you to review, but it would have the changes from here as well... |
|
@ecky-l "n_positions", "seq_len", "seq_length", "n_ctx", "sliding_window" most of these are not applicable to the language models this change covers. For example Ok, make it opt in, and check the provided value against max_position_embeddings and only advertise context_window when its set by the user checked against the upper limit. This is what we should do for now and ill merge once those changes are in. Anyway thanks for being so thoughtful in your approach, have you considered joining us on discord? I have looked at the sub process pr but have been busy lately, will give you some notes tonight! |
|
Hi @SearchSavior ,
Ok, I'll remove them from the auto-detection. Makes it simpler in the end.
Sounds like it doesn't make sense to advertise them as well as "context_window" in the /v1/models endpoint. So they should also be removed, right?
A complete opt-in would mean that no "context_window" or "meta.n_ctx" is advertised at all, unless the --context-window parameter is configured. And I will arrange that a WARNING is displayed if the configured --context-window is higher than the max_position_embeddings.
Not yet... I don't have a discord account yet :D. But I could create one... lets see.
Well, the subprocess PR is currently rather outdated, because I have driven the development on the main branch of my fork. I will update it asap, meanwhile you could create a "git diff" on your own between the two remotes, or clone my fork and try it out. Anyway I have to admit that there are quite a lot of changes... |
Taken from the model's config.json, or from the override context_window in config.yaml (set via the --context-window parameter)
982cb88 to
35eeb5d
Compare
…r using max_position_embedding And warning, when configured --context-window is larger than max_position_embeddings.
|
Now both branches for the two PRs are up to date, @SearchSavior |
New PR for context_window, taken from the model's config.json, or from the override context_window in config.yaml (set via the --context-window parameter).
The context_window is only advertised in
/v1/modelsfor clients to size their conversations, i.e. executing an auto-compact, when the limit is about to be hit.