AI知识库 AI知识库

53AI知识库

学习大模型的前沿技术与行业应用场景


使用Llama3辅助生成StableDiffusion提示词,AI绘画从未如此简单
浏览次数: 1584

微信公众号:AI工程师笔记
关注可了解更多的内容。问题或建议,请公众号留言;
如果你觉得对你有帮助,欢迎赞赏

Llama3简介

Llama 3是由Meta公司推出的一款大型语言模型(LLM),其版本规模从8B到400B参数不等,这超越了包括谷歌的Gemma/Gemini、Mistral和Claude 3 Sonnet在内的众多竞争对手,且能在仅4GB的GPU上实现高效运行,为商业应用提供了更多可能性。

HuggingFace上有大神发布了基于Llama3的stable diffusion的prompt提示词微调模型——llama3_ifai_sd_prompt_mkr_q4km。我们可以向模型输入简单的提示,Llama3将会给我们返回详细的提示描述。

Llama3部署

llama3_ifai_sd_prompt_mkr_q4km模型已上架Ollama仓库。

Ollama部署可参考:Windows本机运行7B大模型

执行ollama run impactframes/llama3_ifai_sd_prompt_mkr_q4km即可完成部署。

C:\Users\Zz>ollama run impactframes/llama3_ifai_sd_prompt_mkr_q4km
pulling manifest
pulling 8c307d788852... 100% ▕████████████████████████████████████████████████████████▏ 4.9 GB
pulling 2190828de961... 100% ▕████████████████████████████████████████████████████████▏  260 B
pulling 0661d86cbb71... 100% ▕████████████████████████████████████████████████████████▏  575 B
pulling 563e392d0f49... 100% ▕████████████████████████████████████████████████████████▏  12 KB
pulling 3ac6276a4a91... 100% ▕████████████████████████████████████████████████████████▏  415 B
pulling 98f4faea31b4... 100% ▕████████████████████████████████████████████████████████▏   73 B
pulling d074ab4deb16... 100% ▕████████████████████████████████████████████████████████▏  633 B
verifying sha256 digest
writing manifest
removing any unused layers
success

测试使用

以往我们在使用Stable Diffusion时,自己思考提示词是一件很消耗脑细胞的事情。通过大模型生成的提示词往往更加精准、丰富多样,能够引导Stable Diffusion产出更高分辨率、细节更丰富的图像。大型语言模型能够理解和生成高度复杂、抽象的概念描述,这为图像生成提供了无限的创意空间。用户可以使用自然语言描述极其详细或新颖的场景,即使是那些现实中不存在或难以想象的构想,大模型都能辅助生成精确的提示词,进而创造出独特且富有创意的图像作品。并且对于非专业设计人员来说,直接操作复杂的图像生成参数可能较为困难。而利用大模型生成的提示词作为桥梁,用户只需简单描述心中所想,即可得到满意的作品,极大地降低了艺术创作和技术使用的门槛。

提示词1:一个人站在山顶

>>> A man standing atop of a mountain
Philosophical, introspective, contemplative, solitary figure, dressed in simple attire, standing at the summit of
a majestic mountain, gazing out at the breathtaking panorama, lost in thought, pondering the mysteries of
existence, the universe, and human nature, as the wind whispers secrets in his ear, the sun

提示词2:拟人的猫猫坐在电脑前工作

>>> 拟人的猫猫坐在电脑前工作
Fictional character, anthropomorphic cat named 'Whiskers', sitting comfortably at a desk in front of a computer
screen, wearing glasses, typing away with paws, intense focus on the task at hand, surrounded by scattered papers,
pencils, and catnip toys, whimsical atmosphere, soft lighting, cozy setting.

提示词3:即将降落月球的宇宙飞船

>>> 即将降落月球的宇宙飞船
Soaring through space, the sleek, silver spacecraft, 'Lunar Quest', prepares to land on the moon's surface, vast
craters and rugged terrain visible beneath, solar panels extended, engines firing, smoke trails forming,
astronauts in suits, suited up for lunar exploration, lunar module separating from main spacecraft, majestic Earth
rising above horizon, dramatic sky gradient.

提示词4:机器人战争

>>> 机器人战争
Advanced, mechanized armies clashing on a desolate battlefield, steel behemoths with glowing blue eyes, towering
robots marching across the terrain, smoke and flames engulfing the landscape, laser beams slicing through the air,
explosions rocking the ground, metal shards flying everywhere, apocalyptic devastation, twisted ruins in the
distance.

提示词5:现代化的熊猫战士
>>> 现代化的熊猫战士
Panda warrior, dressed in futuristic armor, helmet adorned with panda emblem, standing confidently on a futuristic
battlefield, holding energy sword, shield emblazoned with panda pattern, advanced jetpack strapped to back,
airbrushed camouflage design, bold lines, metallic sheen, modern technology merged with ancient symbolism.


插件

如果感觉每次手动复制比较麻烦,可以在SableDiffusion下载IF_prompt_MKR插件。


插件安装好,重启SableDiffusion遇到报错:

我们需要在这块安装openai框架:

安装好openai框架后,再次启动SableDiffusion就不会报错了。这时候,我们打开Web页面,在设置—>未分类里找到iF_prompt_MKR,设置Ollama。

设置完成后,在文生图页面的脚本处设置:

此外,我们还可以根据自己的需要设置系统提示词和反向提示词。
所有设置完毕后,在Input Prompt处输入自己想要绘画的概要内容,点击生成即
可。




关注我,定期分享前沿AI应用。

推荐新闻
RAG系列04:使用ReRank进行重排序
本文介绍了重排序的原理和两种主流的重排序方法:基于重排模型和基于 LLM。文章指出,重排序是对检索到的上下文进行再次筛选的过程,类似于排序过程中的粗排和精排。在检索增强生成中,精排的术语就叫重排序。文章还介绍了使用 Cohere 提供的在线模型、bge-reranker-base 和 bge-reranker-large 等开源模型以及 LLM 实现重排序的方法。最后,文章得出结论:使用重排模型的方法轻量级、开销较小;而使用 LLM 的方法在多个基准测试上表现良好,但成本较高,且只有在使用 ChatGPT 和 GPT-4 时表现良好,如使用其他开源模型,如 FLAN-T5 和 Vicuna-13B 时,其性能就不那么理想。因此,在实际项目中,需要做出特定的权衡。
LangGPT论文:面向大语言模型的自然语言编程框架(中文版)
大语言模型 (Large Language Models, LLMs) 在不同领域都表现出了优异的性能。然而,对于非AI专家来说,制定高质量的提示来引导 LLMs 是目前AI应用领域的一项重要挑战。
第三篇:要真正入门AI,OpenAI的官方Prompt工程指南肯定还不够,您必须了解的强大方法论和框架!!!
自从ChatGPT(全名:Chat Generative Pre-trained Transformer)于2022年11月30日发布以来,一个新兴的行业突然兴起,那就是提示工程(Prompt engineering),可谓如日冲天。从简单的文章扩写,到RAG,ChatGPT展现了前所未有的惊人能力。
(三)12个RAG痛点及其解决方案
痛点9:结构化数据QA 痛点10:从复杂 PDF 中提取数据 痛点11:后备模型 痛点12:LLM安全
(二)12个RAG痛点及其解决方案
痛点5:格式错误 痛点6:不正确的特异性 痛点7:不完整 痛点8:数据摄取可扩展性

联系我们

售前咨询
186 6662 7370
产品演示
185 8882 0121

微信扫码

与创始人交个朋友

回到顶部

 
扫码咨询