Skip to content

docs(sampling): clarify that sampler override presets resolve from the working directory (#419)#435

Open
Anai-Guo wants to merge 1 commit into
theroyallab:mainfrom
Anai-Guo:docs/clarify-sampler-override-lookup-419
Open

docs(sampling): clarify that sampler override presets resolve from the working directory (#419)#435
Anai-Guo wants to merge 1 commit into
theroyallab:mainfrom
Anai-Guo:docs/clarify-sampler-override-lookup-419

Conversation

@Anai-Guo

Copy link
Copy Markdown

Fixes #419.

Problem

sampler_override / override_preset takes a preset name, which overrides_from_file() turns into the relative path sampler_overrides/<name>.yml. A relative path resolves against the process's current working directory, so the folder that actually gets searched is the one you launched TabbyAPI from — not the one next to the TabbyAPI source.

Nothing in the docstrings, the config description, config_sample.yml, or the docs said this, and the failure message did not help either:

Sampler override file named "X" was not found. Make sure it's located in the sampler_overrides folder.

Which sampler_overrides folder? The one shipped in the repo has the preset in it, so from the user's side this reads as a bug rather than a working-directory mismatch (see #419 and turboderp-org/exllamav3#199).

Change

No behaviour change — this is the "adjust the docstring to make it clear how the search happens" option from the issue.

  • Hoist the lookup directory into a SAMPLER_OVERRIDES_DIR constant with a comment explaining the relative-path semantics, and use it from both overrides_from_file() and get_all_presets() (they previously spelled "sampler_overrides" out separately).
  • Make the not-found error name the resolved path it tried and the current working directory, so the mismatch is visible from the message alone.
  • State in the two docstrings, the override_preset config description, config_sample.yml, and docs/02 + docs/08 that the value is a preset name rather than a path, resolved relative to the launch directory.

While there, the config description and config_sample.yml both said "sampler-overrides folder"; the folder is sampler_overrides.

The issue also floated dropping the name→path transformation and accepting a full path instead. I left that alone since it changes existing configs — happy to follow up if you'd prefer that direction.

Verification

ruff format --diff and ruff check clean with the pinned ruff == 0.11.10 against the repo's pyproject.toml.

🤖 Generated with Claude Code

…e CWD (theroyallab#419)

The sampler override preset name is turned into the relative path
`sampler_overrides/<name>.yml`, so it is resolved against the process's
current working directory rather than the TabbyAPI install directory.
Nothing said that, and the "Make sure it's located in the
sampler_overrides folder" error did not say which sampler_overrides
folder was searched, so launching TabbyAPI from another directory looked
like a missing-file bug.

- Hoist the lookup directory into a documented SAMPLER_OVERRIDES_DIR
  constant shared by overrides_from_file() and get_all_presets().
- Report the resolved path and the current working directory in the
  not-found error.
- Say in the docstrings, the config description, config_sample.yml, and
  the docs that the value is a preset name (not a path) resolved relative
  to the launch directory.

No behaviour change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REQUEST] Clarify sampler override file search mechanism

1 participant