Commit Graph

9 Commits

Author SHA1 Message Date
Michele Rossi
97ac841518 Add VnAssetsSession for persistent model lifecycle
- Extract model loading from generate()/edit() into VnAssetsSession class
- Session eagerly loads SDXL + Qwen Image Edit at construction (28s, once)
- Both models held in GPU memory across calls; generate()/edit() reuse them
- generate.py and edit.py become thin wrappers (backwards compatible CLI)
- Context manager (with VnAssetsSession(...) as vna:) for library use
- Metadata backwards-compatible: all fields preserved including lora_load_s
- load_time_s now reflects total session construction, amortized across calls

- Add performance stats for edit path (Qwen Image Edit + Lightning LoRA)
- Benchmark matmul fallback (86.8s) vs flash attention (53.3s, 1.63x speedup)
- Session vs cold start comparison: 2 ops save one 28s load, 5 edits save 112s
- Flash attention via TORCH_ROCM_AOTRITON_ENABLE_EXPERIMENTAL=1 documented
2026-07-08 10:18:42 +02:00
Michele Rossi
e7cde842b3 Improve doc, cleanup 2026-07-08 09:13:46 +02:00
Michele Rossi
9564202e6d feat: add ComfyUI-style prompt weighting via compel
- Support (word:weight), [word], ((nested)) syntax
- Support BREAK for conditioning chunking (.and() translation)
- Use CompelForSDXL (modern API, avoids deprecation)
- Add --raw flag to bypass weighting and fall back to plain encoding
- Update README with Prompt Syntax section and examples
- Add docs/comfyui-prompt-style.md with design doc
2026-07-07 16:16:54 +02:00
Michele Rossi
2cf58aaa5c Move TECH_SPEC.md into project root 2026-07-06 20:21:56 +02:00
Michele Rossi
10d07d44b1 Patch Qwen transformer attention with matmul instead of SDPA
Monkey-patches dispatch_attention_fn to use simple Q@K^T@V matmul,
bypassing SDPA dispatch entirely. Enables editing at full 1024x1024
(was limited to 512x512 due to SDPA crashes) and is ~3x faster.
2026-07-06 20:19:01 +02:00
Michele Rossi
c791b08689 Remove LoRA support, add auto-resize, fix GPU memory cleanup
LoRA loading via PEFT crashes on ROCm; removed since user doesn't need
it. Added automatic downscaling of inputs >512px to avoid O(N^2)
attention explosion in the Qwen transformer (262K tokens at 1024^2
exceeds GPU capability). Added explicit GPU memory cleanup after each
command to prevent OOM when chaining generate + edit.
2026-07-06 19:15:15 +02:00
Michele Rossi
d7d67223b8 Document edit command and performance in README 2026-07-06 18:07:26 +02:00
Michele Rossi
ed124b1cbb Add vnasset edit command
Qwen Image Edit pipeline with FP8 Safetensors loading.
Uses init_empty_weights for memory-efficient 40GB model loading.
bf16 dtype to avoid ROCm crashes; falls back to math SDPA.
2026-07-06 18:06:47 +02:00
Michele Rossi
06fba9c234 Add vnasset SDXL generate command
ROCm-safe bfloat16 inference with custom matmul attention.
Automatic output directories, random seed, timing metadata.
2026-07-06 16:29:38 +02:00