vladmandic / automatic

SD.Next: Advanced Implementation of Stable Diffusion and other Diffusion-based generative image models
https://github.com/vladmandic/automatic
GNU Affero General Public License v3.0
5.51k stars 402 forks source link

[Issue] Use original name for output filename does not work in process batch #1816

Closed bdulfer closed 1 year ago

bdulfer commented 1 year ago

Issue Description

The setting "Use original name for output filename during batch process" (use_original_name_batch) does not work.

Neither in Process Batch nor in Process Folder.

Always a new filename is generated following the filename pattern.

Tested after reinstall, all extensions disabled, --safe used.

Version Platform Description

From System Info

Version: app: SD.next updated: 2023-07-23 hash: 3da96422 url: https://github.com/vladmandic/automatic/tree/master

Platform: arch: x86_64 cpu: x86_64 system: Linux release: 5.14.21-150400.24.69-default python: 3.10.11

Relevant log output

No response

Acknowledgements

vladmandic commented 1 year ago

i just tried img2img -> batch and it worked for me. please run with --debug and it will capture image save.

bdulfer commented 1 year ago

Sorry, perhaps I was not specific enough.

The problem appears with Process Image -> Process Folder.

It worked after you patched it last time.

I'll run with --debug in a minute. System is busy at the moment.

bdulfer commented 1 year ago

Here is the debug output:

