Skip to content

fix: reload model after editing YAML config (issue #8647)#8652

Merged
mudler merged 1 commit into
mudler:masterfrom
localai-bot:fix/issue-8647-reload-model-config
Feb 25, 2026
Merged

fix: reload model after editing YAML config (issue #8647)#8652
mudler merged 1 commit into
mudler:masterfrom
localai-bot:fix/issue-8647-reload-model-config

Conversation

@localai-bot

Copy link
Copy Markdown
Collaborator

Description

When changing context_size (or other runtime settings) in the YAML Configuration Editor via the frontend, the change was saved to the file but not applied to the running model. The model needed to be manually restarted for the new configuration to take effect.

Root Cause

The EditModelEndpoint function:

  1. Writes the new YAML configuration to the file
  2. Reloads the model configurations from disk
  3. Calls Preload() - but this only handles downloading/verifying model files, NOT unloading/reloading the actual loaded model processes

The context_size is set when the backend process (llama.cpp, gpt4all, etc.) starts, so changing the YAML doesn't affect the already-loaded backend.

Solution

  • Add *model.ModelLoader parameter to EditModelEndpoint function
  • After saving the YAML config and reloading, call ml.ShutdownModel(modelName) to unload the running model from memory
  • On the next inference request, the model will reload with the new configuration

Closes #8647

@netlify

netlify Bot commented Feb 25, 2026

Copy link
Copy Markdown

Deploy Preview for localai ready!

Name Link
🔨 Latest commit 515eea8
🔍 Latest deploy log https://app.netlify.com/projects/localai/deploys/699f36a09ad7db000872b383
😎 Deploy Preview https://deploy-preview-8652--localai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

- Add *model.ModelLoader parameter to EditModelEndpoint
- Call ml.ShutdownModel() after saving config to unload the running model
- Model will be reloaded on next inference request with new settings (e.g., context_size)
- Update route registration to pass ml to EditModelEndpoint

Signed-off-by: localai-bot <localai-bot@users.noreply.github.com>
@localai-bot localai-bot force-pushed the fix/issue-8647-reload-model-config branch from da7d6bd to 515eea8 Compare February 25, 2026 17:51
@localai-bot

Copy link
Copy Markdown
Collaborator Author

I have added the required DCO sign-off to address the CI failure. The changes are now ready for re-review.

@mudler mudler marked this pull request as ready for review February 25, 2026 20:53
@mudler mudler merged commit 1027c48 into mudler:master Feb 25, 2026
37 of 38 checks passed
@mudler mudler added the bug Something isn't working label Mar 14, 2026
localai-bot added a commit to localai-bot/LocalAI that referenced this pull request Mar 25, 2026
…er#8652)

fix: reload model configuration after editing (issue mudler#8647)

- Add *model.ModelLoader parameter to EditModelEndpoint
- Call ml.ShutdownModel() after saving config to unload the running model
- Model will be reloaded on next inference request with new settings (e.g., context_size)
- Update route registration to pass ml to EditModelEndpoint

Signed-off-by: localai-bot <localai-bot@users.noreply.github.com>
Co-authored-by: localai-bot <localai-bot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing context_size in YAML Configuration Editor requires restarting

2 participants