最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

紀(jì)錄本地安裝AI繪畫工具 Stable Diffusion過程

2023-07-01 11:08 作者:_小師傅早  | 我要投稿

AI 繪畫熱鬧很長一段時間了,昨天我在本地游戲本第二次安裝 AI 繪畫工具。上次安裝已是去年8月,距今快一年時間。為什么昨天又來搞一下 AI 繪畫呢?因為上次 AI?出的圖總讓人眼前一黑,這次也是看了又看,確認(rèn)現(xiàn)在的版本確實比一年前有進步,剛好這周莫名其妙的手足口了,腳底起泡,喉嚨疼,不便行走和言語,閑下來。


? 安裝后一口氣畫了200多張圖,畫了卡通場景、真人、動漫人物,試驗下來結(jié)果也確實不錯,比農(nóng)藥還上癮,畫起來停不下來。邊等圖邊下模型,挑出感覺好的圖分享給親友,引得家人圍著電腦屏幕看 AI 畫出來的圖,打趣著要娶某張漂亮女孩給小兒子。感慨技術(shù)進步也感慨歲月易逝,曾幾何時也曾活躍在技術(shù)前沿的,離開一線崗位幾日,已恍如隔行。


如下記錄為具體安裝過程,無需外網(wǎng)和網(wǎng)盤,用的都是國內(nèi)鏡像加速源整體耗時不算太久,好處是安全可控可更新,壞處是沒有一鍵整合包方便。整體步驟已在新建?WSL2 Debian 環(huán)境逐步復(fù)現(xiàn),確保當(dāng)下操作無坑,也是邊復(fù)現(xiàn)邊完善文檔,供參考。


一、創(chuàng)建Debian環(huán)境

第一步就從創(chuàng)建WSL2環(huán)境開始吧

這段可以參考?安裝WSL2和Debian的步驟 - 知乎 (zhihu.com)

wsl --set-default-version 2

wsl --install -d Debian

命令結(jié)束后會彈出一個框,設(shè)置登錄用戶名和密碼,我這里設(shè)置用戶名為 ai

設(shè)置用戶名

例行換源,這里比較扯蛋,需要先使用默認(rèn)源更新證書,耗時約3分鐘,比上一步裝系統(tǒng)都久。這段可以直接參考一篇知乎文章 [zhuanlan.zhihu.com/p/621428215]

sudo apt update? && sudo apt?install --reinstall ca-certificates

更新后,直接從文件資源管理器找到 \\wsl.localhost\Debian\etc\apt

sources文件

編輯換國內(nèi)源

換國內(nèi)源

deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib

deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib

deb https://mirrors.aliyun.com/debian-security/ bullseye-security main

deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main

deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib

deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib

deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib

deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib


第二步是創(chuàng)建python環(huán)境

換好源后安裝Anaconda3

sudo apt update &&sudo apt install wget git

切換回?home目錄下載安裝Anaconda3

cd ~ && wget https://mirrors.aliyun.com/anaconda/archive/Anaconda3-2023.03-1-Linux-x86_64.sh

chmod +x?Anaconda3-2023.03-1-Linux-x86_64.sh

./Anaconda3-2023.03-1-Linux-x86_64.sh


寫入配置文件

source? ?~/.bashrc

touch .condarc

換鏡像?參考 https://developer.aliyun.com/mirror/anaconda

channels:

? - defaults

show_channel_urls: true

default_channels:

? - http://mirrors.aliyun.com/anaconda/pkgs/main

? - http://mirrors.aliyun.com/anaconda/pkgs/r

? - http://mirrors.aliyun.com/anaconda/pkgs/msys2

custom_channels:

? conda-forge: http://mirrors.aliyun.com/anaconda/cloud

? msys2: http://mirrors.aliyun.com/anaconda/cloud

? bioconda: http://mirrors.aliyun.com/anaconda/cloud

? menpo: http://mirrors.aliyun.com/anaconda/cloud

? pytorch: http://mirrors.aliyun.com/anaconda/cloud

? simpleitk: http://mirrors.aliyun.com/anaconda/cloud


修改pip源

mkdir ~/.pip

把鏡像地址寫入到pip配置文件

vi pip.conf

[global]

index-url = https://mirrors.aliyun.com/pypi/simple/


[install]

trusted-host=mirrors.aliyun.com


第三步是安裝 SD webui


項目 git 地址為 https://github.com/AUTOMATIC1111/stable-diffusion-webui

直接下載可能下載不了,套個 proxy 前綴再試??https://ghproxy.com/

完整命令為:

?git clone? https://ghproxy.com/https://github.com/AUTOMATIC1111/stable-diffusion-webui

下載sd ui



創(chuàng)建虛擬環(huán)境

?conda create -n sd_webui_230628 python=3.11 anaconda

?conda activate sd_webui_230628


安裝依賴??

pip 前加 python -m 是為了把依賴裝到當(dāng)前的 conda 環(huán)境里

python -m pip install? --use-pep517 -r requirements.txt? -i? https:

//mirrors.aliyun.com/pypi/simple/


安裝opencv所需依賴

sudo apt-get install ffmpeg libsm6 libxext6 ?-y


啟動webui

這個過程是最后一步,速度快慢主要取決于網(wǎng)速和加速鏡像穩(wěn)定性

./webui.sh

這個中間因為要下載太多東西,偶爾會超時,不要緊,再執(zhí)行一遍?./webui.sh? 會繼續(xù)安裝

如果遇到類似重復(fù)幾次還是下載不了的情況,也不要慌,找到具體的包名和版本,手動安裝一下

安裝不了的包

?python -m pip install? --use-pep517 sympy==1.12? -i? https://mirror

s.aliyun.com/pypi/simple/

手動安裝

往下會卡在安裝gfpgan這個位置,還是不要慌,手動安裝一下

當(dāng)出現(xiàn)這個地址時,說明已經(jīng)安裝成功了



下載模型

https://civitai.com/

如果打不開的話國內(nèi)有個平替也很不錯

liblibai.com

把下載好的模型放入

\\wsl.localhost\Debian\home\ai\sd\stable-diffusion-webui\models\Stable-diffusion


畫圖

在左上角選擇模型,輸入關(guān)鍵詞,比如我這里輸入了 school girls,等待10秒,生成的圖片效果如下所示。


到此為止,以上內(nèi)容是在本地 ubuntu22?子系統(tǒng)完成安裝后,新建 debian 子系統(tǒng)一步步復(fù)現(xiàn)記錄步驟,確??尚?。樂趣無窮。

紀(jì)錄本地安裝AI繪畫工具 Stable Diffusion過程的評論 (共 條)

分享到微博請遵守國家法律
秦皇岛市| 军事| 靖边县| 平度市| 平罗县| 宜良县| 册亨县| 雷波县| 和政县| 黄浦区| 宁陕县| 元朗区| 宁化县| 沭阳县| 西贡区| 襄樊市| 镇雄县| 双流县| 宝鸡市| 泗洪县| 桐柏县| 邳州市| 星座| 镇雄县| 五峰| 郧西县| 常宁市| 泾阳县| 滦平县| 桂东县| 衡水市| 喀喇| 横峰县| 翼城县| 修水县| 乌拉特后旗| 枝江市| 马关县| 金阳县| 射阳县| 额济纳旗|