Open kynalvarus opened 1 month ago
stable-diffusion-v1-5 is fine from the new repo, but inpainting won't convert.
[2024-09-15 14:54:55,008] INFO: MainProcess MainThread onnx_web.convert.client.huggingface: downloading model from Huggingface Hub: benjamin-paine/stable-diffusion-v1-5-inpainting
Keyword arguments {'extract_ema': True} are not expected by StableDiffusionPipeline and will be ignored.
Loading pipeline components...: 14%|█████████████▍ | 1/7 [00:00<00:00, 249.44it/s]
[2024-09-15 14:54:55,401] ERROR: MainProcess MainThread __main__: error converting diffusion model stable-diffusion-onnx-v1-inpainting
Traceback (most recent call last):
File "C:\Users\Ryan\Documents\Projects\imggen\onnx-web\api\onnx_web\convert\__main__.py", line 458, in convert_models
convert_model_diffusion(conversion, model)
File "C:\Users\Ryan\Documents\Projects\imggen\onnx-web\api\onnx_web\convert\__main__.py", line 278, in convert_model_diffusion
converted, dest = converter(
File "C:\Users\Ryan\Documents\Projects\imggen\onnx-web\api\onnx_env\lib\site-packages\torch\utils\_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "C:\Users\Ryan\Documents\Projects\imggen\onnx-web\api\onnx_web\convert\diffusion\diffusion.py", line 808, in convert_diffusion_diffusers_optimum
pipeline = pipe_class.from_pretrained(cache_path, **pipe_args)
File "C:\Users\Ryan\Documents\Projects\imggen\onnx-web\api\onnx_env\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 1265, in from_pretrained
loaded_sub_model = load_sub_model(
File "C:\Users\Ryan\Documents\Projects\imggen\onnx-web\api\onnx_env\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 520, in load_sub_model
loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
File "C:\Users\Ryan\Documents\Projects\imggen\onnx-web\api\onnx_env\lib\site-packages\transformers\modeling_utils.py", line 3362, in from_pretrained
if metadata.get("format") == "pt":
AttributeError: 'NoneType' object has no attribute 'get'
Not sure what's wrong, but it looks like a missing file or something similar - f.metadata is NoneType when it should not be after safe_load.
I'll throw my changes up as a draft PR.
Switched to the botp repo on huggingface, and that seemed to succeed through the ONNX conversion. However, test_diffusers still fails:
python .\scripts\test-diffusers.py
generating test image...
Loading pipeline components...: 0%| | 0/5 [00:00<?, ?it/s]
Traceback (most recent call last):
File "C:\Users\Ryan\Documents\Projects\imggen\onnx-web\api\scripts\test-diffusers.py", line 20, in <module>
pipe = OnnxStableDiffusionPipeline.from_pretrained(model, provider='DmlExecutionProvider', safety_checker=None)
File "C:\Users\Ryan\Documents\Projects\imggen\onnx-web\api\onnx_env\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 1265, in from_pretrained
loaded_sub_model = load_sub_model(
File "C:\Users\Ryan\Documents\Projects\imggen\onnx-web\api\onnx_env\lib\site-packages\diffusers\pipelines\pipeline_utils.py", line 520, in load_sub_model
loaded_sub_model = load_method(os.path.join(cached_folder, name), **loading_kwargs)
File "C:\Users\Ryan\Documents\Projects\imggen\onnx-web\api\onnx_env\lib\site-packages\transformers\modeling_utils.py", line 3194, in from_pretrained
raise EnvironmentError(
OSError: Error no file named pytorch_model.bin, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory ..\models\stable-diffusion-onnx-v1-5\text_encoder.
See https://huggingface.co/runwayml
Error during setup_amd.bat:
[2024-09-15 12:32:25,627] INFO: MainProcess MainThread onnx_web.convert.client.huggingface: downloading model from Huggingface Hub: runwayml/stable-diffusion-v1-5 Couldn't connect to the Hub: 404 Client Error. (Request ID: Root=1-66e70c19-02e8fe631dc7766b0465de4f;6f827bc5-a954-4815-bf39-9fd342f610dd).
...[2024-09-15 12:32:25,879] INFO: MainProcess MainThread onnx_web.convert.client.huggingface: downloading model from Huggingface Hub: runwayml/stable-diffusion-inpainting Couldn't connect to the Hub: 404 Client Error. (Request ID: Root=1-66e70c19-001a3dd27ff036553cce6603;84e7f6a6-2c82-4ebb-aa1c-0df2eb4b2d35)
I'm looking for an alternate source for these, if you haven't already.