automatic icon indicating copy to clipboard operation
automatic copied to clipboard

[Issue]: Scaling/cropping of the output with editing models

Open alerikaisattera opened this issue 4 months ago • 9 comments

Issue Description

When using Qwen Image Edit or Flux Kontext, the output image is upscaled and then cropped to fit into desired resolution

This is distinct from the problem of editing models themselves which can can cause shift/zoom if the image is not of certain resolution. This bug still occurs with "good" image resolution and looks as if the image has been classically upscaled and then cropped

An example input+output with meta is provided. The same input doesn't cause this problem in Qwen Image Edit's HF demo

Image

Image

Version Platform Description

No response

Relevant log output

2025-10-13 23:17:24,456 | aleri-pc | sd | DEBUG | devices | GC: current={'gpu': 9.6, 'ram': 20.49, 'oom': 0} prev={'gpu': 11.56, 'ram': 20.49} load={'gpu': 62, 'ram': 33} gc={'gpu': 1.96, 'py': 334} fn=hijack_encode_prompt:end why=threshold time=0.41
2025-10-13 23:17:32,626 | aleri-pc | sd | DEBUG | sd_hijack_vae | Encode: vae=AutoencoderKLQwenImage slicing=True tiling=False latents=[1, 3, 1, 1152, 896]:cuda:0:torch.bfloat16 time=8.143
2025-10-13 23:17:41,840 | aleri-pc | sd | ERROR | processing_callbacks | Callback: shape '[1, 67, 50, 16, 2, 2]' is invalid for input of size 197568
2025-10-13 23:18:59,684 | aleri-pc | sd | TRACE | launch | Server: alive=True requests=808 memory=21.36/62.74 status='idle' task='' timestamp=None current='task(95e40mr1woec1n0)' id='' job=0 jobs=0 total=13 step=16 steps=0 queued=0 uptime=974 elapsed=87.06 eta=None progress=0
2025-10-13 23:20:58,355 | aleri-pc | sd | DEBUG | devices | GC: current={'gpu': 12.19, 'ram': 21.36, 'oom': 0} prev={'gpu': 13.15, 'ram': 21.36} load={'gpu': 78, 'ram': 34} gc={'gpu': 0.96, 'py': 804} fn=hijack_vae_decode:begin why=threshold time=0.39
2025-10-13 23:20:59,761 | aleri-pc | sd | TRACE | launch | Server: alive=True requests=1067 memory=21.36/62.74 status='running' task='VAE Decode' timestamp='20251013232057' current='task(95e40mr1woec1n0)' id='5952fa1f99704ef' job=0 jobs=1 total=14 step=0 steps=0 queued=0 uptime=1094 elapsed=1.8 eta=None progress=0
2025-10-13 23:21:03,077 | aleri-pc | sd | DEBUG | sd_hijack_vae | Decode: vae=AutoencoderKLQwenImage slicing=True tiling=False latents=[1, 16, 1, 126, 98]:cuda:0:torch.bfloat16 time=4.722
2025-10-13 23:21:03,164 | aleri-pc | sd | INFO | processing_diffusers | Processing modifiers: unapply

Backend

Diffusers

Compute

nVidia CUDA

Interface

Standard

Branch

Master

Model

Other

Acknowledgements

  • [x] I have read the above and searched for existing issues
  • [x] I confirm that this is classified correctly and its not an extension issue

alerikaisattera avatar Oct 13 '25 17:10 alerikaisattera

When using Qwen Image Edit or Flux Kontext, the output image is upscaled and then cropped to fit into desired resolution

can you explain this statement? its provided as fact without anything to back it up.

vladmandic avatar Oct 14 '25 00:10 vladmandic

can you explain this statement? its provided as fact without anything to back it up.

An example input+output with meta is provided in the issue

This line seems to be relevant:

025-10-13 23:17:32,626 | aleri-pc | sd | DEBUG | sd_hijack_vae | Encode: vae=AutoencoderKLQwenImage slicing=True tiling=False latents=[1, 3, 1, 1152, 896]:cuda:0:torch.bfloat16 time=8.143

The resolution of the image encoded into latent differs from the resolution of the input image. The scaling ratio of the encoded image to the input matches that of output to input

alerikaisattera avatar Oct 14 '25 02:10 alerikaisattera

enforcing whatever vae ratio is, that is what sdnext does for all models forever. for sdxl, it's 8, for qwen it's 16. but that is NOT cropping I don't see how is that related to the rest of the writeup.

But if you see something else, please provide evidence and logs and step by step. not "the how do you explain" message based on single line.

vladmandic avatar Oct 14 '25 02:10 vladmandic

but that is NOT cropping I don't see how is that related to the rest of the writeup.

I assume the model output is then cropped to have the same resolution as the input

alerikaisattera avatar Oct 14 '25 02:10 alerikaisattera

but that is NOT cropping I don't see how is that related to the rest of the writeup.

I assume the model output is then cropped to have the same resolution as the input

that's a big assumption. evidence please. step by step. full log. this is not the place for a single line assumptions.

vladmandic avatar Oct 14 '25 03:10 vladmandic

Complete log for the example image:

