Stable Diffusion是一個深度學習模型,專注于生成高質量的圖像。它由CompVis團隊與Stability AI合作開發,并在2022年公開發布。這個模型使用文本提示(text prompts)生成詳細、逼真的圖像,是目前人工智能圖像生成領域的一大突破。它屬于文本到圖像(Text-to-Image)生成模型的范疇,使用了一種稱為潛在擴散模型(Latent Diffusion Model, LDM)的技術。
實現的功能
- 文本到圖像生成:用戶可以輸入簡單的文本描述,Stable Diffusion將基于這些描述生成對應的圖像。這些圖像可以覆蓋廣泛的主題和風格,從實際物體到風景畫,甚至是抽象概念。
- 圖像到圖像轉換:Stable Diffusion還支持圖像到圖像的轉換,比如風格遷移,用戶可以輸入一張圖像和文本提示,模型會根據文本提示調整輸入圖像的內容或風格。
- 圖像編輯:它還可以用于對已有圖像進行編輯或改進,比如修復圖像中的缺陷、改變圖像中物體的顏色或形狀等。
意義
- 創意表達的新工具:Stable Diffusion為藝術家、設計師提供了一種新的工具,可以幫助他們將創意快速轉化為視覺作品,加速創作過程。
- 推動人工智能領域的發展:Stable Diffusion的開發和發布,推動了人工智能在圖像生成、自然語言處理等領域的研究和應用,為未來的AI技術開發提供了新的思路和基礎。
- 廣泛的應用前景:從廣告設計、娛樂產業到教育和科研,Stable Diffusion的應用潛力巨大,它可以在不同領域內提供圖像創作和編輯的解決方案。
- 開源共享:Stable Diffusion作為一個開源項目,為全球的研究者和開發者提供了學習、研究和創新的機會,促進了全球技術社區的協作和知識共享。
conda create -n sd python=3.10
conda activate sdconda activate sdgit clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui#安裝tb-nightly
python -m pip install tb-nightly -i https://mirrors.aliyun.com/pypi/simple#安裝相關依賴
pip install -r requirements_versions.txt
pip install -r requirements.txt vim webui.py#找到下面這幾行
#app, local_url, share_url = shared.demo.launch(
#share=cmd_opts.share,
#server_name=initialize_util.gradio_server_name(),
#修改為:#將shared.demo.launch()第一行改為
share=True,
server_name="**.**.**.**",#注意IP上的雙引號,IP靈活根據自己服務器的IP設置python launch.py
#或
python webui.py
報錯:OSError: Can't load tokenizer for 'openai/clip-vit-large-patch14'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'openai/clip-vit-large-patch14' is the correct path to a directory containing all relevant files for a CLIPTokenizer tokenizer.
運行時它需要訪問huggingface.co去下載一些模型需要的文件,而大陸用戶連接不上huggingface.co,導致我部署失敗。
解決方案:
讓服務器訪問服務器本地數據,我們負責將文件下載后上傳上去并進行配置
將openai下載來下即可,/stable-diffusion-webui/openai
AI快站 - HuggingFace模型免費加速下載
問題1:stable-diffusion-webui部署后局域網無法訪問
解決1:modules/cmd_args.py
把--listen設置為True,default=True。
問題2:listen開啟后,擴展插件時報錯:AssertionError: extension access disabled because of command line flags?
解決2:python launch.py --enable-insecure-extension-access 加入這個即可。
python launch.py --enable-insecure-extension-access
黑色主題:訪問網址后面加上/?__theme=dark 即可