Write a script to convert a lokr to a lora. See…
Jump to turn (6)
- 1Write a script to convert a lokr to a lora. See C:\ComfyUI\models\loras\qwenimag
- 2I've moved the script to C:\sd-scripts\tools\convertlokrtolora.py . Now read C:\
- 3Also add a tqdm progress bar and output statistics in the same way as resizelora
- 4Add saveprecision
- 5Only keep --saveprecision and remove --dtype
- 6Are you sure that all intermediate computations are done in fp32, and only the o
- User
Write a script to convert a lokr to a lora. See C:\ComfyUI\models\loras\qwen_image_edit\Qwen_Snofs_1_3.safetensors for an example of lokr, and C:\ComfyUI\models\loras\qwen_image_edit\Meta4.safetensors for an example of lora. Read this repo to understand how lora and lokr are loaded. Check how to handle alpha. Use SVD with a given rank to construct the lora.
- Assistant
Inspecting the repo’s LoRA/LoKR loading path first, then I’ll map the example
.safetensorsformats and add a conversion script that matches the repo’s alpha/rank expectations. - Assistant
I found the core loading path in
comfy/lora.py; next I’m checking the actual adapter implementations so the conversion script emits the exact key shapes and alpha semantics Comfy expects.