Commit Graph
17 Commits
Author SHA1 Message Date
EthanfelandClaude Sonnet 4.6 aae488bc00 feat: add _extract_lora_svd helper for LoRA extraction
Adds module-level _extract_lora_svd() that SVD-decomposes a weight
delta into (lora_up, lora_down, alpha), supporting fixed-rank and
auto-rank (energy threshold) modes with a singular value noise floor.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 23:27:23 +02:00
EthanfelandClaude Sonnet 4.6 02daae172e test: add failing tests for _extract_lora_svd helper
Adds TestExtractLoRAFromDelta test class and _load_module() helper
to support TDD for the upcoming LoRAExtractFromModel node.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 17:49:57 +02:00
EthanfelandClaude Opus 4.6 5ab9ec3e2d test: add sub-merge flags, single-item passthrough, and nested formula tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 21:39:30 +01:00
EthanfelandClaude Opus 4.6 7f6df901d5 feat: integrate formula detection into AutoTuner with reviewed bug fixes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 21:30:48 +01:00
EthanfelandClaude Opus 4.6 285f4e7080 feat: add _autotune_resolve_tree for per-sub-merge AutoTuner
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 21:23:53 +01:00
EthanfelandClaude Opus 4.6 926490bf7c fix: address code quality issues in merge formula executor
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 16:29:05 +01:00
EthanfelandClaude Opus 4.6 6a55178d7b feat: merge formula tree executor with optimize_merge integration
Add _execute_merge_tree, _resolve_tree_to_stack, and
_model_to_virtual_lora methods to LoRAOptimizer. Modify optimize_merge
to detect formula metadata in the stack and delegate to the tree
executor for hierarchical sub-group merging. Add safety filter in
_normalize_stack to strip formula metadata entries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 16:09:09 +01:00
EthanfelandClaude Opus 4.6 8c8c3de053 feat: add LoRAMergeFormula passthrough node
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 16:04:59 +01:00
EthanfelandClaude Opus 4.6 4ae2478feb feat: add merge formula parser with recursive descent
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 16:02:22 +01:00
EthanfelandClaude Opus 4.6 db1591a693 feat: embed metadata in saved LoRAs and tuner files
- SaveMergedLoRA now writes safetensors metadata (source LoRAs, merge
  settings, architecture) plus optional user prompt/description
- SaveTunerData accepts optional prompt/description, embeds in JSON
- LoadTunerData outputs prompt, description, and metadata_info strings
- AutoTuner records source_loras in tuner_data for provenance
- New LoRAMetadataReader passthrough node extracts metadata from any
  safetensors LoRA in a stack (prompt, description, merge info)
- LoRAStack attaches file metadata at load time; _normalize_stack
  preserves it through both tuple and dict paths
- Graceful degradation: missing metadata produces empty strings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 00:11:58 +01:00
EthanfelandClaude Opus 4.6 dd42043766 feat: Compatibility Analyzer solo LoRA nodes, create_nodes toggle, and settings cleanup
- Solo LoRAs now create LoraLoader/LoraLoaderModelOnly nodes (based on CLIP)
- Merge groups continue creating LoRAStackDynamic nodes
- Use original strengths instead of auto-strengths for created nodes
- Add create_nodes toggle to disable automatic node creation
- Move smooth_slerp_gate from AutoTunerSettings to shared MergeSettings
- Add smooth_slerp_gate to main LoRAOptimizer and _SIMPLE_DEFAULTS
- Add decision_smoothing (0.25) to _SIMPLE_DEFAULTS
- Remove output_mode from AutoTunerSettings (hardcode "merge")
- Rewrite all settings node tooltips for clarity
- Update tests for new settings structure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 21:30:13 +01:00
EthanfelandClaude Opus 4.6 66095dec68 refactor: extract common settings into LoRAMergeSettings node
Create a new LoRAMergeSettings node holding the 6 shared parameters
(normalize_keys, architecture_preset, auto_strength_floor,
decision_smoothing, vram_budget, cache_patches) that were duplicated
across LoRAOptimizerSettings and LoRAAutoTunerSettings.

Both mode nodes now accept an optional MERGE_SETTINGS input and fall
back to identical defaults when unconnected — output dicts are unchanged
so execute_simple needs zero modifications.

Also fixes:
- v1 scoring: de-dent composite_score recomputation so it always runs
  under scoring_formula=="v1", not only when sparsification is enabled
- RAM leak: clear _autotuner_delegate caches on model change and when
  switching between advanced/autotuner modes in LoRAOptimizerSimple

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 20:02:50 +01:00
EthanfelandClaude Opus 4.6 d1e6282c41 feat: add LoRA Optimizer Settings and AutoTuner Settings nodes
Add two pure-data nodes (LoRAOptimizerSettings, LoRAAutoTunerSettings)
that output OPTIMIZER_SETTINGS dicts. Connecting either to the Simple
node's new 'settings' input transforms it into the Advanced Optimizer
or AutoTuner respectively, so users never need to swap node types.

Settings take priority over tuner_data and defaults. The AutoTuner
delegate is persisted on the Simple instance so cache_patches works
across re-executions. Unknown mode values raise ValueError.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 16:31:35 +01:00
EthanfelandClaude Opus 4.6 b1c04dc306 fix: remove orphaned calibration_data remnants
Fix two runtime bugs where orphaned "" arguments were passed to
_compute_cache_key (TypeError from extra positional arg). Also clean
up stale importance_mode, activation_ratio, and per_lora_activation_sq
references.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:54:06 +01:00
EthanfelandClaude Opus 4.6 65e03ec424 refactor: remove calibration_data feature from PR branch
Remove all CALIBRATION_DATA infrastructure (SaveCalibrationData,
LoadCalibrationData nodes, activation importance scoring, calibration
hash in cache keys). This duplicates tuner_data functionality and
adds unnecessary complexity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:46:46 +01:00
EthanfelandClaude Opus 4.6 7959ce81fd merge: integrate PR #1 correctness refactor into test branch
Merges srv1n's correctness refactor (PR #1) with conflict resolution
to preserve our recent setting renames and fixes while incorporating
their core improvements:

- Target-key grouping: analysis/merge operates on resolved model weights
  instead of raw LoRA prefixes, fixing trainer-specific aliasing bugs
- Exact low-rank linear patches: lossless linear merges for weighted_sum
  and weighted_average when no nonlinear ops are needed
- Excess conflict metric: sign disagreement beyond statistical expectation
  (cosine-sim aware), replacing raw conflict ratio in decisions
- Subspace overlap: measures how much LoRA weight perturbations align
- Block smoothing: reduces noisy per-prefix mode flips
- Activation-aware calibration scoring for Phase 2 quality evaluation
- ACE-Step architecture support
- Soft LoKr/LoHa imports for graceful degradation
- RS-LoRA compensation re-enabled with safe heuristic
- 519-line test suite (19 tests, all passing)

Conflict resolution kept our:
- Setting renames (merge_refinement, patch_compression, strategy_set)
- Qwen-Image detection fix
- LoRACompatibilityAnalyzer node
- Conflict-mode masking in _apply_conflict_modes (PR's approach)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 14:19:34 +01:00
srv1n be7cb96f1e Sync correctness refactor onto upstream dfd3920 2026-03-08 16:02:45 +05:30