本文将指导你如何使用 Conda 配置运行环境,并在 RKNN 上运行 Stable Diffusion 1.5 LCM ONNX,实现高效的本地 AI 图片生成。实现小姐姐自由。
为爱发电,如果对你有帮助,请不吝点赞和关注,谢谢 😁
1. 配置 Python 环境(Conda)
为了确保环境干净可控,我们推荐使用 Conda 创建虚拟环境。
步骤 1:安装 Miniconda / Anaconda
如果尚未安装 Conda,请参考官方安装指南:
- Miniconda(推荐):https://docs.conda.io/en/latest/miniconda.html
- Anaconda:https://www.anaconda.com/download
步骤 2:创建并激活 Conda 虚拟环境
conda create -n sd-rknn python=3.10 -y
conda activate sd-rknn
2. 配置项目及环境
git clone https://huggingface.co/happyme531/Stable-Diffusion-1.5-LCM-ONNX-RKNN2
sudo apt install python3-pip
pip install diffusers pillow 'numpy < 2' rknn-toolkit-lite2 torch transformers
download https://github.com/airockchip/rknn-toolkit2/blob/master/rknpu2/runtime/Linux/librknn_api/aarch64/librknnrt.so
sudo mv /home/jason/Downloads/librknnrt.so /usr/lib
cd Stable-Diffusion-1.5-LCM-ONNX-RKNN2
3. 运行命令行生成图片
送你两个命令行
python ./run_rknn-lcm.py -i ./model -o ./images --num-inference-steps 10 -s 512x512 --prompt "Full body image of a beautiful anime girl with perfect thic body shape in black sleeveless crop top, detailed face, manhwa style, princess core, tight short skirt and boots, --ar 1:2 --niji 6 --s 750, radiant skin."
python ./run_rknn-lcm.py -i ./model -o ./images --num-inference-steps 10 -s 512x512 --prompt "Full body image of a beautiful anime girl in sleeveless crop top, detailed faces, manhwa style, princess core, tight short skirt, --ar 1:2 --niji 6 --s 750"
生成的图片保存在项目的 images
文件夹下面:
恭喜各位大老爷实现小姐姐自由~ 🎉🎉🎉
不定期更新专业知识和有趣的技术内容,欢迎 点赞 和 关注,你的支持是我继续创作的动力!😊
参考链接:
- https://huggingface.co/happyme531/Stable-Diffusion-1.5-LCM-ONNX-RKNN2