lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
5.42k stars 541 forks source link

[Bug]: UnicodeDecodeError when trying to save outputs. #302

Closed VantomPayne closed 5 months ago

VantomPayne commented 5 months ago

Checklist

What happened?

I was not able to save any images generated whether by Text2Img or Img2Img since changing my build to Forge.

Steps to reproduce the problem

  1. Generate images as usual.
  2. Click Save.
  3. Console outputs error, images were not saved.

What should have happened?

  1. Images should be saved correctly.

What browsers do you use to access the UI ?

Google Chrome

Sysinfo

sysinfo-2024-02-17-16-15.json

Console logs

venv "F:\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: f0.0.12-latest-181-g9e42470a
Commit hash: 9e42470a2d990e73e567275cff2e6ada19ddea0c
CUDA 12.1
Launching Web UI with arguments: --theme dark --always-gpu
Total VRAM 12287 MB, total RAM 32546 MB
Set vram state to: HIGH_VRAM
Device: cuda:0 NVIDIA GeForce RTX 3080 : native
VAE dtype: torch.bfloat16
no module 'xformers'. Processing without...
no module 'xformers'. Processing without...
No module 'xformers'. Proceeding without it.
F:\stable-diffusion-webui\venv\lib\site-packages\pytorch_lightning\utilities\distributed.py:258: LightningDeprecationWarning: `pytorch_lightning.utilities.distributed.rank_zero_only` has been deprecated in v1.8.1 and will be removed in v2.0.0. You can import it from `pytorch_lightning.utilities` instead.
  rank_zero_deprecation(
Using pytorch cross attention
ControlNet preprocessor location: F:\stable-diffusion-webui\models\ControlNetPreprocessor
Civitai Helper: Get Custom Model Folder
Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
[-] ADetailer initialized. version: 24.1.2, num models: 17
*** Error loading script: old_six_prompt.py
    Traceback (most recent call last):
      File "F:\stable-diffusion-webui\modules\scripts.py", line 541, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "F:\stable-diffusion-webui\modules\script_loading.py", line 10, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "F:\stable-diffusion-webui\extensions\sd-webui-oldsix-prompt\scripts\old_six_prompt.py", line 6, in <module>
        from bs4 import BeautifulSoup
    ModuleNotFoundError: No module named 'bs4'

---
00:07:08 - ReActor - STATUS - Running v0.7.0-a1 on Device: CUDA
[ControlNet-Travel] extension Mikubill/sd-webui-controlnet found, ControlNet-Travel loaded :)
Loading weights [35937afca8] from F:\stable-diffusion-webui\models\Stable-diffusion\lazymixRealAmateur_v40Inpainting.safetensors
2024-02-18 00:07:09,483 - AnimateDiff - INFO - Injecting LCM to UI.
model_type EPS
UNet ADM Dimension 0
2024-02-18 00:07:09,924 - ControlNet - INFO - ControlNet UI callback registered.
2024-02-18 00:07:09,952 - AnimateDiff - INFO - Hacking i2i-batch.
2048 1152
1102
Civitai Helper: Settings:
Civitai Helper: max_size_preview: True
Civitai Helper: skip_nsfw_preview: False
Civitai Helper: open_url_with_js: True
Civitai Helper: proxy:
Civitai Helper: use civitai api key: False
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Using pytorch attention in VAE
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
Using pytorch attention in VAE
Startup time: 24.7s (prepare environment: 5.8s, import torch: 6.4s, initialize shared: 0.1s, other imports: 0.5s, list SD models: 0.7s, load scripts: 8.9s, create ui: 1.7s, gradio launch: 0.4s).
extra {'cond_stage_model.clip_l.logit_scale', 'cond_stage_model.clip_l.text_projection'}
left over keys: dict_keys(['alphas_cumprod', 'alphas_cumprod_prev', 'betas', 'log_one_minus_alphas_cumprod', 'model_ema.decay', 'model_ema.num_updates', 'posterior_log_variance_clipped', 'posterior_mean_coef1', 'posterior_mean_coef2', 'posterior_variance', 'sqrt_alphas_cumprod', 'sqrt_one_minus_alphas_cumprod', 'sqrt_recip_alphas_cumprod', 'sqrt_recipm1_alphas_cumprod'])
loaded straight to GPU
To load target model BaseModel
Begin to load 1 model
Loading VAE weights specified in settings: F:\stable-diffusion-webui\models\VAE\vae-ft-mse-840000-ema-pruned.safetensors
To load target model SD1ClipModel
Begin to load 1 model
Moving model(s) has taken 0.13 seconds
Model loaded in 4.8s (forge load real models: 2.3s, load VAE: 0.3s, load textual inversion embeddings: 1.8s, calculate empty prompt: 0.3s).
                                  To load target model AutoencoderKL
