首页 > 教程攻略 > ai资讯 >Ollama+Flux模型会擦出怎样的火花

Ollama+Flux模型会擦出怎样的火花

来源:互联网 时间:2026-08-24 14:13:32

先闲聊几句。Flux模型开源之后,身边不少人又一头扎进了AI创作大军,个个摩拳擦掌,立志当新时代的“梵高”。但有个问题很现实——画着画着,灵感就断了。搁以前,大家多半会打开素材网站,看看别人的作品找找感觉。可现在是2024年,出了bug我们找AI帮忙,缺了灵感,自然也得找AI要。

那么,怎么才能不依赖大厂的AI,自己动手,用开源的大语言模型(LLM)来搞一个随时能给你灵感的AI小助手呢?

Ollama启动

这年头,要搞本地部署的开源大语言模型,没装上Ollama框架那可说不过去。安装步骤不算复杂,之前的文章也有详细说明,这里就不再展开了。

基于Ollama本地部署Llama3指南!

装好之后,打开PowerShell(Windows用户),敲一行命令:

ollama run gemma2:27b

至于其他模型能不能用,我没全试过,但至少gemma2对System Prompt的理解能力相当不错。下图就是跑起来的样子。

等模型拉取完毕,接下来是关键一步:用Ollama的Modelfile功能创建一个新模型。方法是新建一个文件夹,在里面放一个txt文件(比如modelfile.txt),把上图中的参数和System Prompt内容填进去。当然,还有更多参数可以调整,这里为了简洁就不一一展开了,感兴趣的可以翻翻之前的文章。

保存文件,注意文件名不要搞错,就叫modelfile.txt。

接下来,在modelfile所在的文件夹里打开PowerShell,输入以下命令:

ollama create SDArt -f modelfile.txt

这里要说明一下:SDArt是你新建模型的名字,可以自由替换;modelfile.txt是文件的名称和格式,也可以根据实际情况调整。

一旦命令行里弹出“Success”的提示——成了!而且这种创建方式并不会额外占用硬盘空间。

模型有了,接下来就可以找个第三方的应用来测试。我自己正在开发一款专为Ollama设计的应用,UI目前是有点糙,还没好好设计,但对话功能已经能用。

从对话表现来看,模型对提示词的理解力还是不错的。那么我们就用Flux模型加上这组提示词,直接生成一张海报看看效果:

正面提示词:text An underwater scene with dim lighting filtering through the surface, an ancient shipwreck partially buried in sand overgrown with seaweed and coral, a mysterious stone structure nearby with intricate carvings eroded by time, vibrant coral reefs teeming with colorful fish, starfish, sea urchins, and shells scattered on the seabed, a large grouper hiding in the shadow of the wreck, jellyfish drifting gracefully in the current, masterpiece, best quality, 4k, illustration style, atmospheric lighting, detailed textures.

另一组示例用于生成蝙蝠侠场景:

正面提示词:text A solitary Batman overlooking Gotham City from the night sky, in his iconic Batsuit, standing against a backdrop of the city's dark and Gothic architecture illuminated by the night lights, capturing the brooding atmosphere of Gotham City, masterpiece, high quality, detailed character, dramatic cityscape, atmospheric lighting, starry night sky, 4k resolution, illustration style, depth of field, superhero theme, expressive facial features, detailed Batsuit, iconic Gotham buildings, city lights, night ambiance, Batman's flying vehicle or grappling hook in use.