link1

link2

Stable Diffusion is a machine learning model that can generate images from natural language descriptions. Because it’s open source, it’s also easy to run it locally, which makes it very convenient to experiment with in your own time. The simplest and best way of running Stable Diffusion is through the Dream Script Stable Diffusion fork, which comes with some convenience functions.

Setup

Install Anaconda

Download the Anaconda installer script from their website and install it. The download URL may change over time, so replace it.:

wget https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.shchmod +x Anaconda3-2022.05-Linux-x86_64.sh# Install Anaconda without prompts./Anaconda3-2022.05-Linux-x86_64.sh -b

Once installation is finished, initialise conda, but tell it not to activate each time the shell starts.

~/anaconda3/bin/conda config --set auto_activate_base false~/anaconda3/bin/conda init

Get the model file

The model file needed by Stable Diffusion is hosted on Hugging Face. You will need to register with any email address. Once registered, head to the latest model repository, which at the time of writing is stable-diffusion-v-1-4-original. Under the ‘files and versions’ tab, download the checkpoint file, sd-v1-4.ckpt.

Get the Dream Script Stable Diffusion repository

The Dream Script Stable Diffusion repo is a fork of Stable Diffusion, it comes with some convenience functions to accept a text prompt, as well as a web interface.

git clone https://github.com/lstein/stable-diffusion.gitcd stable-diffusion

Next, move the model file downloaded previously, into this repo, renaming it to model.ckpt

mkdir -p models/ldm/stable-diffusion-v1/mv ~/Downloads/sd-v1-4.ckpt models/ldm/stable-diffusion-v1/model.ckpt

Create the conda environment

While still in the Stable Diffusion repo, create the conda environment in which the scripts will run.

conda env create -f environment.yaml

The first time this step runs, it will take a long time, due to the numerous dependencies involved.

Run Stable Diffusion

Once the setup is done, these are the steps to run Stable Diffusion. Activate the conda environment, preload models, and run the dream script.

conda activate ldmpython scripts/preload_models.pypython scripts/dream.py

A prompt will appear where you can enter some natural language text.

* Initialization done! Awaiting your command (-h for help, 'q' to quit)dream>

As an example, try

dream> photograph of highly detailed closeup of victoria sponge cake

Wait a few seconds, and an image gets generated in the outputs/img-sample folder.

Example

Conveniently, a dream_log.txt file shows you all the prompts you’ve run in case you want to refer back to something. Against each line, you will also see a seed number that looks something like this: -S2420237860. This allows you to regenerate the exact same image by specifying the seed with your text prompt.

dream> photograph of highly detailed closeup of victoria sponge cake -S2420237860

Using an image as a source

You can also use a crude image as a source for the prompt with the --init_img flag.

dream> mountains and river, Artstation, Golden Hour, Sunlight, detailed, elegant, ornate, rocky mountains, Illustration, by Weta Digital, Painting, Saturated, Sun rays  --init_img=/home/mendhak/Desktop/rough_drawing.png

You can take the output from one step and re-feed it as the input again, and come up with some interesting results.

Mountains and river, output re-fed multiple times

Generating larger images

By default the output is 512x512 pixels. There is a separate module you can use to upscale the output, called Real-ESRGAN.
It’s really simple to install, while in the conda ldm environment, run:

pip install realesrgan

After it’s installed, go back into the dream script, generate an image, and this time add the -U flag at the end of the prompt (either 2 or 4)

dream> butterfly -U 4

Face restoration

The module for face restoration is called GFPGAN. Follow its installation instructions here, clone the GFPGAN directory alongside the stable-diffusion directory. And be sure to download the pre-trained model as shown. You can then use the -G flag as shown in the Dream Script Stable Diffusion repo.

Notes and further reading

Type --help at the dream> prompt to see a list of options. You can use flags like -n5 to generate multiple images, -s for number of steps, and -g to generate a grid.

More details, including how to use an image as a starting prompt, can be found in the README.

Prompts

If you’re like me, you will need ideas for prompts. The best place to start, I’ve found, the Lexica.art site. Find something interesting, and copy the prompt used, then try modifying it.


http://www.taodudu.cc/news/show-6944153.html

相关文章:

  • StableDiffusion艺术二维码制作教程!
  • 利用Python实现二维码制作
  • Shadows 使用说明
  • declaration of ‘T‘ shadows template parameter
  • C语言常见问题(6):declaration shadows a local variable
  • PyCharm 出现 Shadows name ‘xxx‘ from outer scope 提示
  • Python中shadows name ‘xxxx’ from outer scope 警告全局变量、局部变量
  • URP——后期处理特效——Shadows Midtones Highlights
  • Shadows name * from outer scope
  • Unity中的shadows(二)cast shadows
  • Unity中的shadows(一)
  • 关于SHADOWS_SCREEN
  • Rise of Shadows
  • Unity中的shadows(四)collect shadows
  • Unity中的shadows(三)receive shadows
  • Robolectric——Shadows 官网翻译
  • Robolectric之Shadows
  • Pycharm警告解决: shadows name 'xxxx' from outer scope
  • Shadows 阴影 光照系列8
  • android 百度地图简单使用(android Studio )
  • Oracle 性能优化之AWR、ASH和ADDM(含报告生成和参数解读)
  • oracle数据库 生成awr报告、ash报告详细步骤
  • 【oracle性能】11g生成ASH报告
  • ASH、AWR、ADDM区别联系
  • 获取ASH
  • Oracle ASH分析详解
  • ASH(Active Session History)
  • SQL developer 4运行ASH
  • Oracle ASH查询活动会话历史记录
  • 如何手动生成ASH报告

