BlafKing / sd-civitai-browser-plus

Extension to access CivitAI via WebUI: download, delete, scan for updates, list installed models, assign tags, and boost downloads with multi-threading.
GNU Affero General Public License v3.0
289 stars 44 forks source link

[Bug]: UnboundLocalError: local variable 'date' referenced before assignment #231

Closed pontius911 closed 4 months ago

pontius911 commented 4 months ago

Describe the bug.

"UnboundLocalError: local variable 'date' referenced before assignment" I am getting this error after trying to load installed models or load outdated models in browser.

Steps to reproduce the problem.

  1. Go to sd-civitai-browser-plus
  2. Press update models
  3. scan for models you need
  4. press load Outdated models to browser

Expected behavior

nothing works after that

System info

Console logs

Launching Web UI with arguments: --skip-torch-cuda-test --xformers --pin-shared-memory --cuda-malloc --cuda-stream
Using cudaMallocAsync backend.
Total VRAM 12288 MB, total RAM 32694 MB
WARNING:xformers:A matching Triton is not available, some optimizations will not be enabled.
Error caught was: No module named 'triton'
xformers version: 0.0.23.post1
Set vram state to: NORMAL_VRAM
Always pin shared GPU memory
Device: cuda:0 NVIDIA GeForce RTX 3060 : cudaMallocAsync
VAE dtype: torch.bfloat16
CUDA Stream Activated:  True
Using xformers cross attention
ControlNet preprocessor location: F:\Forge\webui\models\ControlNetPreprocessor
[-] ADetailer initialized. version: 24.3.0, num models: 12
CivitAI Browser+: Aria2 RPC started
Civitai: API loaded
Loading weights [488aab7bd7] from F:\Forge\webui\models\Stable-diffusion\mklanArtVersion_mklan201art.safetensors
2024-03-16 13:37:37,015 - ControlNet - INFO - ControlNet UI callback registered.
model_type EPS
UNet ADM Dimension 2816
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Civitai: Check resources for missing info files
Civitai: Check resources for missing preview images
Startup time: 17.6s (prepare environment: 3.9s, import torch: 4.1s, import gradio: 0.9s, setup paths: 0.7s, initialize shared: 0.1s, other imports: 0.5s, load scripts: 4.9s, create ui: 2.1s, gradio launch: 0.2s).
Using xformers attention in VAE
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
Using xformers attention in VAE
Civitai: Found 0 resources missing info files
Civitai: No info found on Civitai
Civitai: Found 29 resources missing preview images
Civitai: Found 16 hash matches
Civitai: Updated 0 preview images
extra {'cond_stage_model.clip_l.text_projection', 'cond_stage_model.clip_l.logit_scale', 'cond_stage_model.clip_g.transformer.text_model.embeddings.position_ids'}
To load target model SDXLClipModel
Begin to load 1 model
[Memory Management] Current Free GPU Memory (MB) =  11228.910247802734
[Memory Management] Model Memory (MB) =  2144.3546981811523
[Memory Management] Minimal Inference Memory (MB) =  1024.0
[Memory Management] Estimated Remaining GPU Memory (MB) =  8060.555549621582
Moving model(s) has taken 0.53 seconds
Model loaded in 7.0s (load weights from disk: 0.3s, forge load real models: 5.8s, calculate empty prompt: 0.8s).
CivitAI Browser+: model: "PontiusMIX.safetensors" not found on CivitAI servers.
CivitAI Browser+: "Mklan Anime version" is currently outdated.
CivitAI Browser+: "RealCartoon3D" is currently outdated.
CivitAI Browser+: "Cora from Mass Effect: Andromeda" is currently outdated.
Traceback (most recent call last):
  File "F:\Forge\webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "F:\Forge\webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "F:\Forge\webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "F:\Forge\webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "F:\Forge\webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "F:\Forge\webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "F:\Forge\webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper
    response = f(*args, **kwargs)
  File "F:\Forge\webui\extensions\sd-civitai-browser-plus\scripts\civitai_file_manage.py", line 1144, in load_to_browser
    model_list_return = _api.update_model_list(from_ver=True, tile_count=tile_count)
  File "F:\Forge\webui\extensions\sd-civitai-browser-plus\scripts\civitai_api.py", line 542, in update_model_list
    HTML = model_list_html(gl.json_data)
  File "F:\Forge\webui\extensions\sd-civitai-browser-plus\scripts\civitai_api.py", line 325, in model_list_html
    model_card = f'<figure class="civmodelcard {nsfw} {installstatus}" base-model="{baseModel}" date="{date}" onclick="select_model(\'{model_string}\', event)">'
UnboundLocalError: local variable 'date' referenced before assignment

Additional information

No response

DaisukeVN commented 4 months ago

Getting same error now

Traceback (most recent call last): File "D:\StableDiffusion\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict output = await app.get_blocks().process_api( File "D:\StableDiffusion\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api result = await self.call_function( File "D:\StableDiffusion\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function prediction = await anyio.to_thread.run_sync( File "D:\StableDiffusion\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "D:\StableDiffusion\venv\lib\site-packages\anyio_backends_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "D:\StableDiffusion\venv\lib\site-packages\anyio_backends_asyncio.py", line 807, in run result = context.run(func, args) File "D:\StableDiffusion\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper response = f(args, **kwargs) File "D:\StableDiffusion\extensions\sd-civitai-browser-plus\scripts\civitai_file_manage.py", line 1144, in load_to_browser model_list_return = _api.update_model_list(from_ver=True, tile_count=tile_count) File "D:\StableDiffusion\extensions\sd-civitai-browser-plus\scripts\civitai_api.py", line 542, in update_model_list HTML = model_list_html(gl.json_data) File "D:\StableDiffusion\extensions\sd-civitai-browser-plus\scripts\civitai_api.py", line 325, in model_list_html model_card = f'

' UnboundLocalError: local variable 'date' referenced before assignment

Worldgate commented 4 months ago

There was a change to the api that has completely broken the extension. See here. https://github.com/BlafKing/sd-civitai-browser-plus/issues/229

BlafKing commented 4 months ago

This should now be fixed in the new update!

Thanks for reporting, I'll mark this as resolved 👍🏻