Make top-p configurable via .sgptrc (closes #425) - #789
Open
gandzekas wants to merge 1 commit into
Open
Conversation
Make top-p (top-probability / nucleus sampling) configurable via the runtime config file, completing issue TheR1D#425. - Add DEFAULT_TOP_P to DEFAULT_CONFIG (default 1.0, env-overridable) - Wire top_p typer.Option default to cfg.get("DEFAULT_TOP_P") - Document DEFAULT_TEMPERATURE and DEFAULT_TOP_P in README config example Default behavior is unchanged (1.0). Closes TheR1D#425.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: Make
top-p(top-probability) configurable via.sgptrc— closes #425Summary
Issue #425 asks to set a default temperature and top-probability via the
runtime config file (
~/.config/shell_gpt/.sgptrc).DEFAULT_TEMPERATURE).top-pconfig-driven too, via a newDEFAULT_TOP_Pkey. Previouslytop_pwas hardcoded to1.0inapp.py, sothe config file had no effect on it.
Changes
sgpt/config.py— addDEFAULT_TOP_PtoDEFAULT_CONFIG(default1.0,overridable via
DEFAULT_TOP_Penv var, consistent withDEFAULT_TEMPERATURE).sgpt/app.py—top_ptyper.Option default now readscfg.get("DEFAULT_TOP_P")instead of the literal
1.0.README.md— document bothDEFAULT_TEMPERATUREandDEFAULT_TOP_Pin theruntime config example block (temperature was previously undocumented).
Behavior
DEFAULT_TOP_Pdefaults to1.0, identical tothe previous hardcoded value.
DEFAULT_TOP_P=0.9(or any0.0–1.0value) in.sgptrctoapply a default nucleus-sampling probability without passing
--top-pevery run.--top-pon the command line still overrides the config, as before.Verification
python3 -m py_compile sgpt/config.py sgpt/app.pypasses.OPENAI_API_KEY=dummy sgpt-venv/bin/python -m pytest tests/ -q).Test plan for maintainers
sgpt "hello"with no--top-pusesDEFAULT_TOP_Pfrom config (default 1.0).DEFAULT_TOP_P=0.5in.sgptrcchanges the default without flags.--top-p 0.3still overrides the config value.