The simplest way to get started with Stable Diffusion on Ubuntu相关推荐

  1. stable diffusion制作韩国版AI女友关键词

    问题 怎么样使用stable diffusion简单制作韩国版AI女友?这里假设已经安装好stable diffusion webui版.这里主要记录一下韩国版AI女友sd配置参数 Stable Di ...

  2. Stable Diffusion 抠图工具使用小记

          用stable diffusion有段时间了,最近使用了它的抠图工具 (Remove background).这里是我对该工具的使用和记录.希望可以帮其他人了解相关内容.文末附100个Lo ...

  3. AI 作画:Stable Diffusion 模型原理与实践

    前言 本文首先简单介绍 Stable Diffusion 模型结构 Latent Diffusion 的论文和博客,然后介绍模型的训练和推理技术细节(不含数学推导),接着介绍几个 prompt 搜索引 ...

  4. 基于 Stable Diffusion 一键 AI 作画:什么“小镇做题家”?人人都是艺术家

    文章目录 前言 一.西方艺术简史 1.1.古典艺术时期 1.2.现代艺术时期 1.3.后现代艺术时期 二.数字艺术的诞生和发展 2.1.数字艺术的诞生 2.2.数字艺术下的行业细分 2.3.数字作品的 ...

  5. 在 Amazon SageMaker 上玩转 Stable Diffusion: 基于 Dreambooth 的模型微调

    本文将以 Stable Diffusion Quick Kit 为例,详细讲解如何利用 Dreambooth 对 Stable Diffusion 模型进行微调,包括基础的 Stable Diffus ...

  6. 带你从零开始入门AI绘画神器Stable Diffusion

    一.本地部署 Stable diffusion 1. 前言 目前市面上比较权威,并能用于工作中的 AI 绘画软件其实就两款.一个叫 Midjourney(简称 MJ),另一个叫 Stable-Diff ...

  7. Stable Diffusion Prompt用法

    Stable Diffusion可以根据你输入的提示词(prompt)来绘制出想象中的画面. 1.正向提示词(Prompt): 提高图像质量的prompt: prompt 用途 HDR, UHD, 6 ...

  8. 1秒出图,全球最快的开源Stable Diffusion出炉

    视学算法发布 机器之心编辑部 OneFlow 将 Stable Diffusion 的推理性能推向了一个全新的 SOTA. 第一辆汽车诞生之初,时速只有 16 公里,甚至不如马车跑得快,很长一段时间, ...

  9. Stable Diffusion 2.0来了,皮卡智能AI早已“抢先”优化升级

    就在昨日,Stability AI发布了Stable Diffusion 2.0 版本上线,玩家惊呼V1还没整明白,V2版本就来了.其实在Stable Diffusion 1.0开源后,皮卡智能AI许 ...

最新文章

  1. break、continue在switch以及循环中的作用
  2. PAT (Basic Level) Practice (中文)1048 数字加密 (20 分)
  3. Linux vi/vim
  4. 北斗导航 | ION GNSS+ 2021、 ION GNSS+ 2020会议论文下载:ION 美国导航学会
  5. 数学建模:1.概述 监督学习--回归分析模型
  6. UFLDL教程:Exercise:Vectorization
  7. C#使用HTML文件中的file文件上传,用C#代码接收上传文件
  8. python定义变量名的时候、需要注意问题_python中将函数赋值给变量时需要注意的一些问题...
  9. Java自动化测试框架-12 - TestNG之xml文件详解篇 (详细教程)
  10. dnf显示与服务器数据异常怎么办啊,DNF:你这该死的数据异常网络中断连接,让我心在痛泪在流...
  11. 升级设置win2008r2开发环境,遇到问题小结
  12. 26个开发者常用必备网站汇总推荐
  13. [混迹IT职场系列]一、转正的那些事儿
  14. bp神经网络解决什么问题,bp神经网络的改进方法
  15. Java实现 LeetCode 502 IPO(LeetCode:我疯起来连自己都卖)
  16. matlab hobject,GUI中更新句柄guidata(hObject,handles)问题!!!
  17. 迪克斯特拉算法——算法图解
  18. iQOO Neo5S手机搭载Pixelworks升级版处理器;彩色星球科技联合费城76人开启NBA合作模式 | 全球TMT...
  19. 20201222英语单词学习(仅供自己记录)
  20. 安装 Visual Studio[文章第二部分为Visual Studio2010详解安装教程(附下载链接)]

热门文章

  1. 算法之「迪杰斯特拉(Dijkstra)算法」
  2. React context 、PropTypes
  3. 2572: 红球还是黑球 python
  4. html中的列表标签
  5. html谷歌全屏像素,HTML5全屏(Fullscreen)API详细介绍
  6. MySQL中\G语句结束语
  7. 关于BLAS的简单介绍
  8. 漫谈软件工程(1)——回顾十年软件开发经历
  9. create table ,create table as 与create like三种建表方式的使用详解
  10. 使用百度地图拾取经纬度,以及根据经纬度定位