openvinotoolkit / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
290 stars 45 forks source link

[Bug]: NameError: free variable 'maybe_fs_cached_name' referenced before assignment in enclosing scope #70

Closed palant closed 1 year ago

palant commented 1 year ago

Is there an existing issue for this?

What happened?

The error NameError: free variable 'maybe_fs_cached_name' referenced before assignment in enclosing scope always pops up if “Cache the compiled models on disk for faster model load in subsequent launches” setting is disabled.

And if you look at function openvino_fx() in openvino_accelerate.py, this makes perfect sense. The variable maybe_fs_cached_name is set only in the branch entered if OPENVINO_TORCH_MODEL_CACHING environment variable is present. Yet it is being used unconditionally in the _call() function outside that branch: https://github.com/openvinotoolkit/stable-diffusion-webui/blob/b01f18c94d122ce21f5c7b6ac2f8afa0ff900eca/scripts/openvino_accelerate.py#L211-L212

Steps to reproduce the problem

  1. Enable OpenVINO script.
  2. Make sure “Cache the compiled models on disk for faster model load in subsequent launches” is switched off.
  3. Click “Generate”

What should have happened?

The image should be generated without error.

armynew commented 1 year ago

same error on intel iris XE graphic , is this project is going on ?

qiacheng commented 1 year ago

https://github.com/openvinotoolkit/stable-diffusion-webui/commit/d172a08db469c4db97d6cccf1c608ee0ef7a58ee

this should fix it by defining maybe_fs_cached_name = None