基于ChatGPT+Stable Diffusion实现AI绘画
👉导读
01
02
2.1 Stable Diffusion
2.1.1 简介
2.1.2 如何部署
拉取 Github 代码
git clone https://github.com/AbdBarho/stable-diffusion-webui-docker.git运行
# 进入项目目录cd stable-diffusion-webui-docker# 下载相关模型docker compose --profile download up --build# 等待下载完成后,编译运行镜像docker compose --profile auto up --build
打开WebUI
下载其他模型
stable-diffusion-webui-docker/data/StableDiffusion/2.2 Prompt Generator
facelowres,bad anatomy,bad hands,text,error,missing fingers,extra digit,fewer digits,cropped,worst quality,low quality,normal quality,jpeg artifacts,signature,watermark,username,blurry,bad feet,ugly,duplicate,trannsexual,hermaphrodite,out of frame,extra fingers,mutated hands,poorly drawn hands,poorly drawn face,mutation,deformed,blurry,bad anatomy,bad proportions,extra limbs,cloned face,disfigured,more than 2 nipples,out of frame,ugly,extra limbs,bad anatomy,gross,worst quality,low quality,normal quality,signature,watermark,username,blurry,proportions,malformed limbs,missing arms,missing legs,extra arms,extra legs,mutated hands,fused fingers,too many fingers,long neck2.2.1 背景知识
Stable Diffusion is an AI art generation model similar to DALLE-2.2.2.2 任务要求
Please perform the following actions:1. Translate the IDEA into English if it is not in English.2. Write a detailed prompt exactly about the English IDEA follow the rules delimited by triple backticks.Rules:```1. Follow the structure of the example prompts. This means Write a description of the scene, followed by modifiers divided by commas to alter the mood, style, lighting, and more, excluding the artist name, separated by commas.2. Use at most 50 words.```
Use at most 50 words.2.2.3 合规性检查
If the IDEA is inappropriate or misleading or containing hate speech or discriminatory language, then simply write \"1004\"2.2.4 少量样本提示("Few-shot" prompting)
样本1
样本2
样本3
样本4
样本5
样本6
2.2.5 小结
03
3.1 中国古代,赛博朋克,机械仙鹤
3.2 梵高风格,塞尔达旷野之息
3.3 春眠不觉晓,处处闻啼鸟
3.4 天空之城
04
本文介绍了基于 ChatGPT 的 AI 绘图提示词生成器的实现原理,总结了大语言模型 Prompt 工程的一些实践经验。
我们知道,以 ChatGPT 为代表的大语言模型在很多领域都可以发挥巨大作用。但很多时候由于没有做好 Prompt 工程,任务需求描述得不够准确,或者没有提供有效的样本,导致模型的效果不够理想。作为 LLM 的使用者,我们需要利用 Prompt 来充分发挥出模型的潜力,从而提高业务的落地效果。
未来随着 LLM 和 AIGC 相关技术的发展,Prompt 工程可能会越来越简单,甚至在不久的将来可能都不需要 Prompt 工程,届时大语言模型已经足够聪明,我们只需要简单描述几句话它就能完成复杂的任务。但至少对于目前来说,Prompt 工程还是有必要的。欢迎在评论区中交流和探讨。
参考文献
Stable Diffusion
https://github.com/CompVis/stable-diffusion
High-Resolution Image Synthesis with Latent Diffusion Models
https://arxiv.org/abs/2112.10752
Stable Diffusion WebUI Docker
https://github.com/AbdBarho/stable-diffusion-webui-docker
ChatGPT Prompt Engineering for Developers
https://learn.deeplearning.ai/chatgpt-prompt-eng
-End-
原创作者|李派锐
技术责编|郑海兵
关注并星标腾讯云开发者
第一时间看鹅厂技术