惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Troy Hunt's Blog
P
Proofpoint News Feed
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
Cyberwarzone
Cyberwarzone
T
Tor Project blog
Cisco Talos Blog
Cisco Talos Blog
S
Securelist
L
Lohrmann on Cybersecurity
Security Latest
Security Latest
T
Threatpost
H
Heimdal Security Blog
W
WeLiveSecurity
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
G
GRAHAM CLULEY
IT之家
IT之家
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
TaoSecurity Blog
TaoSecurity Blog
A
About on SuperTechFans
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Last Week in AI
Last Week in AI
T
The Blog of Author Tim Ferriss
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Microsoft Azure Blog
Microsoft Azure Blog
Hugging Face - Blog
Hugging Face - Blog
Google DeepMind News
Google DeepMind News
量子位
Stack Overflow Blog
Stack Overflow Blog
Know Your Adversary
Know Your Adversary
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
AI
AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
Vercel News
Vercel News
C
Cyber Attacks, Cyber Crime and Cyber Security
Latest news
Latest news
D
Darknet – Hacking Tools, Hacker News & Cyber Security
大猫的无限游戏
大猫的无限游戏
Forbes - Security
Forbes - Security

博客园 - ffb

Z分数异常数据检测方法 一次AI辅助调试记录(2024年文章补发) 最廉价的5.1家庭影院系统解决方案 2023年如何选购一部4000元价位的笔记本电脑(附带坑的说明) 使用chatGPT聊天到底要花多少钱? 大家是如何利用AI来挣钱的 跑在笔记本里的大语言模型 - GPT4All AI人工智能简史 这些AI绘画工具教你秒变艺术大师! 最强绘图AI:一文搞定Midjourney(附送咒语) 微软产品和中文输入法相关的一些缺陷 Excel无法vlookup事件 不高级不能发帖的WPS论坛 打不开盖子的酸奶 无意中发现的一个好设计:不浸水的香皂盒 几件小事 网络相册产品分析(一):十年需求变迁 微盘产品分析(零):时代向前走了一步 网易云音乐点评(一):音乐应用的播放列表 豆瓣音乐使用体验(一):iPad一直很抱歉 ipad上的电子阅读器们
在MacAir上搭建人工智能AI画图环境
ffb · 2023-03-06 · via 博客园 - ffb

在MacAir上搭建人工智能AI画图环境

在MacAir上,可以通过开源的Stable Diffusion项目自行搭建AI画图环境,这里以Intel处理器的Mac Air为例。

Stable Diffusion项目硬件要求较高而且只提供终端命令行交互方式,所以这里使用stable-diffusion-webui项目(简称webui)来实现本地部署。webui项目为Stable Diffusion项目提供了web网页的交互方式,操作更简单。

环境部署

本机部署好git环境之后,正常情况直接执行webui的脚本即可运行,在终端里执行:

git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
./webui.sh

执行过程中会下载一些文件,如果中途出现错误,重新执行webui.sh即可。

如果提示opencv版本太老,可以这样手工更新一下:

# ImportError: dlopen(/github/stable-diffusion-webui/venv/lib/python3.10/site-packages/cv2/cv2.abi3.so, 2): Symbol not found: _VTRegisterSupplementalVideoDecoderIfAvailable
cd venv/bin
source activate
./python3.10 -m pip install --upgrade pip
pip3 install opencv-python==4.6.0.66
deactivate

如果提示显卡问题,可以这样处理:

# RuntimeError: "LayerNormKernelImpl" not implemented for 'Half'
cd venv/bin
source activate
pip install torch --extra-index-url https://download.pytorch.org/whl/cu113
deactivate

编辑webui-user.sh,添加:

export COMMANDLINE_ARGS="--precision full --no-half --skip-torch-cuda-test

如果顺利地跑成功了,会看到类似这样的提示:

LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying cross attention optimization (InvokeAI).
Textual inversion embeddings loaded(0):
Model loaded in 31.0s (load weights from disk: 0.7s, create model: 1.1s, apply weights to model: 28.5s, apply dtype to VAE: 0.2s, load textual inversion embeddings: 0.3s).
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`

此时只要打开浏览器访问对应的地址http://127.0.0.1:7860即可使用了。

模型下载

webui默认不带模型文件,需要自己下载后放到对应的目录中,模型文件可以去以下两个网站中下载:

根据模型的类型不同,放置在不同的目录下:

  • 主模型文件,放置在:stable-diffusion-webui/models/Stable-diffusion
  • Lora文件,放置在:stable-diffusion-webui/models/Lora
  • VAE文件,放置在:stable-diffusion-webui/models/VAE

也有一类Lora文件和主模型同名的,需要放置在Stable-diffusion目录下。

模型下载之后,刷新浏览器页面,就可以看到模型文件了。切换模型文件需要重新加载,请耐心等待。

如果prompt不会写,可以参考模型页面上prompt的写法。

花絮

对于Stable Diffusion,我们采访了chatGPT:

你知道开源项目Stable Diffusion吗?

很抱歉,作为一个语言模型AI,我无法知道所有的开源项目。Stable Diffusion似乎不是一个很有名的开源项目,我无法提供更多的信息。如果您愿意提供更多背景信息,我会尽力回答。

chatGPT这是故意...

稳定扩散(Stable Diffusion)是一个潜在的文本到图像的扩散模型,能够在任何文本输入的情况下生成照片般逼真的图像,培养自主的自由度以产生令人难以置信的图像,使数十亿人在几秒钟内创造出令人惊叹的艺术。

简单来说,就是大家常说的AI画图工具,可以实现文字描述转图片,或者图片转图片等功能。

AI画图的第一轮火爆出圈,是 openAI 在2021年发布的 DALL-E 产品,它可以理解自然语言输入,并根据文字描述生成图片。第二年,在美国的一次美术比赛中,一位名叫杰森·艾伦(Jason Allen)的艺术家借助 AI 工具 Midjourney 创造的作品获得了第一名:

Theatre Dopera Spatial

同年,慕尼黑大学 CompVis 小组发布了 Stable Diffusion ,是一种深度学习、文本到图像模型,主要用于生成以文本描述为条件的详细图像。

目前,国内很多提供文字绘图的网站,应该都是利用 Stable Diffusion 这个开源项目实现的功能。