2025-10-13 23:01:57,535 | aleri-pc | sd | INFO | launch | Starting SD.Next
2025-10-13 23:01:57,563 | aleri-pc | sd | INFO | installer | Logger: file="/run/media/aleri/60b6f25f-f89b-41ea-929b-31bc47e210bc/AI/sdnext/sdnext.log" level=INFO host="aleri-pc" size=656893 mode=append
2025-10-13 23:01:57,564 | aleri-pc | sd | INFO | installer | Python: version=3.12.10 platform=Linux bin="/run/media/aleri/60b6f25f-f89b-41ea-929b-31bc47e210bc/AI/sdnext/venv/bin/python3" venv="/run/media/aleri/60b6f25f-f89b-41ea-929b-31bc47e210bc/AI/sdnext/venv"
2025-10-13 23:01:57,857 | aleri-pc | sd | INFO | installer | Version: app=sd.next updated=2025-09-16 hash=7c8f42fab branch=master url=https://github.com/vladmandic/sdnext/tree/master ui=dev
2025-10-13 23:01:57,859 | aleri-pc | sd | DEBUG | installer | Branch mismatch: sdnext=master ui=dev
2025-10-13 23:01:58,273 | aleri-pc | sd | DEBUG | installer | Branch sync failed: sdnext=master ui=main
2025-10-13 23:01:58,977 | aleri-pc | sd | INFO | installer | Version: app=sd.next latest=2025-09-16T13:03:46Z hash=7c8f42fa branch=master
2025-10-13 23:01:58,985 | aleri-pc | sd | INFO | launch | Platform: arch=x86_64 cpu= system=Linux release=6.12.48-1-MANJARO python=3.12.10 locale=('en_US', 'UTF-8') docker=False
2025-10-13 23:01:58,988 | aleri-pc | sd | DEBUG | installer | Packages: prefix=venv site=['venv/lib/python3.12/site-packages']
2025-10-13 23:01:58,989 | aleri-pc | sd | INFO | launch | Args: ['--use-cuda']
2025-10-13 23:01:58,990 | aleri-pc | sd | DEBUG | installer | Setting environment tuning
2025-10-13 23:01:58,991 | aleri-pc | sd | DEBUG | installer | Torch allocator: "garbage_collection_threshold:0.80,max_split_size_mb:512"
2025-10-13 23:01:58,993 | aleri-pc | sd | INFO | installer | Verifying torch installation
2025-10-13 23:01:59,046 | aleri-pc | sd | DEBUG | installer | Torch overrides: cuda=True rocm=False ipex=False directml=False openvino=False zluda=False
2025-10-13 23:01:59,046 | aleri-pc | sd | INFO | installer | CUDA: nVidia toolkit detected
2025-10-13 23:01:59,072 | aleri-pc | sd | WARNING | installer | Modified files: ['pipelines/model_qwen.py']
2025-10-13 23:01:59,110 | aleri-pc | sd | INFO | installer | Install: verifying requirements
2025-10-13 23:01:59,340 | aleri-pc | sd | DEBUG | installer | Timestamp repository update time: Tue Sep 16 19:03:46 2025
2025-10-13 23:01:59,340 | aleri-pc | sd | DEBUG | installer | Timestamp previous setup time: Sat Oct 11 20:13:02 2025
2025-10-13 23:01:59,340 | aleri-pc | sd | INFO | installer | Extensions: disabled=[]
2025-10-13 23:01:59,342 | aleri-pc | sd | INFO | installer | Extensions: path="extensions-builtin" enabled=['Lora', 'stable-diffusion-webui-rembg', 'sd-extension-system-info', 'sd-webui-agent-scheduler', 'sd-extension-chainner', 'sdnext-modernui']
2025-10-13 23:01:59,414 | aleri-pc | sd | INFO | installer | Extensions: path="extensions" enabled=[]
2025-10-13 23:01:59,416 | aleri-pc | sd | DEBUG | installer | Timestamp latest extensions time: Mon Oct 13 23:01:58 2025
2025-10-13 23:01:59,416 | aleri-pc | sd | DEBUG | installer | Timestamp: version:1758027826 setup:1760191982 extension:1760374918
2025-10-13 23:01:59,417 | aleri-pc | sd | INFO | launch | Startup: standard
2025-10-13 23:01:59,418 | aleri-pc | sd | INFO | installer | Verifying submodules
2025-10-13 23:02:00,924 | aleri-pc | sd | DEBUG | installer | Git submodule: extensions-builtin/sd-extension-chainner / main
2025-10-13 23:02:01,021 | aleri-pc | sd | DEBUG | installer | Git detached head detected: folder="extensions-builtin/sd-extension-system-info" reattach=main
2025-10-13 23:02:01,021 | aleri-pc | sd | DEBUG | installer | Git submodule: extensions-builtin/sd-extension-system-info / main
2025-10-13 23:02:01,041 | aleri-pc | sd | DEBUG | installer | Git submodule: extensions-builtin/sd-webui-agent-scheduler / main
2025-10-13 23:02:01,127 | aleri-pc | sd | DEBUG | installer | Git detached head detected: folder="extensions-builtin/sdnext-modernui" reattach=dev
2025-10-13 23:02:01,128 | aleri-pc | sd | DEBUG | installer | Git submodule: extensions-builtin/sdnext-modernui / dev
2025-10-13 23:02:01,151 | aleri-pc | sd | DEBUG | installer | Git submodule: extensions-builtin/stable-diffusion-webui-rembg / master
2025-10-13 23:02:01,243 | aleri-pc | sd | DEBUG | installer | Git detached head detected: folder="wiki" reattach=master
2025-10-13 23:02:01,243 | aleri-pc | sd | DEBUG | installer | Git submodule: wiki / master
2025-10-13 23:02:01,339 | aleri-pc | sd | DEBUG | installer | Installed packages: 196
2025-10-13 23:02:01,339 | aleri-pc | sd | DEBUG | installer | Extensions all: ['Lora', 'stable-diffusion-webui-rembg', 'sd-extension-system-info', 'sd-webui-agent-scheduler', 'sd-extension-chainner', 'sdnext-modernui']
2025-10-13 23:02:01,366 | aleri-pc | sd | DEBUG | installer | Extension installer: builtin=True file="/run/media/aleri/60b6f25f-f89b-41ea-929b-31bc47e210bc/AI/sdnext/extensions-builtin/stable-diffusion-webui-rembg/install.py"
2025-10-13 23:02:01,436 | aleri-pc | sd | DEBUG | installer | Extension installer: builtin=True file="/run/media/aleri/60b6f25f-f89b-41ea-929b-31bc47e210bc/AI/sdnext/extensions-builtin/sd-webui-agent-scheduler/install.py"
2025-10-13 23:02:01,544 | aleri-pc | sd | DEBUG | installer | Extensions all: []
2025-10-13 23:02:01,544 | aleri-pc | sd | INFO | installer | Extensions enabled: ['Lora', 'stable-diffusion-webui-rembg', 'sd-extension-system-info', 'sd-webui-agent-scheduler', 'sd-extension-chainner', 'sdnext-modernui']
2025-10-13 23:02:01,575 | aleri-pc | sd | INFO | installer | Install: verifying requirements
2025-10-13 23:02:01,582 | aleri-pc | sd | DEBUG | launch | Setup complete without errors: 1760374922
2025-10-13 23:02:01,628 | aleri-pc | sd | DEBUG | installer | Extension preload: {'extensions-builtin': 0.01, 'extensions': 0.0}
2025-10-13 23:02:01,628 | aleri-pc | sd | INFO | launch | Installer time: total=9.11 git=2.27 base=1.93 submodules=1.87 latest=1.41 ui=0.41 branch=0.38 version=0.34 installed=0.08 requirements=0.08 sd-webui-agent-scheduler=0.05 torch=0.05
2025-10-13 23:02:01,630 | aleri-pc | sd | INFO | launch | Command line args: ['--use-cuda'] use_cuda=True args=[]
2025-10-13 23:02:01,631 | aleri-pc | sd | DEBUG | launch | Env flags: []
2025-10-13 23:02:01,631 | aleri-pc | sd | DEBUG | launch | Linker flags: preload="libtcmalloc.so.4" path=":/run/media/aleri/60b6f25f-f89b-41ea-929b-31bc47e210bc/AI/sdnext/venv/lib/"
2025-10-13 23:02:01,631 | aleri-pc | sd | DEBUG | launch | Starting module: <module 'webui' from '/run/media/aleri/60b6f25f-f89b-41ea-929b-31bc47e210bc/AI/sdnext/webui.py'>
2025-10-13 23:02:42,752 | aleri-pc | sd | DEBUG | loader | System: cores=16 affinity=16 threads=8
2025-10-13 23:02:42,752 | aleri-pc | sd | INFO | loader | Torch: torch==2.8.0+cu128 torchvision==0.23.0+cu128
2025-10-13 23:02:42,758 | aleri-pc | sd | INFO | loader | Packages: diffusers==0.36.0.dev0 transformers==4.56.1 accelerate==1.10.1 gradio==3.43.2 pydantic==1.10.21 numpy==2.1.2
2025-10-13 23:02:45,872 | aleri-pc | sd | DEBUG | __init__ | ONNX: version=1.22.1, available=['AzureExecutionProvider', 'CPUExecutionProvider']
2025-10-13 23:02:46,147 | aleri-pc | sd | DEBUG | shared_state | State initialized: id=139627203452928
2025-10-13 23:02:46,646 | aleri-pc | sd | INFO | shared_defaults | Device detect: memory=16.0 default=balanced
2025-10-13 23:02:46,688 | aleri-pc | sd | DEBUG | json_helpers | Read: file="/run/media/aleri/60b6f25f-f89b-41ea-929b-31bc47e210bc/AI/sdnext/config.json" json=16 bytes=678 time=0.000 fn=<module>:load
2025-10-13 23:02:46,690 | aleri-pc | sd | INFO | shared | Engine: backend=Backend.DIFFUSERS compute=cuda device=cuda attention="Scaled-Dot-Product" mode=no_grad
2025-10-13 23:02:46,706 | aleri-pc | sd | DEBUG | json_helpers | Read: file="html/reference.json" json=101 bytes=48320 time=0.015 fn=_call_with_frames_removed:<module>
2025-10-13 23:02:46,707 | aleri-pc | sd | DEBUG | devices | Torch cuDNN: benchmark=True
2025-10-13 23:02:46,707 | aleri-pc | sd | DEBUG | devices | Torch attention: type="sdpa" flash=True memory=True math=True
2025-10-13 23:02:47,335 | aleri-pc | sd | INFO | devices | Torch parameters: backend=cuda device=cuda config=Auto dtype=torch.bfloat16 context=no_grad nohalf=False nohalfvae=False upcast=False deterministic=False tunable=[False, True] fp16=pass bf16=pass optimization="Scaled-Dot-Product"
2025-10-13 23:02:47,469 | aleri-pc | sd | INFO | shared | Device: device=NVIDIA GeForce RTX 4060 Ti n=1 arch=sm_120 capability=(8, 9) cuda=12.8 cudnn=91002 driver=580.82.09
2025-10-13 23:02:48,278 | aleri-pc | sd | DEBUG | webui | Entering start sequence
2025-10-13 23:02:48,279 | aleri-pc | sd | DEBUG | webui | Initializing
2025-10-13 23:02:48,279 | aleri-pc | sd | DEBUG | json_helpers | Read: file="metadata.json" json=2 bytes=1352 time=0.000 fn=initialize:init_metadata
2025-10-13 23:02:48,279 | aleri-pc | sd | DEBUG | json_helpers | Read: file="cache.json" json=1 bytes=350 time=0.000 fn=initialize:init_cache
2025-10-13 23:02:48,733 | aleri-pc | sd | INFO | sd_vae | Available VAEs: path="models/VAE" items=0
2025-10-13 23:02:48,735 | aleri-pc | sd | INFO | sd_unet | Available UNets: path="models/UNET" items=0
2025-10-13 23:02:48,754 | aleri-pc | sd | INFO | model_te | Available TEs: path="models/Text-encoder" items=0
2025-10-13 23:02:48,873 | aleri-pc | sd | INFO | sd_checkpoint | Available Models: safetensors="models/Stable-diffusion":2 diffusers="models/Diffusers":13 reference=101 items=15 time=0.12
2025-10-13 23:02:48,914 | aleri-pc | sd | INFO | lora_load | Available LoRAs: path="models/Lora" items=0 folders=2 time=0.00
2025-10-13 23:02:48,952 | aleri-pc | sd | INFO | styles | Available Styles: path="models/styles" items=288 time=0.04
2025-10-13 23:02:49,201 | aleri-pc | sd | INFO | yolo | Available Detailer: path="models/yolo" items=11 downloaded=0
2025-10-13 23:02:49,202 | aleri-pc | sd | DEBUG | extensions | Extensions: disabled=['Lora']
2025-10-13 23:02:49,202 | aleri-pc | sd | INFO | webui | Load extensions
2025-10-13 23:02:52,103 | aleri-pc | sd | INFO | script_loading | Extension: script='extensions-builtin/sd-webui-agent-scheduler/scripts/task_scheduler.py' Using sqlite file: extensions-builtin/sd-webui-agent-scheduler/task_scheduler.sqlite3
2025-10-13 23:02:52,208 | aleri-pc | sd | DEBUG | webui | Extensions init time: total=3.00 sd-webui-agent-scheduler=1.50 xyz_grid.py=0.78 sd-extension-chainner=0.19 cogvideo.py=0.15 sdnext-modernui=0.05 sd-extension-system-info=0.05
2025-10-13 23:02:52,256 | aleri-pc | sd | DEBUG | json_helpers | Read: file="html/upscalers.json" json=4 bytes=2640 time=0.013 fn=__init__:__init__
2025-10-13 23:02:52,269 | aleri-pc | sd | DEBUG | json_helpers | Read: file="extensions-builtin/sd-extension-chainner/models.json" json=25 bytes=2803 time=0.013 fn=__init__:find_scalers
2025-10-13 23:02:52,289 | aleri-pc | sd | DEBUG | chainner_model | Available chaiNNer: path="models/chaiNNer" defined=25 discovered=0 downloaded=0
2025-10-13 23:02:52,306 | aleri-pc | sd | DEBUG | upscaler | Upscaler type=ESRGAN folder="models/ESRGAN" model="1x_JPEGDestroyerV2_96000G" path="models/ESRGAN/1x_JPEGDestroyerV2_96000G.pth"
2025-10-13 23:02:52,307 | aleri-pc | sd | INFO | modelloader | Available Upscalers: items=73 downloaded=1 user=1 time=0.10 types=['None', 'Resize', 'Latent', 'AsymmetricVAE', 'DCC', 'VIPS', 'ChaiNNer', 'Diffusion', 'SwinIR', 'AuraSR', 'SCUNet', 'ESRGAN', 'RealESRGAN']
2025-10-13 23:02:52,337 | aleri-pc | sd | INFO | models_hf | Huggingface init: transfer=rust parallel=False direct=True token="hf_...rCGg" cache="cache/huggingface/hub"
2025-10-13 23:02:52,353 | aleri-pc | sd | WARNING | models_hf | Cache location changed: previous="/home/aleri/.cache/huggingface/hub" size=3520 MB
2025-10-13 23:02:52,555 | aleri-pc | sd | DEBUG | models_hf | Huggingface cache: path="cache/huggingface/hub" size=192086 MB
2025-10-13 23:02:52,555 | aleri-pc | sd | DEBUG | webui | UI start sequence
2025-10-13 23:02:52,569 | aleri-pc | sd | INFO | theme | UI locale: name="Auto"
2025-10-13 23:02:52,570 | aleri-pc | sd | INFO | theme | UI theme: type=Modern name="Default" available=35
2025-10-13 23:02:52,571 | aleri-pc | sd | DEBUG | ui_javascript | UI theme: css="extensions-builtin/sdnext-modernui/themes/Default.css" base="['base.css', 'timesheet.css']" user="None"
2025-10-13 23:02:52,573 | aleri-pc | sd | DEBUG | ui_txt2img | UI initialize: txt2img
2025-10-13 23:02:52,838 | aleri-pc | sd | DEBUG | ui_extra_networks | Networks: type="model" items=115 subfolders=4 tab=txt2img folders=['models/Stable-diffusion', 'models/Reference', '/run/media/aleri/60b6f25f-f89b-41ea-929b-31bc47e210bc/AI/sdnext/models/Stable-diffusion'] list=0.23 thumb=0.01 desc=0.00 info=0.74 workers=12
2025-10-13 23:02:52,840 | aleri-pc | sd | DEBUG | ui_extra_networks | Networks: type="lora" items=0 subfolders=1 tab=txt2img folders=['models/Lora'] list=0.01 thumb=0.01 desc=0.00 info=0.00 workers=12
2025-10-13 23:02:52,856 | aleri-pc | sd | DEBUG | ui_extra_networks | Networks: type="style" items=288 subfolders=3 tab=txt2img folders=['models/styles', 'html'] list=0.01 thumb=0.01 desc=0.00 info=0.00 workers=12
2025-10-13 23:02:52,859 | aleri-pc | sd | DEBUG | ui_extra_networks | Networks: type="wildcards" items=0 subfolders=1 tab=txt2img folders=['models/wildcards'] list=0.00 thumb=0.00 desc=0.00 info=0.00 workers=12
2025-10-13 23:02:52,861 | aleri-pc | sd | DEBUG | ui_extra_networks | Networks: type="embedding" items=0 subfolders=1 tab=txt2img folders=['models/embeddings'] list=0.01 thumb=0.01 desc=0.00 info=0.00 workers=12
2025-10-13 23:02:52,862 | aleri-pc | sd | DEBUG | ui_extra_networks | Networks: type="vae" items=0 subfolders=1 tab=txt2img folders=['models/VAE'] list=0.00 thumb=0.00 desc=0.00 info=0.00 workers=12
2025-10-13 23:02:52,863 | aleri-pc | sd | DEBUG | ui_extra_networks | Networks: type="history" items=0 subfolders=1 tab=txt2img folders=[] list=0.00 thumb=0.00 desc=0.00 info=0.00 workers=12
2025-10-13 23:02:53,257 | aleri-pc | sd | DEBUG | ui_img2img | UI initialize: img2img
2025-10-13 23:02:53,928 | aleri-pc | sd | DEBUG | ui_control_helpers | UI initialize: control models="models/control"
2025-10-13 23:02:54,272 | aleri-pc | sd | DEBUG | scripts_manager | Script: fn="extensions-builtin/sd-webui-agent-scheduler/scripts/task_scheduler.py" type=control skip
2025-10-13 23:02:54,725 | aleri-pc | sd | DEBUG | ui_video | UI initialize: video
2025-10-13 23:02:55,852 | aleri-pc | sd | DEBUG | json_helpers | Read: file="ui-config.json" json=0 bytes=2 time=0.000 fn=__init__:read_from_file
2025-10-13 23:02:55,858 | aleri-pc | sd | DEBUG | ui_settings | Settings: sections=24 settings=369/583 quicksettings=0
2025-10-13 23:02:56,936 | aleri-pc | sd | INFO | ui_extensions | Extension list is empty: refresh required
2025-10-13 23:02:57,092 | aleri-pc | sd | DEBUG | ui_extensions | Extension list: processed=5 installed=5 enabled=4 disabled=1 visible=5 hidden=0
2025-10-13 23:02:57,663 | aleri-pc | sd | DEBUG | webui | Root paths: ['/run/media/aleri/60b6f25f-f89b-41ea-929b-31bc47e210bc/AI/sdnext', 'models']
2025-10-13 23:02:57,939 | aleri-pc | sd | INFO | webui | Local URL: http://127.0.0.1:7860/
2025-10-13 23:02:57,956 | aleri-pc | sd | DEBUG | middleware | API middleware: [<class 'starlette.middleware.base.BaseHTTPMiddleware'>, <class 'starlette.middleware.gzip.GZipMiddleware'>]
2025-10-13 23:02:57,956 | aleri-pc | sd | DEBUG | webui | API initialize
2025-10-13 23:02:58,336 | aleri-pc | sd | INFO | task_runner | [AgentScheduler] Task queue is empty
2025-10-13 23:02:58,337 | aleri-pc | sd | INFO | api | [AgentScheduler] Registering APIs
2025-10-13 23:02:58,873 | aleri-pc | sd | DEBUG | webui | Scripts setup: time=0.869 ['XYZ Grid:0.103', 'IP Adapters:0.082', 'Prompt enhance:0.055', 'Mixture-of-Diffusers: Tile Control:0.048', 'Face: Multiple ID Transfers:0.047', 'NudeNet:0.033']
2025-10-13 23:02:58,873 | aleri-pc | sd | DEBUG | sd_checkpoint | Model metadata: file="metadata.json" no changes
2025-10-13 23:02:58,873 | aleri-pc | sd | INFO | webui | Model: autoload=False
2025-10-13 23:02:58,875 | aleri-pc | sd | DEBUG | script_callbacks | Script init: ['system-info.py:app_started=0.13', 'task_scheduler.py:app_started=0.54']
2025-10-13 23:02:58,875 | aleri-pc | sd | INFO | webui | Startup time: total=76.34 torch=30.15 launch=6.76 libraries=6.57 loader=6.40 installer=6.37 gradio=4.04 bnb=3.82 extensions=3.00 ui-extensions=1.22 numpy=0.96 ui-networks=0.92 app-started=0.67 diffusers=0.65 ui-control=0.60 ui-models=0.58 ui-defaults=0.47 samplers=0.45 ui-txt2img=0.36 ui-img2img=0.34 ui-video=0.30 onnx=0.27 detailer=0.25 api=0.25 cleanup=0.23 scipy=0.14 models=0.12 upscalers=0.10 ui-extras=0.08 ui-caption=0.05 ui-gallery=0.05
2025-10-13 23:02:58,881 | aleri-pc | sd | DEBUG | json_helpers | Save: file="/run/media/aleri/60b6f25f-f89b-41ea-929b-31bc47e210bc/AI/sdnext/config.json" json=16 bytes=678 time=0.003
2025-10-13 23:03:48,616 | aleri-pc | sd | INFO | api | Browser session: user=None client=127.0.0.1 agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36
2025-10-13 23:03:48,682 | aleri-pc | sd | DEBUG | server | UI: connected
2025-10-13 23:03:51,718 | aleri-pc | sd | INFO | server | UI: ready time=13526
2025-10-13 23:04:27,176 | aleri-pc | sd | INFO | api | Browser session: user=None client=127.0.0.1 agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36
2025-10-13 23:04:27,240 | aleri-pc | sd | DEBUG | server | UI: connected
2025-10-13 23:04:30,282 | aleri-pc | sd | INFO | server | UI: ready time=13137
2025-10-13 23:04:49,570 | aleri-pc | sd | INFO | sd_checkpoint | Load model: select="v1-5-pruned-fp16-emaonly [92954befdb]"
2025-10-13 23:04:49,575 | aleri-pc | sd | INFO | sd_detect | Autodetect model: detect="Stable Diffusion 1.5" class=StableDiffusionPipeline file="/run/media/aleri/60b6f25f-f89b-41ea-929b-31bc47e210bc/AI/sdnext/models/Stable-diffusion/v1-5-pruned-fp16-emaonly.safetensors"
2025-10-13 23:04:49,577 | aleri-pc | sd | DEBUG | sd_models | Cache clear
2025-10-13 23:04:59,027 | aleri-pc | sd | TRACE | launch | Server: alive=True requests=393 memory=1.51/62.74 status='running' task='Load model' timestamp='20251013230449' current='' id='8c81c9c03f7e48f' job=0 jobs=1 total=1 step=0 steps=0 queued=0 uptime=133 elapsed=9.45 eta=None progress=0
2025-10-13 23:05:47,408 | aleri-pc | sd | DEBUG | sd_models | Setting model: pipeline=StableDiffusionPipeline config={'low_cpu_mem_usage': True, 'torch_dtype': torch.bfloat16, 'load_connected_pipeline': True, 'extract_ema': False, 'use_safetensors': True, 'cache_dir': 'cache/huggingface/hub'}
2025-10-13 23:05:47,411 | aleri-pc | sd | INFO | textual_inversion | Network load: type=embeddings loaded=0 skipped=0 time=0.00
2025-10-13 23:05:47,412 | aleri-pc | sd | DEBUG | installer | Setting model: component=vae {'slicing': True, 'tiling': False}
2025-10-13 23:05:47,413 | aleri-pc | sd | DEBUG | installer | Setting model: attention="Scaled-Dot-Product"
2025-10-13 23:05:47,417 | aleri-pc | sd | INFO | sd_offload | Offload: type=balanced op=init watermark=0.2-0.84 gpu=3.20-13.44:16.00 cpu=63.000 limit=0.00 always=[] never=[] pre=True
2025-10-13 23:05:47,430 | aleri-pc | sd | DEBUG | sd_offload | Module: name=unet cls=UNet2DConditionModel size=1.601 params=859520964 quant=None
2025-10-13 23:05:47,432 | aleri-pc | sd | DEBUG | sd_offload | Module: name=text_encoder cls=CLIPTextModel size=0.229 params=123060480 quant=None
2025-10-13 23:05:47,434 | aleri-pc | sd | DEBUG | sd_offload | Module: name=vae cls=AutoencoderKL size=0.156 params=83653863 quant=None
2025-10-13 23:05:47,435 | aleri-pc | sd | INFO | sd_offload | Model class=StableDiffusionPipeline modules=3 size=1.986
2025-10-13 23:05:47,437 | aleri-pc | sd | INFO | sd_models | Load model: family=sd time={'total': 57.86, 'load': 57.84} native=512 memory={'ram': {'total': 62.74, 'used': 3.24, 'free': 60}, 'gpu': {'used': 0.87, 'total': 15.57, 'active': 0.0, 'peak': 0.0, 'retries': 0, 'oom': 0, 'swap': 0}, 'job': 'Load model'}
2025-10-13 23:05:47,442 | aleri-pc | sd | DEBUG | json_helpers | Save: file="/run/media/aleri/60b6f25f-f89b-41ea-929b-31bc47e210bc/AI/sdnext/config.json" json=16 bytes=734 time=0.002
2025-10-13 23:05:54,384 | aleri-pc | sd | INFO | sd_checkpoint | Load model: select="Diffusers/Qwen/Qwen-Image-Edit [ac7f9318f6]"
2025-10-13 23:05:54,389 | aleri-pc | sd | DEBUG | sd_models | Cache clear
2025-10-13 23:05:54,389 | aleri-pc | sd | DEBUG | sd_models | Current model: {'ram': {'total': 62.74, 'used': 3.24, 'free': 60}, 'gpu': {'used': 0.9, 'total': 15.57, 'active': 0.0, 'peak': 0.0, 'retries': 0, 'oom': 0, 'swap': 0}, 'job': 'Load model'}
2025-10-13 23:05:54,788 | aleri-pc | sd | DEBUG | devices | GC: current={'gpu': 0.9, 'ram': 3.24, 'oom': 0} prev={'gpu': 0.9, 'ram': 3.24} load={'gpu': 6, 'ram': 5} gc={'gpu': 0.0, 'py': 3696} fn=reload_model_weights:unload_model_weights why=unload time=0.34
2025-10-13 23:05:54,789 | aleri-pc | sd | DEBUG | sd_models | Unload model: {'ram': {'total': 62.74, 'used': 3.24, 'free': 60}, 'gpu': {'used': 0.9, 'total': 15.57, 'active': 0.0, 'peak': 0.0, 'retries': 0, 'oom': 0, 'swap': 0}, 'job': 'Load model'} after
2025-10-13 23:05:54,889 | aleri-pc | sd | INFO | sd_detect | Autodetect model: detect="Qwen" class=QwenImagePipeline file="models/Diffusers/models--Qwen--Qwen-Image-Edit/snapshots/ac7f9318f633fc4b5778c59367c8128225f1e3de"
2025-10-13 23:05:54,891 | aleri-pc | sd | DEBUG | sd_models | Cache clear
2025-10-13 23:05:56,048 | aleri-pc | sd | DEBUG | model_quant | Quantization: module="Model" type=sdnq mode=pre dtype=uint4 matmul=False group_size=0 quant_conv=False matmul_conv=False dequantize_fp32=False quantize_with_gpu=True quantization_device=cuda return_device=cuda device_map=default offload_mode=balanced non_blocking=False modules_to_not_convert=[] modules_dtype_dict={}
2025-10-13 23:05:56,048 | aleri-pc | sd | DEBUG | model_qwen | Load model: type=Qwen model="Diffusers/Qwen/Qwen-Image-Edit" repo="Qwen/Qwen-Image-Edit" offload=balanced dtype=torch.bfloat16 args={'torch_dtype': torch.bfloat16}
2025-10-13 23:05:56,048 | aleri-pc | sd | DEBUG | model_quant | Quantization: module="Model" type=sdnq mode=pre dtype=uint4 matmul=False group_size=0 quant_conv=False matmul_conv=False dequantize_fp32=False quantize_with_gpu=True quantization_device=cuda return_device=cuda device_map=default offload_mode=balanced non_blocking=False modules_to_not_convert=[] modules_dtype_dict={'minimum_8bit': ['pos_embed', 'time_text_embed', 'img_in', 'txt_in', 'norm_out', 'transformer_blocks.0.img_mod.1.weight']}
2025-10-13 23:05:56,048 | aleri-pc | sd | DEBUG | generic | Load model: transformer="Qwen/Qwen-Image-Edit" cls=QwenImageTransformer2DModel quant="SDNQConfig" args={'torch_dtype': torch.bfloat16}
2025-10-13 23:06:59,076 | aleri-pc | sd | TRACE | launch | Server: alive=True requests=418 memory=4.93/62.74 status='running' task='Load DiT' timestamp='20251013230556' current='' id='476dfec117444d5' job=0 jobs=1 total=3 step=0 steps=0 queued=0 uptime=253 elapsed=63.03 eta=None progress=0
2025-10-13 23:08:59,109 | aleri-pc | sd | TRACE | launch | Server: alive=True requests=442 memory=7.73/62.74 status='running' task='Load DiT' timestamp='20251013230556' current='' id='476dfec117444d5' job=0 jobs=1 total=3 step=0 steps=0 queued=0 uptime=373 elapsed=183.06 eta=None progress=0
2025-10-13 23:10:59,159 | aleri-pc | sd | TRACE | launch | Server: alive=True requests=466 memory=6.03/62.74 status='running' task='Load DiT' timestamp='20251013230556' current='' id='476dfec117444d5' job=0 jobs=1 total=3 step=0 steps=0 queued=0 uptime=493 elapsed=303.11 eta=None progress=0
2025-10-13 23:12:21,029 | aleri-pc | sd | DEBUG | devices | GC: current={'gpu': 0.89, 'ram': 11.86, 'oom': 0} prev={'gpu': 12.13, 'ram': 11.86} load={'gpu': 6, 'ram': 19} gc={'gpu': 11.24, 'py': 17924} fn=postprocess_model:_process_model_after_weight_loading why=sdnq time=0.53
2025-10-13 23:12:21,060 | aleri-pc | sd | DEBUG | model_quant | Quantization: module="TE" type=sdnq mode=pre dtype=int8 matmul=False group_size=0 quant_conv=False matmul_conv=False dequantize_fp32=False quantize_with_gpu=True quantization_device=cuda return_device=cuda device_map=default offload_mode=balanced non_blocking=False modules_to_not_convert=[] modules_dtype_dict={}
2025-10-13 23:12:21,060 | aleri-pc | sd | DEBUG | generic | Load model: text_encoder="Qwen/Qwen-Image" cls=Qwen2_5_VLForConditionalGeneration quant="SDNQConfig" shared=True
2025-10-13 23:12:59,279 | aleri-pc | sd | TRACE | launch | Server: alive=True requests=490 memory=14.28/62.74 status='running' task='Load TE' timestamp='20251013231221' current='' id='e99df9aeaf6340c' job=0 jobs=1 total=4 step=0 steps=0 queued=0 uptime=613 elapsed=38.22 eta=None progress=0
2025-10-13 23:14:59,294 | aleri-pc | sd | TRACE | launch | Server: alive=True requests=514 memory=16.66/62.74 status='running' task='Load TE' timestamp='20251013231221' current='' id='e99df9aeaf6340c' job=0 jobs=1 total=4 step=0 steps=0 queued=0 uptime=733 elapsed=158.23 eta=None progress=0
2025-10-13 23:15:26,326 | aleri-pc | sd | DEBUG | devices | GC: current={'gpu': 0.88, 'ram': 20.11, 'oom': 0} prev={'gpu': 13.88, 'ram': 20.11} load={'gpu': 6, 'ram': 32} gc={'gpu': 13.0, 'py': 179} fn=postprocess_model:_process_model_after_weight_loading why=sdnq time=0.43
2025-10-13 23:15:29,408 | aleri-pc | sd | DEBUG | installer | Setting model: component=vae {'slicing': True, 'tiling': False}
2025-10-13 23:15:29,408 | aleri-pc | sd | INFO | sd_offload | Offload: type=balanced op=init watermark=0.2-0.84 gpu=3.20-13.44:16.00 cpu=63.000 limit=0.00 always=[] never=[] pre=True
2025-10-13 23:15:29,469 | aleri-pc | sd | DEBUG | sd_offload | Module: name=transformer cls=QwenImageTransformer2DModel size=9.567 params=10266455616 quant=QuantizationMethod.SDNQ
2025-10-13 23:15:29,486 | aleri-pc | sd | DEBUG | sd_offload | Module: name=text_encoder cls=Qwen2_5_VLForConditionalGeneration size=8.232 params=8292166656 quant=QuantizationMethod.SDNQ
2025-10-13 23:15:29,489 | aleri-pc | sd | DEBUG | sd_offload | Module: name=vae cls=AutoencoderKLQwenImage size=0.236 params=126892531 quant=None
2025-10-13 23:15:29,489 | aleri-pc | sd | INFO | sd_offload | Model class=QwenImageEditPipeline modules=3 size=18.035
2025-10-13 23:15:32,143 | aleri-pc | sd | INFO | sd_models | Load model: family=qwen time={'total': 577.25, 'load': 574.52, 'move': 2.73} native=0 memory={'ram': {'total': 62.74, 'used': 20.29, 'free': 42}, 'gpu': {'used': 1.18, 'total': 15.57, 'active': 0.24, 'peak': 11.3, 'retries': 0, 'oom': 0, 'swap': 0}, 'job': ''}
2025-10-13 23:15:32,318 | aleri-pc | sd | DEBUG | json_helpers | Save: file="/run/media/aleri/60b6f25f-f89b-41ea-929b-31bc47e210bc/AI/sdnext/config.json" json=16 bytes=678 time=0.168
2025-10-13 23:15:46,964 | aleri-pc | sd | DEBUG | gallery | Gallery: type=ws folder="outputs/image" files=23 time=0.002
2025-10-13 23:15:53,729 | aleri-pc | sd | DEBUG | generation_parameters_copypaste | Prompt parse: type="current" prompt="change the hair color to red
Negative prompt: 
Steps: 40, Size: 808x1080, Seed: 2868842353, CFG scale: 6, App: SD.Next, Version: 7c8f42f, Pipeline: QwenImageEditPipeline, Operations: img2img, Model: Qwen-Image-Edit, Init image size: 784x1008, Init image hash: 82f1cecc, Image CFG scale: 6, Denoising strength: 0.3"
2025-10-13 23:15:53,745 | aleri-pc | sd | DEBUG | generation_parameters_copypaste | Prompt restore: apply=[{'Prompt': 'change the hair color to red'}, {'Negative prompt': ''}, {'Steps': 40}, {'Size-1': 808}, {'Size-2': 1080}, {'Seed': 2868842353.0}, {'CFG scale': 6.0}, {'Image CFG scale': 6.0}, {'Denoising strength': 0.3}] skip={}
2025-10-13 23:16:57,526 | aleri-pc | sd | DEBUG | sd_samplers | Sampler: "Default" cls=FlowMatchEulerDiscreteScheduler config={'num_train_timesteps': 1000, 'shift': 1.0, 'use_dynamic_shifting': True, 'base_shift': 0.5, 'max_shift': 0.9, 'base_image_seq_len': 256, 'max_image_seq_len': 8192, 'invert_sigmas': False, 'shift_terminal': 0.02, 'use_karras_sigmas': False, 'use_exponential_sigmas': False, 'use_beta_sigmas': False, 'time_shift_type': 'exponential', 'stochastic_sampling': False}
2025-10-13 23:16:57,719 | aleri-pc | sd | INFO | processing_diffusers | Processing modifiers: apply
2025-10-13 23:16:58,026 | aleri-pc | sd | INFO | processing_args | Base: pipeline=QwenImageEditPipeline task=IMAGE_2_IMAGE batch=1/1x1 set={'prompt': 1, 'negative_prompt': 1, 'guidance_scale': 6, 'generator': 'cuda:[2868842353]', 'num_inference_steps': 40, 'true_cfg_scale': 0, 'output_type': 'np', 'image': [<PIL.Image.Image image mode=RGB size=784x1008 at 0x7EFD48281D90>], 'width': 784, 'height': 1008, 'parser': 'fixed'}
2025-10-13 23:16:58,459 | aleri-pc | sd | DEBUG | sd_hijack_te | Encode: prompt="['change the hair color to red']" hijack=True
2025-10-13 23:16:59,630 | aleri-pc | sd | TRACE | launch | Server: alive=True requests=548 memory=20.35/62.74 status='running' task='TE Encode' timestamp='20251013231658' current='task(95e40mr1woec1n0)' id='6e5840172b33452' job=0 jobs=1 total=12 step=0 steps=0 queued=0 uptime=854 elapsed=1.17 eta=None progress=0
2025-10-13 23:17:24,456 | aleri-pc | sd | DEBUG | devices | GC: current={'gpu': 9.6, 'ram': 20.49, 'oom': 0} prev={'gpu': 11.56, 'ram': 20.49} load={'gpu': 62, 'ram': 33} gc={'gpu': 1.96, 'py': 334} fn=hijack_encode_prompt:end why=threshold time=0.41
2025-10-13 23:17:32,626 | aleri-pc | sd | DEBUG | sd_hijack_vae | Encode: vae=AutoencoderKLQwenImage slicing=True tiling=False latents=[1, 3, 1, 1152, 896]:cuda:0:torch.bfloat16 time=8.143
2025-10-13 23:17:41,840 | aleri-pc | sd | ERROR | processing_callbacks | Callback: shape '[1, 67, 50, 16, 2, 2]' is invalid for input of size 197568
2025-10-13 23:18:59,684 | aleri-pc | sd | TRACE | launch | Server: alive=True requests=808 memory=21.36/62.74 status='idle' task='' timestamp=None current='task(95e40mr1woec1n0)' id='' job=0 jobs=0 total=13 step=16 steps=0 queued=0 uptime=974 elapsed=87.06 eta=None progress=0
2025-10-13 23:20:58,355 | aleri-pc | sd | DEBUG | devices | GC: current={'gpu': 12.19, 'ram': 21.36, 'oom': 0} prev={'gpu': 13.15, 'ram': 21.36} load={'gpu': 78, 'ram': 34} gc={'gpu': 0.96, 'py': 804} fn=hijack_vae_decode:begin why=threshold time=0.39
2025-10-13 23:20:59,761 | aleri-pc | sd | TRACE | launch | Server: alive=True requests=1067 memory=21.36/62.74 status='running' task='VAE Decode' timestamp='20251013232057' current='task(95e40mr1woec1n0)' id='5952fa1f99704ef' job=0 jobs=1 total=14 step=0 steps=0 queued=0 uptime=1094 elapsed=1.8 eta=None progress=0
2025-10-13 23:21:03,077 | aleri-pc | sd | DEBUG | sd_hijack_vae | Decode: vae=AutoencoderKLQwenImage slicing=True tiling=False latents=[1, 16, 1, 126, 98]:cuda:0:torch.bfloat16 time=4.722
2025-10-13 23:21:03,164 | aleri-pc | sd | INFO | processing_diffusers | Processing modifiers: unapply
2025-10-13 23:21:03,598 | aleri-pc | sd | INFO | images | Save: image="outputs/image/00024-2025-10-13-Qwen-Image-Edit.png" type=PNG width=784 height=1008 size=1061136
2025-10-13 23:21:03,602 | aleri-pc | sd | DEBUG | sd_models | Pipeline class change: original=QwenImageEditPipeline target=QwenImageEditPipeline device=cpu fn=process_images:process_images_inner
2025-10-13 23:21:03,602 | aleri-pc | sd | INFO | processing | Processed: images=1 its=0.16 ops=['img2img']
2025-10-13 23:21:03,604 | aleri-pc | sd | DEBUG | processing | Processed: timers={'total': 285.98, 'pipeline': 245.44, 'te': 25.59, 'vae': 12.87, 'gc': 1.17, 'post': 0.44, 'callback': 0.22, 'pre': 0.2, 'prepare': 0.05}
2025-10-13 23:21:03,604 | aleri-pc | sd | DEBUG | processing | Processed: memory={'ram': {'total': 62.74, 'used': 21.4, 'free': 41}, 'gpu': {'used': 4.62, 'total': 15.57, 'active': 0.25, 'peak': 11.91, 'retries': 0, 'oom': 0, 'swap': 0}, 'job': ''}