Begin to load 1 model00:00, ?it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 25/25 [00:02<00:00, 10.58it/s]
Upscale script freed memory successfully.███████████████████████████▏                  | 25/35 [00:03<00:00, 11.33it/s]
tiled upscale: 100%|███████████████████████████████████████████████████████████████████| 15/15 [00:01<00:00,  9.93it/s]
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:02<00:00,  4.18it/s]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 35/35 [00:08<00:00,  4.19it/s]
*** Error completing request███████████████████████████████████████████████████████████| 35/35 [00:08<00:00,  3.84it/s]
*** Arguments: ('{"prompt": "Rock statue of an old samurai in shinjuku station, tokyo, film grain", "all_prompts": ["Rock statue of an old samurai in shinjuku station, tokyo, film grain"], "negative_prompt": " EasyNegative, badhandv4, ", "all_negative_prompts": [" EasyNegative, badhandv4, "], "seed": 2165158531, "all_seeds": [2165158531], "subseed": 3882687931, "all_subseeds": [3882687931], "subseed_strength": 0, "width": 512, "height": 768, "sampler_name": "DPM++ 3M SDE Exponential", "cfg_scale": 7, "steps": 25, "batch_size": 1, "restore_faces": false, "face_restoration_model": null, "sd_model_name": "lazymixRealAmateur_v40Inpainting", "sd_model_hash": "35937afca8", "sd_vae_name": "vae-ft-mse-840000-ema-pruned.safetensors", "sd_vae_hash": "235745af8d", "seed_resize_from_w": -1, "seed_resize_from_h": -1, "denoising_strength": 0.38, "extra_generation_params": {"Denoising strength": 0.38, "Hires upscale": 1.5, "Hires steps": 10, "Hires upscaler": "4x-UniScaleV2_Moderate", "TI hashes": "EasyNegative: 66a7279a88dd, badhandv4: 5e40d722fc3d, EasyNegative: 66a7279a88dd, badhandv4: 5e40d722fc3d"}, "index_of_first_image": 0, "infotexts": ["Rock statue of an old samurai in shinjuku station, tokyo, film grain\\nNegative prompt:  EasyNegative, badhandv4, \\nSteps: 25, Sampler: DPM++ 3M SDE Exponential, CFG scale: 7, Seed: 2165158531, Size: 512x768, Model hash: 35937afca8, Model: lazymixRealAmateur_v40Inpainting, VAE hash: 235745af8d, VAE: vae-ft-mse-840000-ema-pruned.safetensors, Denoising strength: 0.38, Conditional mask weight: 1, Hires upscale: 1.5, Hires steps: 10, Hires upscaler: 4x-UniScaleV2_Moderate, TI hashes: \\"EasyNegative: 66a7279a88dd, badhandv4: 5e40d722fc3d, EasyNegative: 66a7279a88dd, badhandv4: 5e40d722fc3d\\", Version: f0.0.12-latest-181-g9e42470a"], "styles": [], "job_timestamp": "20240218000931", "clip_skip": 1, "is_using_inpainting_conditioning": true, "version": "f0.0.12-latest-181-g9e42470a"}', [{'name': 'C:\\Users\\admin\\AppData\\Local\\Temp\\gradio\\tmpnilyphrl.png', 'data': 'http://127.0.0.1:7860/file=C:\\Users\\admin\\AppData\\Local\\Temp\\gradio\\tmpnilyphrl.png', 'is_file': True}], False, 0) {}
    Traceback (most recent call last):
      File "F:\stable-diffusion-webui\modules\call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "F:\stable-diffusion-webui\modules\ui_common.py", line 110, in save_files
        update_logfile(logfile_path, fields)
      File "F:\stable-diffusion-webui\modules\ui_common.py", line 44, in update_logfile
        rows = list(reader)
      File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\codecs.py", line 322, in decode
        (result, consumed) = self._buffer_decode(data, self.errors, final)
    UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa3 in position 6050: invalid start byte

Additional information

  1. I installed forge on my existing dev branch a1111 build on Feb 18 following the guide provided here
  2. I encountered some problems so I deleted venv and let it download everything again.
  3. I don't save all the output and instead have set individual paths for different tasks, but the only one I actually use is saving single selected images when pressing Save button. image image
VantomPayne commented 5 months ago

After installing Forge in a completely new folder, I still can not save anything with the same error.

VantomPayne commented 5 months ago

Turns out because I was saving in the same location as A1111, the previous log.csv was using a different encoding which was causing the error, deleting the old log.csv solved it for me.