Repository navigation
Unsloth Studio: train and export LFM3-Audio-2B (LoRA, merged 16-bit, GGUF) - #16973
Conversation
An audio_vlm model with no vision tower (LFM3-Audio-2B) loaded for training through the default FastModel class, which builds the bare Lfm3AudioModel with no LM head and returns a tokenizer, so the first batch failed with "TokenizersBackend has no attribute tokenizer". It now loads through AutoModelForMultimodalLM, the same rule Chat uses, and gets its processor. The audio VLM collator also masks placeholder ids the processor holds (LFM3-Audio's audio_token_id), not only the tokenizer's (Gemma 3n).
Export loaded an audio_vlm checkpoint without vision on the text path, the bare Lfm3AudioModel with no LM head and no processor, so the merged and LoRA exports could not carry the feature extractor or audio tokenizer. It now loads through AutoModelForMultimodalLM like Training and Chat.
llama.cpp converts LFM3-Audio (ggml-org/llama.cpp#31257) only from the release config.json layout (lfm / encoder / depthformer), matched by an hparams loader. The checkpoint's remote config class saves text_config / audio_encoder_config / depth_config instead, so a merged LFM3-Audio failed with "Model Lfm3AudioForConditionalGeneration is not supported". A LoRA merge leaves the config as released, so the GGUF conversion now reads the base's own config.json; resized embeddings keep the saved one.
The base config lookup resolved config.json at the repo's default revision, so a base loaded from another revision could hand the converter a config from a different commit. The loaded config's _commit_hash now pins it.
…sion probe is_vision_model reads a transient probe failure as False, so an image-capable audio VLM (Gemma 3n / 4, LFM3-Omni) could have been sent to AutoModelForMultimodalLM by a flaky read. Training and export now ask is_vision_model_checked before leaving the default load, and an inconclusive answer keeps it.
|
Codex review on the fork mirror (LeoBorcherding#783) found no major issues at |
…dio takes the multimodal load The sidecar AutoConfig probe can't run LFM3-Audio's repo code, so is_vision_model_checked answered unknown on every load and training and export fell back to the bare backbone.
…t is 26.04 (#16987) ## Summary `Chat UI Tests (chat)` and `Loaded-models indicator (cross-browser)` are red on main (run 42338613438) and on #16986, #16984 and #16973, all in the same step: ``` Image: ubuntu-26.04 Version: 20261101.186.1 ... engines that will not start: webkit: TargetClosedError system libraries are missing, installing them ... engines that will not start: webkit: TargetClosedError ##[error]Process completed with exit code 1. ``` `ubuntu-latest` is being moved to the ubuntu-26.04 image. Playwright 1.64.1's WebKit build exits at launch there, and `playwright install-deps` does not fix it, so the browser probe in "Install Playwright browsers" fails before any test runs. Chromium and Firefox start fine. The last green runs of the same jobs ran on ubuntu-24.04 (for example 42319231838, 42313662909, 42311916438, all today), so the image is the only thing that changed. As the rollout reaches more jobs, every Linux job that drives WebKit will hit this. ## Change - `studio-ui-smoke.yml`: `ui-smoke` (Chat UI Tests) and `ui-indicator` (Loaded-models indicator) run on `ubuntu-24.04`. - `studio-composer-compatibility.yml` and `studio-inline-images.yml`: the `ubuntu-latest` matrix leg runs on `ubuntu-24.04` through `runs-on: ${{ matrix.os == 'ubuntu-latest' && 'ubuntu-24.04' || matrix.os }}`. The matrix value is unchanged, so the check names (`Composer (ubuntu-latest, browsers)`, `Inline images (ubuntu-latest)`) stay the same; macOS and Windows legs are untouched. - Each pin carries a comment to move back once WebKit starts on 26.04. - `tests/studio/test_webkit_jobs_skip_ubuntu_latest.py`: finds every workflow job whose steps or matrix mention WebKit, resolves the images it lands on (a plain `runs-on`, `matrix.os`, or the mapped form above), and fails if any of them is `ubuntu-latest`. A job counts when its steps or matrix mention Playwright and `webkit` as a whole word, so a file name like this test's does not. It also checks it still sees the four jobs above, so it cannot pass by finding nothing. - `workflow-trigger-lint.yml`: the new guard runs in that job too, since it is the one job without a paths filter (`test_workflow_guards_run_unfiltered.py` requires this of every workflow-reading guard), so a PR that only edits workflows still meets it. ## Testing | | guard test | |---|---| | this branch | passes | | main's three workflow files with this test | fails, naming `studio-composer-compatibility.yml::composer`, `studio-inline-images.yml::images`, `studio-ui-smoke.yml::ui-smoke`, `studio-ui-smoke.yml::ui-indicator` | The new test plus `tests/studio/test_workflow_guards_run_unfiltered.py`, `test_ui_shard_engines.py`, `test_indicator_browsers_run_in_parallel.py`, `test_playwright_suites_run_in_ci.py`, `test_chat_ui_shards_cover_everything.py` and `tests/security/test_lint_workflow_triggers.py`: 240 passed. End to end, the same probe on the two images: | | probe before install-deps | probe after install-deps | job | |---|---|---|---| | main, `ubuntu-26.04` (run 42338613438) | webkit: TargetClosedError | webkit: TargetClosedError | failed | | this PR, `ubuntu-24.04` | webkit: TargetClosedError | all three engines launch | `Loaded-models indicator (cross-browser)` passed |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…red under it [skip ci]
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Pushed On that A100, the commit before the broken one ( Codex review on the fork mirror (LeoBorcherding#788) found no major issues at |
LFM3-Audio-2B can now be trained in Unsloth Studio, chatted with after training, and exported as a LoRA, a merged 16-bit model, and a GGUF.
What was broken
failed to build the first training batch ... TokenizersBackend has no attribute tokenizerModel Lfm3AudioForConditionalGeneration is not supportedlfm/encoder/depthformer). Saving through transformers writes a different layout (text_config/audio_encoder_config/depth_config), so the converter no longer recognizes itChanges
core/training/trainer.py): an audio model with no vision tower loads throughAutoModelForMultimodalLM, the same rule Chat already uses. Gemma 3n/4 and LFM3-Omni have vision and keep the default load. That class is used only when the vision check gives a definite "no"; if the check fails to read the config, the default load is kept. The training collator also keeps LFM3-Audio's audio placeholder tokens out of the loss (they live on the processor, not the tokenizer).core/export/export.py): the same rule, so LoRA and merged exports include the processor, feature extractor and theaudio_tokenizer/codec.unsloth/save.py): before GGUF conversion, the savedconfig.jsonis replaced with the base model's released one, read at the exact commit that was loaded. A LoRA merge doesn't change the architecture, so it describes the same weights. If the vocabulary was resized, the saved config is kept. A merged 16-bit save, local or pushed to the Hub, also writes the released layout, so the folder can be converted later without its base.Merged 16-bit export needs unslothai/unsloth-zoo#2278, which maps the weight names this model renames on load.
Results
Colab A100 40GB, Linux, transformers 5.22.1, unsloth-zoo 9e9eed301a (#2278), at the earlier commits listed. Toy dataset: 24 spoken questions in 2 voices, every answer
<<A2B-TAG>> SLOTH-7 ~Q9, with 3 held-out questions.TokenizersBackend has no attribute tokenizeraudio_tokenizer/Model Lfm3AudioForConditionalGeneration is not supportedNot run on a GPU: the later commits ca03702 (read the base config at the loaded commit), 96a36c0 and 89aa016 (merged saves keep the released layout), and the vision-check fallback.
Tests
New tests in
test_audio_vlm_train_load.py,test_audio_vlm_completion_masking.py,test_export_audio_vlm_loads_as_vision.pyandtests/saving/test_lfm3_audio_gguf_config.py: 139 passed on macOS CPU, together with the existing save routing and Hub destination tests.Notes
AutoProcessor.from_pretrained(<LoRA export>)fails withCan't find 'adapter_config.json': the LFM3 processor loads its codec from a subfolder, and transformers then mistakes the export's adapter file for its own. All the files are present; load the processor from the base model instead.