14:18:04-880236 INFO     Extension preload: 0.0s /data/bernd/StableDiffusion/v/extensions                                                                                                                                                                                      
14:18:04-891740 DEBUG    Memory used: 0.03 total: 31.26 Collected 0                                                                                                                                                                                                            
14:18:04-892823 DEBUG    Starting module: <module 'webui' from '/data/bernd/vlamandic/webui.py'>                                                                                                                                                                               
14:18:04-893721 INFO     Server arguments: ['--data-dir', '/data/bernd/StableDiffusion/v', '--models-dir', '/data/bernd/StableDiffusion/models', '--skip-requirements', '--skip-extensions', '--skip-git', '--api-auth', 'bla:bla', '--debug']                                 
14:18:04-921473 DEBUG    Loading Torch                                                                                                                                                                                                                                         
14:18:11-442628 DEBUG    Loading Gradio                                                                                                                                                                                                                                        
14:18:12-416363 DEBUG    Loading Modules                                                                                                                                                                                                                                       
14:18:14-498768 DEBUG    Reading: /data/bernd/StableDiffusion/v/config.json len=317                                                                                                                                                                                            
14:18:14-500870 INFO     Pipeline: Backend.ORIGINAL                                                                                                                                                                                                                            
14:18:14-503782 DEBUG    Loaded styles: /data/bernd/StableDiffusion/v/styles.csv 36                                                                                                                                                                                            
14:18:15-136127 DEBUG    Samplers enumerated: ['UniPC', 'DDIM', 'PLMS', 'Euler a', 'Euler', 'DPM++ 2S a', 'DPM++ 2S a Karras', 'DPM++ 2M', 'DPM++ 2M Karras', 'DPM++ SDE', 'DPM++ SDE Karras', 'DPM++ 2M SDE', 'DPM++ 2M SDE Karras', 'DPM fast', 'DPM adaptive', 'DPM2', 'DPM2
                         Karras', 'DPM2 a', 'DPM2 a Karras', 'LMS', 'LMS Karras', 'Heun']                                                                                                                                                                                      
14:18:15-167550 INFO     Libraries loaded                                                                                                                                                                                                                                      
14:18:15-168792 DEBUG    Entering start sequence                                                                                                                                                                                                                               
14:18:15-190333 DEBUG    Version: {'app': 'sd.next', 'updated': '2023-07-23', 'hash': '3da96422', 'url': 'https://github.com/vladmandic/automatic/tree/master'}                                                                                                                
14:18:15-192802 INFO     Using data path: /data/bernd/StableDiffusion/v                                                                                                                                                                                                        
14:18:15-194685 DEBUG    Event loop: <_UnixSelectorEventLoop running=False closed=False debug=False>                                                                                                                                                                           
14:18:15-196540 DEBUG    Entering initialize                                                                                                                                                                                                                                   
14:18:15-517023 INFO     Available VAEs: /data/bernd/StableDiffusion/models/VAE 39                                                                                                                                                                                             
14:18:15-543206 DEBUG    Reading: /data/bernd/StableDiffusion/v/cache.json len=2                                                                                                                                                                                               
14:18:15-573517 DEBUG    Reading: /data/bernd/StableDiffusion/v/metadata.json len=425                                                                                                                                                                                          
14:18:15-608869 INFO     Available models: /data/bernd/StableDiffusion/models/Stable-diffusion 242                                                                                                                                                                             
14:18:15-666972 DEBUG    Loading scripts                                                                                                                                                                                                                                       
14:18:17-788465 INFO     ControlNet v1.1.233                                                                                                                                                                                                                                   
ControlNet preprocessor location: /data/bernd/vlamandic/extensions-builtin/sd-webui-controlnet/annotator/downloads
14:18:17-986233 INFO     ControlNet v1.1.233                                                                                                                                                                                                                                   
14:18:19-136249 DEBUG    Scripts load: ['a1111-sd-webui-lycoris:0.684s', 'clip-interrogator-ext:0.065s', 'LDSR:0.059s', 'Lora:0.387s', 'sd-extension-system-info:0.115s', 'sd-webui-agent-scheduler:0.43s', 'sd-webui-controlnet:0.573s',                                      
                         'stable-diffusion-webui-rembg:0.722s', 'SwinIR:0.064s', 'ScuNET:0.064s', 'sd-model-preview-xd:0.146s', 'stable-diffusion-webui-state:0.124s']                                                                                                         
14:18:19-911285 INFO     Loading UI theme: name=sudeepshouche/minimalist style=Light                                                                                                                                                                                           
14:18:19-920811 DEBUG    Creating UI                                                                                                                                                                                                                                           
14:18:20-163515 DEBUG    Extra networks: checkpoints items=242 subdirs=232                                                                                                                                                                                                     
14:18:20-277729 DEBUG    Extra networks: lora items=146 subdirs=98                                                                                                                                                                                                             
14:18:20-299801 DEBUG    Extra networks: lycoris items=6 subdirs=8                                                                                                                                                                                                             
14:18:20-302207 DEBUG    Extra networks: textual inversion items=2 subdirs=0                                                                                                                                                                                                   
14:18:20-305034 DEBUG    Extra networks: hypernetworks items=7 subdirs=5                                                                                                                                                                                                       
14:18:20-592589 DEBUG    Reading: /data/bernd/StableDiffusion/v/ui-config.json len=1626                                                                                                                                                                                        
14:18:21-556035 DEBUG    Select checkpoint: model xenoreality_v10.safetensors [b7fd402c57]                                                                                                                                                                                     
14:18:21-559548 DEBUG    Load model weights: existing=False target=/data/bernd/StableDiffusion/models/Stable-diffusion/xenoreality_v10.safetensors info=None                                                                                                                   
14:18:21-800242 DEBUG    gc: collected=761 device=cuda {'ram': {'used': 1.29, 'total': 31.26}, 'gpu': {'used': 0.26, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                  
Loading weights: /data/bernd/StableDiffusion/models/Stable-diffusion/xenoreality_v10.safetensors ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 GB 0:00:00
14:18:22-875399 DEBUG    Load model: name=/data/bernd/StableDiffusion/models/Stable-diffusion/xenoreality_v10.safetensors dict=True                                                                                                                                            
14:18:22-876693 DEBUG    Verifying Torch settings                                                                                                                                                                                                                              
14:18:22-917265 DEBUG    Torch FP16 test passed                                                                                                                                                                                                                                
14:18:22-918374 DEBUG    Desired Torch parameters: dtype=FP16 no-half=False no-half-vae=False upscast=True                                                                                                                                                                     
14:18:22-919365 INFO     Setting Torch parameters: dtype=torch.float16 vae=torch.float16 unet=torch.float16                                                                                                                                                                    
14:18:22-920320 DEBUG    Torch default device: cuda                                                                                                                                                                                                                            
14:18:22-921446 DEBUG    Model dict loaded: {'ram': {'used': 3.31, 'total': 31.26}, 'gpu': {'used': 0.28, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                             
14:18:22-937453 DEBUG    Model config loaded: {'ram': {'used': 3.31, 'total': 31.26}, 'gpu': {'used': 0.28, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                           
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
14:18:23-982468 DEBUG    Model created from config: /data/bernd/vlamandic/configs/v1-inference.yaml                                                                                                                                                                            
14:18:23-984088 DEBUG    Model weights loading: {'ram': {'used': 7.31, 'total': 31.26}, 'gpu': {'used': 0.28, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                         
14:18:25-055599 DEBUG    Model weights loaded: {'ram': {'used': 5.33, 'total': 31.26}, 'gpu': {'used': 0.28, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                          
14:18:25-356919 DEBUG    Model weights moved: {'ram': {'used': 3.34, 'total': 31.26}, 'gpu': {'used': 2.31, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                           
14:18:25-365050 INFO     Applying xformers cross attention optimization                                                                                                                                                                                                        
14:18:25-427909 INFO     Embeddings: loaded=3 skipped=0                                                                                                                                                                                                                        
14:18:25-435872 INFO     Model loaded in 3.6s (load=1.1s config=0.1s create=1.0s apply=0.4s vae=0.7s move=0.3s embeddings=0.1s)                                                                                                                                                
14:18:25-681287 DEBUG    gc: collected=291 device=cuda {'ram': {'used': 3.41, 'total': 31.26}, 'gpu': {'used': 2.31, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                  
14:18:25-682958 INFO     Model load finished: {'ram': {'used': 3.41, 'total': 31.26}, 'gpu': {'used': 2.31, 'total': 11.76}, 'retries': 0, 'oom': 0} cached=0                                                                                                                  
14:18:25-907817 DEBUG    Script: 5.11s ui_tabs /data/bernd/StableDiffusion/v/extensions/sd-model-preview-xd/scripts/modelpreview.py                                                                                                                                            
14:18:25-927694 DEBUG    Extensions list loaded: /data/bernd/vlamandic/html/extensions.json                                                                                                                                                                                    
14:18:26-086334 DEBUG    Extension list refresh: processed=195 installed=17 enabled=14 disabled=3 visible=195 hidden=0                                                                                                                                                         
Running on local URL:  http://127.0.0.1:7860
14:18:26-327271 INFO     Local URL: http://127.0.0.1:7860/                                                                                                                                                                                                                     
14:18:26-329082 DEBUG    Gradio registered functions: 980                                                                                                                                                                                                                      
14:18:26-330588 INFO     Initializing middleware                                                                                                                                                                                                                               
14:18:26-336722 DEBUG    Creating API                                                                                                                                                                                                                                          
14:18:26-476126 INFO     [AgentScheduler] Task queue is empty                                                                                                                                                                                                                  
14:18:26-477230 INFO     [AgentScheduler] Registering APIs                                                                                                                                                                                                                     
14:18:26-558631 DEBUG    Scripts setup: ['ControlNet:0.016s', 'Dynamic Prompts v2.14.0:0.012s', 'X/Y/Z grid:0.005s', 'Alternative:0.012s']                                                                                                                                     
14:18:26-559817 DEBUG    Scripts components: []                                                                                                                                                                                                                                
14:18:26-628947 DEBUG    Saving: /data/bernd/StableDiffusion/v/metadata.json len=2514999                                                                                                                                                                                       
14:18:26-632909 INFO     Model metadata saved: /data/bernd/StableDiffusion/v/metadata.json 3                                                                                                                                                                                   
14:18:26-897840 DEBUG    gc: collected=18007 device=cuda {'ram': {'used': 1.46, 'total': 31.26}, 'gpu': {'used': 2.31, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                
14:18:27-156308 DEBUG    gc: collected=248 device=cuda {'ram': {'used': 1.46, 'total': 31.26}, 'gpu': {'used': 2.31, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                  
14:18:27-157784 INFO     Startup time: 22.2s (torch=6.5s gradio=1.0s libraries=2.8s vae=0.4s models=0.1s scripts=3.5s onchange=0.8s ui-txt2img=0.4s ui-img2img=0.2s ui-settings=0.1s ui-extensions=5.4s launch=0.2s app-started=0.2s checkpoint=0.6s)                          
14:19:09-510184 DEBUG    gc: collected=408 device=cuda {'ram': {'used': 1.45, 'total': 31.26}, 'gpu': {'used': 2.31, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                  
14:19:09-772336 DEBUG    gc: collected=248 device=cuda {'ram': {'used': 1.45, 'total': 31.26}, 'gpu': {'used': 2.31, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                  
14:19:10-037497 DEBUG    gc: collected=248 device=cuda {'ram': {'used': 1.45, 'total': 31.26}, 'gpu': {'used': 2.31, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                  
        Tile 1/12
        Tile 2/12
        Tile 3/12
        Tile 4/12
        Tile 5/12
        Tile 6/12
        Tile 7/12
        Tile 8/12
        Tile 9/12
        Tile 10/12
        Tile 11/12
        Tile 12/12
14:19:21-052347 DEBUG    gc: collected=145 device=cuda {'ram': {'used': 2.62, 'total': 31.26}, 'gpu': {'used': 2.95, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                  
14:19:21-783020 DEBUG    Saving image: PNG /home/bernd/Downloads/aaa/xenoreality_v10-20230724141921.png (2048, 1384)                                                                                                                                                           
14:19:23-503385 DEBUG    gc: collected=124 device=cuda {'ram': {'used': 3.15, 'total': 31.26}, 'gpu': {'used': 2.47, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                  
14:19:23-774606 DEBUG    gc: collected=248 device=cuda {'ram': {'used': 3.14, 'total': 31.26}, 'gpu': {'used': 2.47, 'total': 11.76}, 'retries': 0, 'oom': 0}       
vladmandic commented 1 year ago

i still cant reproduce:

original name: Screenshot_20221225_102947_Instagram generated:

08:31:08-475467 DEBUG Saving image: JPEG /tmp/test/Screenshot_20221225_102947_Instagram-0001-.jpg (1726, 1914)

bdulfer commented 1 year ago

Interesting.

I'll try --reinstall and --safe.

bdulfer commented 1 year ago

Could it matter somehow that I don't use the standard naming pattern?

I use [model_name]-[datetime].

Question: Where in the code is the filename determined? Which file can I pepper with my own debug output and check?

Original filename is d5e2c62ba5ecfdc0827c7d6b159e81a8.png

Here is the debug output after reinstall with --safe:

14:49:17-002961 INFO     Starting SD.Next                                                                                                                                                                                                                                      
14:49:17-006599 INFO     Python 3.10.11 on Linux                                                                                                                                                                                                                               
14:49:17-012322 INFO     Version: d4aa840a Mon Jul 24 16:10:01 2023 +0900                                                                                                                                                                                                      
14:49:17-127398 INFO     Latest published version: 7bbab3c9a9cae58a73dabdb2222e161f83011c1c 2023-07-24T12:27:13Z                                                                                                                                                               
14:49:17-129555 DEBUG    Setting environment tuning                                                                                                                                                                                                                            
14:49:17-131159 DEBUG    Torch overrides: cuda=False rocm=False ipex=False diml=False                                                                                                                                                                                          
14:49:17-132745 DEBUG    Torch allowed: cuda=True rocm=True ipex=True diml=True                                                                                                                                                                                                
14:49:17-133712 INFO     nVidia CUDA toolkit detected                                                                                                                                                                                                                          
14:49:17-152054 WARNING  Modified files: ['models/.placeholder', 'models/VAE-approx/model.pt', 'models/karlo/ViT-L-14_stats.th', 'models']                                                                                                                                     
14:49:17-159925 DEBUG    Repository update time: Mon Jul 24 09:10:01 2023                                                                                                                                                                                                      
14:49:17-161045 DEBUG    Previous setup time: Mon Jul 24 14:42:45 2023                                                                                                                                                                                                         
14:49:17-161881 INFO     Disabled extensions: ['stable-diffusion-webui-images-browser', 'sd-dynamic-thresholding', 'multidiffusion-upscaler-for-automatic1111']                                                                                                                
14:49:17-162786 INFO     Enabled extensions-builtin: ['stable-diffusion-webui-rembg', 'clip-interrogator-ext', 'LDSR', 'Lora', 'sd-webui-controlnet', 'ScuNET', 'SwinIR', 'a1111-sd-webui-lycoris', 'sd-extension-system-info', 'sd-webui-agent-scheduler']                    
14:49:17-164289 DEBUG    Latest extensions time: Mon Jul 24 14:42:21 2023                                                                                                                                                                                                      
14:49:17-165103 DEBUG    Timestamps: version:1690182601 setup:1690202565 extension:1690202541                                                                                                                                                                                  
14:49:17-166188 INFO     No changes detected: Quick launch active                                                                                                                                                                                                              
14:49:17-166956 INFO     Verifying requirements                                                                                                                                                                                                                                
14:49:17-191617 INFO     Disabled extensions: ['stable-diffusion-webui-images-browser', 'sd-dynamic-thresholding', 'multidiffusion-upscaler-for-automatic1111']                                                                                                                
14:49:17-192718 INFO     Enabled extensions-builtin: ['stable-diffusion-webui-rembg', 'clip-interrogator-ext', 'LDSR', 'Lora', 'sd-webui-controlnet', 'ScuNET', 'SwinIR', 'a1111-sd-webui-lycoris', 'sd-extension-system-info', 'sd-webui-agent-scheduler']                    
14:49:17-194134 INFO     Running in safe mode without user extensions                                                                                                                                                                                                          
14:49:17-196256 INFO     Extension preload: 0.0s /data/bernd/vlamandic/extensions-builtin                                                                                                                                                                                      
14:49:17-204547 DEBUG    Memory used: 0.04 total: 31.26 Collected 0                                                                                                                                                                                                            
14:49:17-205584 DEBUG    Starting module: <module 'webui' from '/data/bernd/vlamandic/webui.py'>                                                                                                                                                                               
14:49:17-206509 INFO     Server arguments: ['--data-dir', '/data/bernd/StableDiffusion/v', '--models-dir', '/data/bernd/StableDiffusion/models', '--safe', '--debug']                                                                                                          
14:49:17-215729 DEBUG    Loading Torch                                                                                                                                                                                                                                         
14:49:20-906493 DEBUG    Loading Gradio                                                                                                                                                                                                                                        
14:49:21-683789 DEBUG    Loading Modules                                                                                                                                                                                                                                       
14:49:22-977295 DEBUG    Reading: /data/bernd/StableDiffusion/v/config.json len=317                                                                                                                                                                                            
14:49:22-979398 INFO     Pipeline: Backend.ORIGINAL                                                                                                                                                                                                                            
14:49:22-980725 DEBUG    Loaded styles: /data/bernd/StableDiffusion/v/styles.csv 36                                                                                                                                                                                            
14:49:23-430884 DEBUG    Samplers enumerated: ['UniPC', 'DDIM', 'PLMS', 'Euler a', 'Euler', 'DPM++ 2S a', 'DPM++ 2S a Karras', 'DPM++ 2M', 'DPM++ 2M Karras', 'DPM++ SDE', 'DPM++ SDE Karras', 'DPM++ 2M SDE', 'DPM++ 2M SDE Karras', 'DPM fast', 'DPM adaptive', 'DPM2', 'DPM2
                         Karras', 'DPM2 a', 'DPM2 a Karras', 'LMS', 'LMS Karras', 'Heun']                                                                                                                                                                                      
14:49:23-445851 INFO     Libraries loaded                                                                                                                                                                                                                                      
14:49:23-447138 DEBUG    Entering start sequence                                                                                                                                                                                                                               
14:49:23-458836 DEBUG    Version: {'app': 'sd.next', 'updated': '2023-07-24', 'hash': 'd4aa840a', 'url': 'https://github.com/vladmandic/automatic/tree/master'}                                                                                                                
14:49:23-461387 INFO     Using data path: /data/bernd/StableDiffusion/v                                                                                                                                                                                                        
14:49:23-463414 DEBUG    Event loop: <_UnixSelectorEventLoop running=False closed=False debug=False>                                                                                                                                                                           
14:49:23-465426 DEBUG    Entering initialize                                                                                                                                                                                                                                   
14:49:23-576987 INFO     Available VAEs: /data/bernd/StableDiffusion/models/VAE 39                                                                                                                                                                                             
14:49:23-602885 DEBUG    Reading: /data/bernd/StableDiffusion/v/cache.json len=2                                                                                                                                                                                               
14:49:23-624984 DEBUG    Reading: /data/bernd/StableDiffusion/v/metadata.json len=428                                                                                                                                                                                          
14:49:23-647449 INFO     Available models: /data/bernd/StableDiffusion/models/Stable-diffusion 242                                                                                                                                                                             
14:49:23-677690 DEBUG    Loading scripts                                                                                                                                                                                                                                       
14:49:25-702698 INFO     ControlNet v1.1.233                                                                                                                                                                                                                                   
ControlNet v1.1.233
ControlNet preprocessor location: /data/bernd/vlamandic/extensions-builtin/sd-webui-controlnet/annotator/downloads
14:49:25-899935 INFO     ControlNet v1.1.233                                                                                                                                                                                                                                   
ControlNet v1.1.233
14:49:26-445366 DEBUG    Scripts load: ['a1111-sd-webui-lycoris:0.686s', 'clip-interrogator-ext:0.063s', 'LDSR:0.06s', 'Lora:0.347s', 'sd-extension-system-info:0.117s', 'sd-webui-agent-scheduler:0.611s', 'sd-webui-controlnet:0.336s',                                      
                         'stable-diffusion-webui-rembg:0.415s', 'SwinIR:0.064s', 'ScuNET:0.063s']                                                                                                                                                                              
Scripts load: ['a1111-sd-webui-lycoris:0.686s', 'clip-interrogator-ext:0.063s', 'LDSR:0.06s', 'Lora:0.347s', 'sd-extension-system-info:0.117s', 'sd-webui-agent-scheduler:0.611s', 'sd-webui-controlnet:0.336s', 'stable-diffusion-webui-rembg:0.415s', 'SwinIR:0.064s', 'ScuNET:0.063s']
14:49:27-028608 INFO     Loading UI theme: name=sudeepshouche/minimalist style=Light                                                                                                                                                                                           
14:49:27-032809 DEBUG    Creating UI                                                                                                                                                                                                                                           
14:49:27-212312 DEBUG    Extra networks: checkpoints items=242 subdirs=232                                                                                                                                                                                                     
14:49:27-321349 DEBUG    Extra networks: lora items=146 subdirs=98                                                                                                                                                                                                             
14:49:27-343315 DEBUG    Extra networks: lycoris items=6 subdirs=8                                                                                                                                                                                                             
14:49:27-345280 DEBUG    Extra networks: textual inversion items=2 subdirs=0                                                                                                                                                                                                   
14:49:27-348045 DEBUG    Extra networks: hypernetworks items=7 subdirs=5                                                                                                                                                                                                       
14:49:27-616864 DEBUG    Reading: /data/bernd/StableDiffusion/v/ui-config.json len=1626                                                                                                                                                                                        
14:49:27-822287 DEBUG    Extensions list loaded: /data/bernd/vlamandic/html/extensions.json                                                                                                                                                                                    
14:49:27-923348 DEBUG    Extension list refresh: processed=195 installed=13 enabled=10 disabled=3 visible=195 hidden=0                                                                                                                                                         
Running on local URL:  http://127.0.0.1:7860
14:49:28-382589 INFO     Local URL: http://127.0.0.1:7860/                                                                                                                                                                                                                     
14:49:28-384396 DEBUG    Gradio registered functions: 909                                                                                                                                                                                                                      
14:49:28-385899 INFO     Initializing middleware                                                                                                                                                                                                                               
14:49:28-391812 DEBUG    Creating API                                                                                                                                                                                                                                          
14:49:28-533581 INFO     [AgentScheduler] Task queue is empty                                                                                                                                                                                                                  
14:49:28-534674 INFO     [AgentScheduler] Registering APIs                                                                                                                                                                                                                     
14:49:28-610510 DEBUG    Scripts setup: ['ControlNet:0.016s', 'Alternative:0.011s']                                                                                                                                                                                            
14:49:28-611802 DEBUG    Scripts components: []                                                                                                                                                                                                                                
14:49:28-613416 DEBUG    Model metadata: /data/bernd/StableDiffusion/v/metadata.json no changes                                                                                                                                                                                
14:49:28-869021 DEBUG    gc: collected=17413 device=cuda {'ram': {'used': 1.3, 'total': 31.26}, 'gpu': {'used': 0.26, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                 
14:49:28-870892 DEBUG    Select checkpoint: model xenoreality_v10.safetensors [b7fd402c57]                                                                                                                                                                                     
14:49:28-873116 DEBUG    Load model weights: existing=False target=/data/bernd/StableDiffusion/models/Stable-diffusion/xenoreality_v10.safetensors info=None                                                                                                                   
14:49:29-123272 DEBUG    gc: collected=124 device=cuda {'ram': {'used': 1.3, 'total': 31.26}, 'gpu': {'used': 0.26, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                   
14:49:29-374773 DEBUG    gc: collected=248 device=cuda {'ram': {'used': 1.3, 'total': 31.26}, 'gpu': {'used': 0.26, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                   
Loading weights: /data/bernd/StableDiffusion/models/Stable-diffusion/xenoreality_v10.safetensors ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 GB 0:00:00
14:49:30-470402 DEBUG    Load model: name=/data/bernd/StableDiffusion/models/Stable-diffusion/xenoreality_v10.safetensors dict=True                                                                                                                                            
14:49:30-471666 DEBUG    Verifying Torch settings                                                                                                                                                                                                                              
14:49:30-500449 DEBUG    Torch FP16 test passed                                                                                                                                                                                                                                
14:49:30-501552 DEBUG    Desired Torch parameters: dtype=FP16 no-half=False no-half-vae=False upscast=True                                                                                                                                                                     
14:49:30-502520 INFO     Setting Torch parameters: dtype=torch.float16 vae=torch.float16 unet=torch.float16                                                                                                                                                                    
14:49:30-503441 DEBUG    Torch default device: cuda                                                                                                                                                                                                                            
14:49:30-504544 DEBUG    Model dict loaded: {'ram': {'used': 3.31, 'total': 31.26}, 'gpu': {'used': 0.28, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                             
14:49:30-520404 DEBUG    Model config loaded: {'ram': {'used': 3.31, 'total': 31.26}, 'gpu': {'used': 0.28, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                           
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
14:49:31-539582 DEBUG    Model created from config: /data/bernd/vlamandic/configs/v1-inference.yaml                                                                                                                                                                            
14:49:31-541181 DEBUG    Model weights loading: {'ram': {'used': 7.31, 'total': 31.26}, 'gpu': {'used': 0.28, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                         
14:49:32-630525 DEBUG    Model weights loaded: {'ram': {'used': 5.33, 'total': 31.26}, 'gpu': {'used': 0.28, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                          
14:49:32-936810 DEBUG    Model weights moved: {'ram': {'used': 3.34, 'total': 31.26}, 'gpu': {'used': 2.31, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                           
14:49:32-944990 INFO     Applying xformers cross attention optimization                                                                                                                                                                                                        
14:49:32-989977 INFO     Embeddings: loaded=3 skipped=0                                                                                                                                                                                                                        
14:49:32-997842 INFO     Model loaded in 3.6s (load=1.1s create=1.0s apply=0.4s vae=0.7s move=0.3s)                                                                                                                                                                            
14:49:33-253764 DEBUG    gc: collected=291 device=cuda {'ram': {'used': 3.42, 'total': 31.26}, 'gpu': {'used': 2.31, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                  
14:49:33-255440 INFO     Model load finished: {'ram': {'used': 3.42, 'total': 31.26}, 'gpu': {'used': 2.31, 'total': 11.76}, 'retries': 0, 'oom': 0} cached=0                                                                                                                  
14:49:33-540416 DEBUG    gc: collected=124 device=cuda {'ram': {'used': 1.43, 'total': 31.26}, 'gpu': {'used': 2.31, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                  
14:49:33-542066 INFO     Startup time: 16.3s (torch=3.7s gradio=0.8s libraries=1.8s vae=0.1s models=0.1s scripts=2.8s onchange=0.6s ui-txt2img=0.3s ui-img2img=0.2s ui-settings=0.1s ui-extensions=0.3s ui-defaults=0.3s launch=0.2s app-started=0.2s checkpoint=4.9s)         
14:49:59-580241 DEBUG    Server alive=True Requests=17 memory used: 1.43 total: 31.26                                                                                                                                                                                          
14:50:07-209703 DEBUG    gc: collected=721 device=cuda {'ram': {'used': 1.43, 'total': 31.26}, 'gpu': {'used': 2.31, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                  
14:50:07-475322 DEBUG    gc: collected=248 device=cuda {'ram': {'used': 1.43, 'total': 31.26}, 'gpu': {'used': 2.35, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                  
14:50:07-735747 DEBUG    gc: collected=248 device=cuda {'ram': {'used': 1.43, 'total': 31.26}, 'gpu': {'used': 2.33, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                  
        Tile 1/12
        Tile 2/12
        Tile 3/12
        Tile 4/12
        Tile 5/12
        Tile 6/12
        Tile 7/12
        Tile 8/12
        Tile 9/12
        Tile 10/12
        Tile 11/12
        Tile 12/12
14:50:17-380127 DEBUG    gc: collected=145 device=cuda {'ram': {'used': 2.6, 'total': 31.26}, 'gpu': {'used': 2.98, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                   
14:50:18-133013 DEBUG    Saving image: PNG /home/bernd/Downloads/aaa/xenoreality_v10-20230724145018.png (2048, 1384)                                                                                                                                                           
14:50:19-834165 DEBUG    gc: collected=124 device=cuda {'ram': {'used': 3.12, 'total': 31.26}, 'gpu': {'used': 2.36, 'total': 11.76}, 'retries': 0, 'oom': 0}                                                                                                                  
14:50:20-099130 DEBUG    gc: collected=248 device=cuda {'ram': {'used': 3.12, 'total': 31.26}, 'gpu': {'used': 2.36, 'total': 11.76}, 'retries': 0, 'oom': 0} 
vladmandic commented 1 year ago

just took a look at the code, i think basename is applied only if you have save_images_add_number enabled - can you try that?

bdulfer commented 1 year ago

It does influence the naming.

Now it is a combination of the old name, the number and the pattern: d5e2c62ba5ecfdc0827c7d6b159e81a8-0000-xenoreality_v10-20230724155024.png

I did some investigation myself. Working backwards from the debug message: The saving of the image is initiated in postprocessing.py. There the flag opts.use_original_name_batch is checked in line 63 In line 77 save_image() is called, with forced_filename = None. In save_image() from image.py the parameter force_filename is checked. If it is None, a new filename is generated.

So I think the easiest patch would be to set forced_filename to the correct value somewhere in line 64. I tried the following: Line 63 onward:

        if opts.use_original_name_batch and name is not None:
            basename = os.path.splitext(os.path.basename(name))[0]
            forced_filename = basename
        else:
            basename = ''
            forced_filename = None

And then use forced_filename in the save_image call.

It works. And as far as I can find, it doesn't destroy anything else.

vladmandic commented 1 year ago

no, i don't want to force name. i've changed it so it uses basename correctly and still applies pattern, so its going to be basename-pattern if there is basename, otherwise pattern. if you want to omit pattern, its up to you to set pattern to blank.

bdulfer commented 1 year ago

Hm.

This would mean that I have to change the pattern every time I do some batch upscaling. And have to change it again when I do normal creation from text.

That's not very convenient.

The forcing would only be done if the flag Use original name for output filename during batch process in Image Options is set. And it would just work as expected.

Perhaps you can reconsider?