Repository navigation
feat(adapters): P2 fused export for PEFT & mlx-lm LoRA adapters across WeightConverter, UniversalModelConverter, CLI, REST, and ConvertModelSheet (#675) - #785
Merged
Conversation
…s WeightConverter, UniversalModelConverter, CLI, REST, and ConvertModelSheet (#675)
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.
Part of #675 (P2 fused export, building on #730 P0 and #738 P1; satisfies #546 converter parity and #664 REST repo-id boundary).
Summary
Sources/BasaltInference/Quantization/LoRAUpdate+PEFT.swift,WeightConverter.swift,PEFTLoRAReader.swift:LoRAUpdateto read both PEFT (adapter_config.json+adapter_model.safetensors, sharingPEFTLoRAReader.prefixRewritesfor VLM-stylebase_model.model.model.language_model.*keys anduse_rslorascale) and mlx-lm (adapters.safetensors), refusing DoRA,modules_to_save,rank_pattern/alpha_pattern, base-changing inits, unmatched layers, and unpaired weights.Sources/BasaltCore/ServedAdapterSource.swift&Sources/BasaltInference/Quantization/UniversalModelConverter+Adapter.swift,UniversalModelConverter.swift:ServedAdapterSource.parseSingle(_:)&cachedDirectory(for:cacheRoot:)andUniversalModelConverter.resolveAdapterDirectory(_:cacheRoot:requireVerified:)supporting local directories (CLI) and cached/downloaded HF repo ids (org/repoorhf:org/repo).dense:bf16/dense:fp16), affine-like (affine,nf4,mxfp4,nvfp4,mixed), and calibrated targets (macaq*,flatQuant,lirQuant,qtip*,gsqRCO) via pre-fusion staging.Sources/BasaltCLI/ModelsConvertCommand.swift&+Universal.swift: resolved--adapter <dir | org/repo | hf:org/repo>for both standard and--toconversion flows.Sources/BasaltServer/REST/ModelsController+Convert.swift: accepts HF repo ids (org/repoorhf:org/repo) inPOST /v1/models/convertwhile continuing to reject local filesystem paths with HTTP 400 ([P1] security(server,cloud,core): уязвимости валидации путей, redaction секретов, обхода бюджета и rate-limit #664).Sources/BasaltAppCore/Library/ModelConvertReducer.swift,Sources/BasaltApp/Library/ConvertModelSheet.swift&+Adapter.swift,Localization/{en,ru}.lproj/Localizable.strings: added optional LoRA adapter repo-id field with reducer validation and EN/RU strings; visually verified via offscreen Light, Dark, and Russian renders.Tests/BasaltTests/PEFTFusedExportTests.swift:#228parity on.qwen35and.lfm2Moe(float32 fused vs unfused PEFT logits< 1e-4and exact greedy ids; bf16 fused weights bit-exact toW + s·B·Aand bit-identical to mlx-lm fused export; affine 4-bit quantized export parity), rsLoRA & refusal matrix, REST#664repo-only guard,LibraryReducervalidation, andConvertModelSheetLight/Dark/Russian visual render test.Local Verification
swift build -Xswiftc -warnings-as-errorsswift build -c release -Xswiftc -warnings-as-errors221.00s, 0 warnings)PEFTFusedExportTests|PEFTAdapterTests|WeightConverterTests|UniversalConverterTests|AuditSecurityAndCloudRegressionTests)34/34in 8 suites,3.958s)PEFTFusedExportTests)25/25,1.098–1.316s)check_changed_coverage.swift origin/main200/248, min60%)check_no_new_comments.swift origin/main0comments added)check_concurrency_hatches.swift0hatches outside allowlist)check_size_limits.swift origin/main --impact15,0limits exceeded)