ZTMIDGO / Android-Stable-diffusion-ONNX

使用Android手机的CPU推理stable diffusion
138 stars 27 forks source link

onnx int8量化方法 #6

Closed eadst closed 1 year ago

eadst commented 1 year ago

我参考了这个链接可以量化fp16的模型,但是替换model生成图像报错error。 Accelerating Stable Diffusion Inference with ONNX Runtime

请问有stable diffusion模型onnx int8量化参考链接或者代码嘛?

ZTMIDGO commented 1 year ago

可以使用 https://github.com/Amblyopius/Stable-Diffusion-ONNX-FP16 转为onnx,然后下载 https://github.com/ZTMIDGO/Android-Stable-diffusion-ONNX/files/11745190/conv_sd_to_onnx.txt 替换项目里的conv_sd_to_onnx.py

ZTMIDGO commented 1 year ago

量化代码 https://github.com/LowinLi/stable-diffusion-streamlit/blob/main/src/stable-diffusion-streamlit/pages/model/quantization.py

eadst commented 1 year ago

感谢分享。我修改了conv_sd_to_onnx.txt中的opset=14, quantization.py中的use_external_data_format=False, 可以成功运行runwayml/stable-diffusion-v1-5

ReEnMikki commented 11 months ago

可以使用 https://github.com/Amblyopius/Stable-Diffusion-ONNX-FP16 转为onnx,然后下载 https://github.com/ZTMIDGO/Android-Stable-diffusion-ONNX/files/11745190/conv_sd_to_onnx.txt 替换项目里的conv_sd_to_onnx.py

TypeError: download_from_original_stable_diffusion_ckpt() got an unexpected keyword argument 'checkpoint_path'

ReEnMikki commented 11 months ago

量化代码 https://github.com/LowinLi/stable-diffusion-streamlit/blob/main/src/stable-diffusion-streamlit/pages/model/quantization.py

Please elaborate how do I run this ? Nothing happens when I try to do it. It just loads for a second and nothing changes. This is my current files and folders: So basically I have folder Model-fp16 which includes: