kohya-ss / kohya-ss/sd-scripts
Extracted flux lora not working
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.2k
- Avg merge
- 11m
- Merged PRs (30d)
- 2
Description
2 Issues
1. sometimes it works, but it looks nothing like the fine tuned model.
2. Doesnt work and i get the error below
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/modules_forge/main_thread.py", line 30, in work
self.result = self.func(*self.args, **self.kwargs)
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/modules/txt2img.py", line 112, in txt2img_function
processed = processing.process_images(p)
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/modules/processing.py", line 815, in process_images
res = process_images_inner(p)
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/modules/processing.py", line 958, in process_images_inner
samples_ddim = p.sample(conditioning=p.c, unconditional_conditioning=p.uc, seeds=p.seeds, subseeds=p.subseeds, subseed_strength=p.subseed_strength, prompts=p.prompts)
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/modules/processing.py", line 1329, in sample
samples = self.sampler.sample(self, x, conditioning, unconditional_conditioning, image_conditioning=self.txt2img_image_conditioning(x))
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/modules/sd_samplers_kdiffusion.py", line 198, in sample
sampling_prepare(self.model_wrap.inner_model.forge_objects.unet, x=x)
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/backend/sampling/sampling_function.py", line 380, in sampling_prepare
memory_management.load_models_gpu(
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/backend/memory_management.py", line 587, in load_models_gpu
loaded_model.model_load(model_gpu_memory_when_using_cpu_swap)
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/backend/memory_management.py", line 392, in model_load
raise e
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/backend/memory_management.py", line 387, in model_load
self.real_model = self.model.forge_patch_model(patch_model_to)
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/backend/patcher/base.py", line 226, in forge_patch_model
self.lora_loader.refresh(target_device=target_device, offload_device=self.offload_device)
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/backend/patcher/lora.py", line 394, in refresh
weight = merge_lora_to_weight(current_patches, weight, key, computation_dtype=torch.float32)
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/venv/lib/python3.10/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/Ubuntu/apps/stable-diffusion-webui-forge/backend/patcher/lora.py", line 72, in merge_lora_to_weight
weight = weight.to(dtype=computation_dtype)
torch.cuda.OutOfMemoryError: Allocation on device 0 would exceed allowed memory. (out of memory)
Currently allocated : 45.21 GiB
Requested : 252.00 MiB
Device limit : 47.44 GiB
Free (according to CUDA): 10.25 MiB
PyTorch limit (set by user-supplied memory fraction)
: 17179869184.00 GiB
Allocation on device 0 would exceed allowed memory. (out of memory)
Currently allocated : 45.21 GiB
Requested : 252.00 MiB
Device limit : 47.44 GiB
Free (according to CUDA): 10.25 MiB
PyTorch limit (set by user-supplied memory fraction)
: 17179869184.00 GiB
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the extracted Flux LoRA generation failure from the traceback, then inspect backend/patcher/lora.py and the loading path through backend/memory_management.py. Compare the successful and failing cases, including the reported CUDA out-of-memory condition; done means the LoRA loads without the traceback and produces the expected model behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100