intel / openvino-ai-plugins-gimp

GIMP AI plugins with OpenVINO Backend
Apache License 2.0
422 stars 47 forks source link

[ADDED] FP16 subfolder check #97

Closed SirLorrence closed 3 months ago

SirLorrence commented 3 months ago

On some systems, during the installation of the SD-1.5 Controlnet-ReferenceOnly model, the FP16 folder is not always created, resulting in an early exit. Added a simple fix to make sure that folder is created; if not, it will create the path that can continue with installation.

Example error output

Traceback (most recent call last):████████████████████████████████████████████████| 1.72G/1.72G [01:03<00:00, 82.3MB/s]
  File "C:\Users\Local_Admin\GIMP\openvino-ai-plugins-gimp\model_setup.py", line 235, in <module>00:05<01:11, 22.7MB/s]
    dl_all()ce_write.bin: 100%|███████████████████████████████████████████████████| 1.72G/1.72G [00:48<00:00, 37.5MB/s]
  File "C:\Users\Local_Admin\GIMP\openvino-ai-plugins-gimp\model_setup.py", line 206, in dl_all
    dl_sd_15_Referenceonly()
  File "C:\Users\Local_Admin\GIMP\openvino-ai-plugins-gimp\model_setup.py", line 195, in dl_sd_15_Referenceonly
    download_quantized_models(repo_id, model_fp16, model_int8)
  File "C:\Users\Local_Admin\GIMP\openvino-ai-plugins-gimp\model_setup.py", line 78, in download_quantized_models
    shutil.copytree(FP16_model, SD_path_FP16, dirs_exist_ok=True)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Local_Admin\AppData\Local\Programs\Python\Python311\Lib\shutil.py", line 571, in copytree
    with os.scandir(src) as itr:
         ^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\Local_Admin\\.cache\\huggingface\\hub\\models--Intel--sd-reference-only\\snapshots\\7b156d5706518c5a2d2355734c89de8e5e897501\\FP16'
SirLorrence commented 3 months ago

I've also noticed when the break statement in if choice=="12" will successfully break, but in the terminal, the text download progression update will continue after the input line (making it hard to tell if it's done) or won't look like it finished (showing ~10%-90%, meaning the newly updated percentage has been overwritten by the new line). Even though it has. This is a terminal UX issue that should not effect code execution.