-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Don't allow zero as temperature in ModelSettings.qml #2777
Conversation
A number lower than 0.000001 is set to that value instead. Signed-off-by: Cosmic Snow <[email protected]>
- Using .toLocaleString() gets rid of the scientific notation display - Setting TextField's text when correcting the value fixes flakiness Signed-off-by: Cosmic Snow <[email protected]>
Second commit improves points 2 & 3 from the notes. The improved behaviour uses Edit: Parsing might need some changes with different locales, too. Edit 2: Turns out you're using |
Signed-off-by: Cosmic Snow <[email protected]>
- make validator locale-aware - do locale processing everywhere a conversion between double and string happens - Qt's `Number.toLocaleString()` with a string as locale is buggy; use its extension instead Signed-off-by: Cosmic Snow <[email protected]>
Signed-off-by: Cosmic Snow <[email protected]>
Should be good now, apart from a minor cosmetic glitch (rare corner case). I tested it by adding to: Lines 53 to 54 in 6b8e0f7
on line 54: QLocale::setDefault(QLocale("de_DE")); Try to break it, hope these should not be possible anymore:
Although note: this is not hooked up to translation dropdown/locale changes. That would be the next thing to work on for all input fields which need to be locale-aware. |
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.
I am hesitant to disable functionality of built-in and custom OpenAI models, and to add llama.cpp-specific assumptions to the UI, just to avoid branching to the built-in llama_sample_token_greedy when the temperature is zero here. I think this problem can actually be properly fixed in fewer lines of code than this workaround.
@cebtenzzre Just to be clear, part of this is also making the UI input locale-aware (decimal separator can vary). The primary goal here was to fix a bug: there's a division by zero, which is getting hit right now in the backend (oddly seems to only throw off debug builds, but that's my builds). Greedy sampling with temp 0 was once possible in GPT4All (sometime last year), I don't know when exactly that changed. I am not at all opposed to removing the limit again if/once there's a fix for that in the backend -- actually, I am very much in favour of being allowed to set it to 0. |
That's appreciated. If you'd like to make a PR or change this one such that all four instances of parseFloat in ModelSettings.qml are replaced with something locale-aware, that'd be great.
But only llama.cpp divides by zero, because of a missing branch. We are actively working (#2806) towards having first-class support for backends other than llamamodel.cpp, so I feel like adding more llamamodel-specific assumptions to the UI code is a step in the wrong direction. Both ollama and OpenAI support temp=0.
Okay, done: #2854 |
Yes, that was the idea after this one. Although there may be one other thing to consider: In this PR (and probably the next) I had to remove the direct connection in the QML ( An alternative would be to have the model be "more closely aligned" with the UI and do the conversions in C++ instead of JS. In any case, with merging of #2854 this PR is now obsolete. |
That shouldn't be a problem, since the binding is removed once onTemperatureChanged or onCurrentModelInfoChanged fires anyway. As long as the value is never initially blank—in which case, you may need a |
Describe your changes
A number lower than 0.000001 is set to that value instead.
Issue ticket number and link
N/A
Checklist before requesting a review
Demo
Editing:
After edit:
Steps to Reproduce
Right now, setting temperature to zero is allowed, but it shouldn't be.
Notes
This PR is meant to be seen as a suggestion for now.I'm setting this as draftfor the following reasons:I think it prevents setting zero as a value, but it seems to be flaky in the UI regardless (e.g. when I Alt-Tab).I have not figured out how to get rid of the scientific notation after it corrects itself.