alerikaisattera avatar Oct 14 '25 03:10 alerikaisattera

There is already some awareness in the community regarding Diffusers implementation of Qwen Pipeline being in some way inferior or bugged compared to others, the below read might shine some light on the issue. More testing is needed, and scanning more existing issues open in Diffusers, so that we don't end up reinventing the wheel when investigating, and potential changes on SDnext side not related to upstream issues actually target the root cause, rather than being the closest thing "that kinda works sometimes".

https://github.com/huggingface/diffusers/issues/12216

As noted by others in that thread debugging this is difficult, and the relationship between the parameters and their influence on the outputs not always obvious.

Case in point, the below input/output pair has a resolution not in multiples of 112, being 1024x1024 and the issues reported in the other issue are not present:

Image

thanks @CalamitousFelicitousness, this is a good writeup. and based on that, the root cause seems to be inside the original model implementation as diffusers implementation was submitted by original model authors. i'm ok with keeping this open and monitoring the progress upstream, but i don't think there is much that i can do from sdnext side directly other than forking the pipeline implementation and changing it myself - and i really dont want to do that.

vladmandic avatar Oct 14 '25 13:10 vladmandic

This particular problem seems to be distinct from the bug in Diffusers relevant to 4258, as that bug causes numerous unwanted alterations along with a general "sloppy" feel, while this is just scaling with cropping. This can only be said conclusively after the Diffusers bug is fixed

alerikaisattera avatar Oct 14 '25 15:10 alerikaisattera