nod-ai / SHARK

SHARK - High Performance Machine Learning Distribution
Apache License 2.0
1.4k stars 169 forks source link

593 broke custom model for txt to img #1172

Open GoZippy opened 1 year ago

GoZippy commented 1 year ago

Much love to all the new work on img to img and automating the base model identity working on rdna2 and 3... but 593 broke my merged models I work with. I see it now will delete the existing and recompile everything - this is a positive thing for sure - but it is broken on my models.

Any ideas where to look?


Using tuned models for CompVis/stable-diffusion-v1-4/fp16/vulkan://00000000-0300-0000-0000-000000000000.
loading existing vmfb from: E:\ImageAI\shark\euler_scale_model_input_1_512_512fp16.vmfb
WARNING: [Loader Message] Code 0 : windows_read_data_files_in_registry: Registry lookup failed to get layer manifest files.
loading existing vmfb from: E:\ImageAI\shark\euler_step_1_512_512fp16.vmfb
WARNING: [Loader Message] Code 0 : windows_read_data_files_in_registry: Registry lookup failed to get layer manifest files.
Deleted:  E:\ImageAI\shark\unet1_64_512_512_fp16_tuned_ZipTasticRealistic_v1_vulkan.vmfb
Deleted:  E:\ImageAI\shark\vae1_64_512_512_fp16_tuned_ZipTasticRealistic_v1_vulkan.vmfb
Checkpoint already loaded at :  E:/ImageAI/shark/models/ZipTasticRealistic_v1
Compiling all the models with the fetched base model configuration.
Loading Winograd config file from  C:\Users\me\.local/shark_tank/configs\vae_winograd_vulkan.json
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 33.0/33.0 [00:00<00:00, 2.20kB/s]
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 33.0/33.0 [00:00<00:00, 2.13kB/s]
No vmfb found. Compiling and saving to E:\ImageAI\shark\unet1_64_512_512_fp16_tuned_ZipTasticRealistic_v1_vulkan.vmfb
Using target triple -iree-vulkan-target-triple=rdna2-unknown-windows from command line args
Saved vmfb in E:\ImageAI\shark\unet1_64_512_512_fp16_tuned_ZipTasticRealistic_v1_vulkan.vmfb.
WARNING: [Loader Message] Code 0 : windows_read_data_files_in_registry: Registry lookup failed to get layer manifest files.
Loading Winograd config file from  C:\Users\me\.local/shark_tank/configs\vae_winograd_vulkan.json
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 33.0/33.0 [00:00<00:00, 2.13kB/s]
100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 33.0/33.0 [00:00<00:00, 2.20kB/s]
No vmfb found. Compiling and saving to E:\ImageAI\shark\vae1_64_512_512_fp16_tuned_ZipTasticRealistic_v1_vulkan.vmfb
Using target triple -iree-vulkan-target-triple=rdna2-unknown-windows from command line args
Saved vmfb in E:\ImageAI\shark\vae1_64_512_512_fp16_tuned_ZipTasticRealistic_v1_vulkan.vmfb.
WARNING: [Loader Message] Code 0 : windows_read_data_files_in_registry: Registry lookup failed to get layer manifest files.
Traceback (most recent call last):
  File "gradio\routes.py", line 384, in run_predict
  File "gradio\blocks.py", line 1032, in process_api
  File "gradio\blocks.py", line 858, in call_function
  File "anyio\to_thread.py", line 31, in run_sync
  File "anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
  File "anyio\_backends\_asyncio.py", line 867, in run
  File "gradio\utils.py", line 448, in async_iteration
  File "apps\stable_diffusion\scripts\txt2img.py", line 122, in txt2img_inf
  File "apps\stable_diffusion\src\pipelines\pipeline_shark_stable_diffusion_utils.py", line 356, in from_pretrained
  File "apps\stable_diffusion\src\models\model_wrappers.py", line 502, in __call__
  File "apps\stable_diffusion\src\models\model_wrappers.py", line 443, in compile_all
  File "apps\stable_diffusion\src\models\model_wrappers.py", line 218, in get_vae
  File "apps\stable_diffusion\src\utils\utils.py", line 118, in compile_through_fx
  File "apps\stable_diffusion\src\utils\utils.py", line 56, in _compile_module
  File "shark\shark_inference.py", line 207, in load_module
  File "shark\iree_utils\compile_utils.py", line 329, in load_flatbuffer
  File "shark\iree_utils\compile_utils.py", line 305, in get_iree_module
  File "iree\runtime\system_api.py", line 255, in add_vm_module
  File "iree\runtime\system_api.py", line 252, in add_vm_modules
RuntimeError: Error registering modules: D:\a\SHARK-Runtime\SHARK-Runtime\c\runtime\src\iree\hal\drivers\vulkan\native_executable.cc:157: UNKNOWN; VkResult=4294967283; while invoking native function hal.executable.create; while calling import;
[ 1]   native hal.executable.create:0 -
[ 0] bytecode module.__init:2872 <eval_with_key>.67:134:18
powderluv commented 1 year ago

This is being tracked upstream https://github.com/openxla/iree/issues/12523

powderluv commented 1 year ago

looks like the tunings we apply crash the RDNA2 pipeline. In the txt2img script you can pass --no-use_tuned to work around for now. The WebUI doesn't seem to respect the flag @Shukla-Gaurav will take a look at that flag.