fix(gallery): write installed inference defaults under parameters so the loader reads them (#11230) - #11253
Conversation
localai-org-maint-bot
left a comment
There was a problem hiding this comment.
Two blockers before this can merge:
- The new test does not compile against the current PR base. Running
go test ./core/gallery -run TestGallery -count=1fails with:
core/gallery/model_artifacts_inference_defaults_test.go:14:2: no required module provides package github.com/mudler/LocalAI/pkg/modelartifacts
pkg/modelartifacts, gallery.WithArtifactMaterializer, and the shared fakeArtifactMaterializer are not present on current master; they belong to the still-open #11162 work. Please rewrite this regression test against the gallery APIs available on master (the offline file-backed approach in #11232 is one example), or explicitly establish and document the dependency. The fix needs a test that compiles and exercises the current base.
- The PR body says the change was generated with Claude Code, but the commit contains only the human DCO trailer. Per this repository
.agents/ai-coding-assistants.md, please amend the commit with anAssisted-by: Claude:<model-version> [Claude Code]trailer while retaining your ownSigned-off-by:.
…the loader reads them back (mudler#11230) ModelConfig embeds schema.PredictionOptions with `yaml:"parameters"`, so the loader only reads temperature/top_p/top_k/min_p/repeat_penalty/ presence_penalty from the parameters: submap. The gallery installer wrote those family defaults at the top level of the model YAML, where nothing reads them back, leaving every persisted default inert on reload. Merge them into the parameters: submap instead (preserving any values the config already sets there), and add a regression test that installs a qwen3.5 model and asserts the defaults round-trip through the typed loader rather than landing as inert top-level keys. The test is fully offline: the definition declares no files, so no download is attempted. Assisted-by: Claude:claude-opus-4-8 [Claude Code] Signed-off-by: Anai-Guo <antai12232931@outlook.com>
5f39199 to
b743f48
Compare
|
Thanks for the careful review — both blockers addressed in 1. Test no longer depends on unmerged #11162. Rewrote the regression test against the gallery APIs on master: it now builds a 2. Attribution trailer added. Amended the commit to carry
|
localai-org-maint-bot
left a comment
There was a problem hiding this comment.
@mudler This is good to merge now. The contributor removed the unmerged #11162 dependency, added the required AI-assistance trailer, and the revised offline regression test passes against current master (go test ./core/gallery -run TestGallery -count=1 -ginkgo.focus "persists inference defaults under parameters"). The broader gallery suite reached and passed this new spec; its only failures here were three unrelated existing network-backed specs receiving HTTP 403 responses.
What
Gallery installs write the model-family inference defaults (
temperature,top_p,top_k,min_p,repeat_penalty,presence_penalty) into the persisted model YAML as top-level keys:But
config.ModelConfigembedsschema.PredictionOptionswithyaml:"parameters"(core/config/model_config.go), so the loader only reads those fields from theparameters:submap. Every top-level key above is inert — the persisted defaults never take effect on reload.Fixes #11230.
Change
In
InstallModel, merge the applied inference defaults into theparameters:submap of the config map instead of the top level (creating the submap if absent, and preserving any value the config already sets there). The write side now targets the same key the loader reads.Test
Adds a regression test (
core/gallery/model_artifacts_inference_defaults_test.go) that installs aqwen3.5model through the existing offlinefakeArtifactMaterializerpath and asserts the defaults:config.ModelConfigloader (PresencePenalty == 1.5,RepeatPenalty == 1,MinP/Temperaturenon-nil), andparameters:, never at the top level.Before the fix these fields land as top-level keys, so the typed reload sees the zero values and the test fails.
🤖 Generated with Claude Code