Repository navigation
fix(core): the active model keeps its LoRA across a restart; ModelFileType.gguf - #649
Merged
Merged
Conversation
The persisted identity named the model file only, so a restart restored the model without its LoRA: it loaded with no adapter and no error, and a connector reading spec.loraSource (llama.cpp, #628) found none. Mobile and web now persist the LoRA's filename and source with the model and restore it as loraSource. A LoRA whose file is gone restores nothing, the way a missing model file does, rather than the model without it. Identities written before this have no LoRA field and restore as before.
A GGUF had to be declared as binary, which MediaPipe also claims at the same priority, so registration order decided which engine loaded it, and an engine could tell it apart only by the file name. Every other engine is selected by its declared file type alone. gguf: the chat template is the file's own (llama.cpp applies it), so transformToChatPrompt passes messages through raw; replies are cleaned as a binary's are, so a trailing end-of-turn marker a template renders as text is stripped. MediaPipe does not claim it.
…aims GGUF files Without it the storage scan behind getStorageInfo, getOrphanedFiles and cleanupStorage filtered GGUF files out: a multi-GB model went uncounted and an orphaned one could not be reclaimed. Found by Codex.
9 of 11 tasks
…-gguf # Conflicts: # AGENTS.md
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.
Two core gaps that #628 (llama.cpp through llamadart) has to work around today.
The active model keeps its LoRA across a restart
The persisted active identity named the model file only. After a restart core restored the model without its LoRA: it loaded with no adapter and no error, and a connector that reads
spec.loraSourcefound none. #628 documents it: "Core does not persist the inference LoRA companion in its restart identity".Mobile and web now persist the LoRA's filename and encoded source next to the model's (
PreferencesKeys.activeInferenceLoraFilename/activeInferenceLoraSource, in the same one-key identity record) and restore it asloraSource. A LoRA whose file is gone restores nothing, the way a missing model file does, rather than the model without it. Identities written before this carry no LoRA field and restore as they did.ModelFileType.ggufA GGUF had to be declared as
binary, which MediaPipe also claims at priority 0, so registration order decided which engine loaded it, and the connector told it apart by the file name. Withggufan engine is chosen by the declared type alone, as every other one is; MediaPipe does not claim it.litertlmandonnx— llama.cpp applies the template stored in the file.binary. llama.cpp stops before the end-of-turn token, but a template that renders it as text must not reach the user, andbinaryis what the connector gets today..ggufjoinsFileNameUtils.supportedExtensions(found by Codex): without it the storage scan behindgetStorageInfo,getOrphanedFilesandcleanupStoragefiltered GGUF files out, so a multi-GB model went uncounted and an orphaned one could not be reclaimed.model__adapter.gguf, notmodel.gguf__adapter.gguf. Only the unpublished connector in feat: add llama.cpp inference through llamadart #628 installs GGUF with a LoRA today.switchoverModelFileTypein an app; nothing in this repo has one.AGENTS.md,
docs/models.mdanddocs/packages.mdlist it.Tests
file_source_restore_test.dart: a model installed with a LoRA has it after a restart, with the same file names and paths, and is installed; a model whose LoRA file is gone restores nothing; a model without one restores without one. 41/41.web_identity_write_atomicity_test.dart(Chrome): the same two cases after a page reload. 19/19. CI does not run browser tests.gguf_file_type_test.dart: raw prompt for five families, systemInfo dropped, the tool-response wrapper kept; reply trimmed, a trailing<end_of_turn>/<|im_end|>stripped, a marker mid-text kept. 10/10.getStorageInfocounts a.gguffile in core's directory;file_name_utils_test.dartcovers the extension..gguffrom the extensions each turn a test red.flutter analyze packages/: 0 errors, 0 warnings.dart tool/check_skills.dartandskills_lint: clean.tool/test_all.sh: all packages pass;flutter_edge_ai_onnxandflutter_edge_ai_speechfailed once in the full run under load and pass on their own (144/144, 308/308) — the worker-test flakiness test: worker tests survive CPU load — no fsync in fake logs, clock-free notice tests, bounded reset test #644 addresses.