๐Ÿ“—
smiley book
  • Smiley Books
  • AI
    • Readme
    • openai-whisper
      • ์ƒ˜ํ”Œ ์‹คํ–‰ํ•ด๋ณด๊ธฐ
      • GPU ์„œ๋ฒ„ ์ค€๋น„ํ•˜๊ธฐ
      • API๋กœ whisper๋ฅผ ์™ธ๋ถ€์— ์˜คํ”ˆํ•˜๊ธฐ
      • ํ”„๋กฌํ”„ํŠธ ์ง€์›
      • ์‹ค์‹œ๊ฐ„ message chat
      • ํ™”๋ฉด ์ด์˜๊ฒŒ ๋งŒ๋“ค๊ธฐ์™€ ๋กœ๊ทธ์ธ
      • ํŒŒ์ด์ฌ ๊ฐ€์ƒํ™˜๊ฒฝ
      • ์‹ค์‹œ๊ฐ„ voice chat
      • fine tunning(๋ฏธ์„ธ ์กฐ์ •) ์œผ๋กœ ์„ฑ๋Šฅ ์˜ฌ๋ฆฌ๊ธฐ
      • app์—์„œ api๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์‹ค์‹œ๊ฐ„์œผ๋กœ ํ…์ŠคํŠธ๋กœ ๋ฐ”๊ฟ”๋ณด๊ธฐ
    • ollama - llm์„ ์‰ฝ๊ฒŒ ๋‚ด์ปด์—์„œ ์‹คํ–‰
      • ollama webui
      • ollama docker
    • stable diffusion
      • SDXL - text to image
      • SD-webui
    • ChatGPT
      • ๋‹ต๋ณ€์ด ๋Š๊ธธ๋•Œ
      • ์—ญํ• ์„ ์ •ํ•˜์ž
      • ๊ตฌ์ฒด์ ์ธ ์งˆ๋ฌธ
      • ๊ฒฐ๊ณผํ˜•ํƒœ๋ฅผ ์ง€์ •
      • ํ”„๋กฌํ”„ํŠธ๋ฅผ ์—ฌ๋Ÿฌ์ค„๋กœ ์‚ฌ์šฉํ•˜์ž.
      • ๋งˆํ‹ด ํŒŒ์šธ๋Ÿฌ ๊ธ€ ๋ฒˆ์—ญ๋ณธ
    • Prompt Engineering
    • Auto-GPT
    • Gemini
      • google ai studio
      • gemini-api
      • embedding guide
    • Huggingface
      • huggingface ์‚ฌ์šฉ๋ฒ•
      • huggingface nlp ๊ณต๋ถ€์ค‘
    • kaggle
      • download dataset
    • langchain
      • langchain์„ ๊ณต๋ถ€ํ•˜๋ฉฐ ์ •๋ฆฌ
      • basic
      • slackbot
      • rag
      • document-loader
      • website-loader
      • confluence
      • memory
      • function-call
      • langsmith
      • agent-toolkit
  • Ansible
    • templates vs files and jinja2
    • dynamic inventory
    • limit ์˜ต์…˜ ๊ฐ•์ œํ•˜๊ธฐ
    • limit ์‚ฌ์šฉํ›„ gather_fact ๋ฌธ์ œ
  • AWS
    • AWS CLI
    • EKS
      • cluster manage
      • ALB Controller
      • external-dns
      • fargate
    • ECR
    • S3
    • Certificate Manager
  • Azure
    • Azure AD OAuth Client Flow
  • Container
    • Registry
    • ๋นŒ๋“œ์‹œ์— env๊ฐ’ ์„ค์ •ํ•˜๊ธฐ
  • DB
    • PXC
      • Operator
      • PMM
      • ์‚ญ์ œ
      • GTID
      • Cross Site Replication
    • Mssql
    • Mysql
  • dotnet
    • Thread Pool
    • Connection Pool
    • Thread Pool2
  • Devops
    • Recommendation
  • GIT
    • Basic
    • Submodule
  • GitHub
    • Repository
    • GitHub Action
    • GitHub PR
    • Self Hosted Runner
    • GitHub Webhook
  • GitLab
    • CI/CD
    • CI/CD Advance
    • Ssl renew
    • CI/CD Pass env to other job
  • Go Lang
    • ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ๊ตฌ์ถ•
    • multi os binary build
    • kubectl๊ฐ™์€ cli๋งŒ๋“ค๊ธฐ
    • azure ad cli
    • embed static file
    • go study
      • pointer
      • module and package
      • string
      • struct
      • goroutine
  • Kubernetes
    • Kubernetes๋Š” ๋ฌด์—‡์ธ๊ฐ€
    • Tools
    • Install with kubespray
    • Kubernetes hardening guidance
    • 11 ways not to get hacked
    • ArgoCD
      • Install
      • CLI
      • Repository
      • Apps
      • AWS ALB ์‚ฌ์šฉ
      • Notification slack
      • Backup / DR
      • Ingress
      • 2021-11-16 Github error
      • Server Config
      • auth0 ์ธ์ฆ ์ถ”๊ฐ€(oauth,OIDC)
    • Extension
      • Longhorn pvc
      • External dns
      • Ingress nginx
      • Cert Manager
      • Kube prometheus
    • Helm
      • Subchart
      • Tip
    • Loki
    • Persistent Volume
    • TIP
      • Job
      • Pod
      • Log
  • KAFKA
    • raft
  • KVM
    • kvm cpu model
  • Linux
    • DNS Bind9
      • Cert-Manager
      • Certbot
      • Dynamic Update
      • Log
    • Export and variable
    • Grep ์‚ฌ์šฉ๋ฒ•
  • Modeling
    • C4 model introduce
    • Mermaid
    • reference
  • Monitoring
    • Readme
    • 0. What is Monitoring
    • 1. install prometheus and grafana
    • 2. grafana provisioning
    • 3. grafana dashboard
    • 4. grafana portable dashboard
    • 5. prometheus ui
    • 6. prometheus oauth2
    • Prometheus
      • Metric type
      • basic
      • rate vs irate
      • k8s-prometheus
    • Grafana
      • Expolorer
    • Node Exporter
      • advance
      • textfile collector
  • Motivation
    • 3 Simple Rule
  • OPENNEBULA
    • Install(ansible)
    • Install
    • Tip
    • Windows vm
  • Reading
    • comfort zone
    • ๋ฐฐ๋ ค
    • elon musk 6 rule for insane productivity
    • Feynman Technique
    • how to interview - elon musk
    • ๊ฒฝ์ฒญ
    • Readme
  • Redis
    • Install
    • Master-slave Architecture
    • Sentinel
    • Redis Cluster
    • Client programming c#
  • SEO
    • Readme
  • Security
    • criminalip.io
      • criminalip.io
  • Stock
    • robinhood-python
  • Terraform
    • moved block
    • output
  • vault
    • Readme
  • VS Code
    • dev container
    • dev container on remote server
  • Old fashione trend
    • curity
    • MAAS
      • Install maas
      • Manage maas
      • Tip
Powered by GitBook
On this page
  • reference
  • history
  • ๋ชฉํ‘œ
  • stability.ai API ์‚ฌ์šฉ
  • billing
  • prompt guide
  • sdxl on local server
  • Dockerfile ์ƒ์„ฑ
  • docker-compose.yaml ์ƒ์„ฑ
  • ํ™•์ธ

Was this helpful?

  1. AI
  2. stable diffusion

SDXL - text to image

Previousstable diffusionNextSD-webui

Last updated 1 year ago

Was this helpful?

Stable Diffusion

reference

history

Version
Release Date
Notes

SD 1.4

August 2022

Released as open source

SD 1.5

October 2022

Became the standard for many custom models

SD 2.0

November 2022

Updated to V2.1 in December 2022

SDXL 1.0

July 2023

Latest version of Stable Diffusion

Model
Native Resolution

SD 1.5

512x512, 768x768, 512x768, 768x512, 640x832, 832x640

SDXL 1.0

1024x1024, 896x1152, 1152x896, 832x1216, 1216x832, 768x1344, 1344x768, 640x1536, 1526x640

๋ชฉํ‘œ

API๋ฅผ ์‚ฌ์šฉํ•ด์„œ ํ…์ŠคํŠธ๋ฅผ ์ด๋ฏธ์ง€๋กœ ๋งŒ๋“ค์–ด๋ณด๋Š” ๋ถ€๋ถ„์„ ๋จผ์ € ์‚ดํŽด๋ณด๊ณ  ์ดํ›„์—๋Š” ๋กœ์ปฌ์—์„œ ์‚ฌ์šฉ์ด ๊ฐ€๋Šฅํ•˜๊ฒŒ ํ•ด๋ณด์ž.

stability.ai API ์‚ฌ์šฉ

billing

ํฌ๋ ˆ๋”ง ๊ฐ€๊ฒฉ์€ 1,000ํฌ๋ ˆ๋”ง๋‹น 10๋‹ฌ๋Ÿฌ๋กœ, ์•ฝ 5,000๊ฐœ์˜ SDXL 1.0 ์ด๋ฏธ์ง€์— ์ถฉ๋ถ„ํ•œ ํฌ๋ ˆ๋”ง์ž…๋‹ˆ๋‹ค.

10๋‹ฌ๋Ÿฌ์— 5000๊ฐœ. ํ”„๋กฌํ”„ํŠธ๋ฅผ ๋ฐ”๊ฟ”๊ฐ€๋ฉด์„œ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ํ•œ๋‹ฌ์— 100๋‹ฌ๋Ÿฌ ์ •๋„ ์ƒ๊ฐํ•˜๋ฉด๋ ๊ฑฐ๊ฐ™๋‹ค.

ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ž˜์จ์„œ ๋ฆฌํ€˜์ŠคํŠธ๋ฅผ ์ค„์ด๋ฉด ์ข€ ๋ ๋“ฏ.

prompt guide

api๋ฅผ ์“ฐ๋ฉด ๋˜๋Š”๊ฑฐ๊ฐ™์€๋ฐ curl๋กœ ๊ทธ๋ƒฅ ๋‚ ๋ ค๋„ ๋˜๊ณ 

sdxl on local server

๋กœ์ปฌ์—์„œ ์‹คํ–‰ํ•ด๋ณด์ž.

pytorch๊ฐ€ ํ•„์š”ํ•˜๋‹ค.

Dockerfile ์ƒ์„ฑ

vi Dockerfile
```

```Dockerfile
FROM pytorch/pytorch:2.1.2-cuda12.1-cudnn8-runtime

WORKDIR /app

RUN apt update

RUN python -m pip install diffusers[torch] transformers accelerate --upgrade

docker-compose.yaml ์ƒ์„ฑ

vi docker-compose.yaml
version: '3.8'
services:
  sdxl:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: sdxl
    command: ['sleep', '6000']
    restart: unless-stopped
    ports:
      - 8000:8000
    volumes:
      - ./app:/app/
    deploy:
      resources:
        reservations:
          devices:
            - driver: 'nvidia'
              capabilities: [gpu]
              count: all
docker-compose up -d --build
docker exec -it sdxl bash

ํ™•์ธ

์ด์ œ docker์—์„œ pytorch๊ฐ€ ๋˜๋Š”๊ฑฐ ํ™•์ธํ•ด๋ณด์ž.

import torch
print(torch.__version__)

๊ฒฐ๊ณผ๊ฐ€ ๋‚˜์˜ค๋ฉด ์„ฑ๊ณต์ด๋‹ค.

๋งŽ์€ ๋ชจ๋ธ์ด ์ž‡๊ณ  ๋‚˜๋Š” stabilityai/sdxl-turbo ์ด๊ฑธ ์ด์šฉํ•˜๋ ค๊ณ ํ•จ.

A pipeline is a quick and easy way to run a model for inference, requiring no more than four lines of code to generate an image:

ํŒŒ์ดํ”„๋ผ์ธ์€ ์ถ”๋ก ์„ ์œ„ํ•ด ๋ชจ๋ธ์„ ์‹คํ–‰ํ•˜๋Š” ๋น ๋ฅด๊ณ  ์‰ฌ์šด ๋ฐฉ๋ฒ•์œผ๋กœ, ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ฐ ์ฝ”๋“œ๊ฐ€ 4์ค„ ์ด์ƒ ํ•„์š”ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค:

from diffusers import DiffusionPipeline
import torch

pipeline = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo", torch_dtype=torch.float16)
pipeline.to("cuda")
pipeline("An image of a squirrel in Picasso style").images[0]
image.save("test.png")

๊ทธ๋ฆผ์ด ์ด์ œ ์ƒ์„ฑ์ด ๋œ๋‹ค.

์‰ฝ๋‹ค.

sd-turbo ๋ชจ๋ธ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ฝ”๋“œ์ด๋‹ค

from diffusers import AutoPipelineForText2Image
import torch

pipeline = AutoPipelineForText2Image.from_pretrained(
	"stabilityai/sd-turbo", torch_dtype=torch.float16, variant="fp16"
).to("cuda")
generator = torch.Generator("cuda").manual_seed(31)
image = pipeline("cat riding elephant", generator=generator).images[0]
image.save("test.png")

์—ฌ๊ธฐ์—์„œ api์ƒ์„ฑ. api๋ฅผ ๋งŒ๋“ค์–ด์„œ curl๋กœ ์ด์šฉํ•˜๋ฉด๋œ๋‹ค.

์—์„œ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•˜๋‹ค.

์ด๋Ÿฐ๊ฒƒ๋„ ์ž‡๋Š”๋ฐ ์ด๋Ÿฐ๊ฑด dreamstudio์˜ api๋ฅผ ์“ฐ๋Š”๊ฑฐ๊ฐ™์€๋ฐ? apiํ‚ค๋ฅผ ์ œ๊ณตํ•˜์ง€๋Š” ์•Š๋Š”๋‹ค. email๋กœ ๋งŒ ํ•˜๋ผ๊ณ  ํ•˜๋Š”๋ฐ ์•„๋ฌด๋ž˜๋„ ๋น„์šฉ์ด ๋“ค์–ด๊ฐ€๋Š”๋“ฏ. 500์žฅ ๋ฌด๋ฃŒ๋ผ๊ณ  ํ•ด์„œ ์จ๋ณผ๋ ค๊ณ  ํ–‡๋Š”๋ฐ ์•ˆ๋ ๋“ฏ.

๊ฐ€์ด๋“œ๋„ ๋ด๋„ ๋ ๊ฑฐ๊ฐ™๋‹ค.

huggingface์—์„œ ์˜คํ”ˆ์†Œ์Šค๋กœ ์ œ๊ณตํ•˜๋Š” ๋‹ค์Œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์‹คํ–‰ํ•ด๋ณด์ž.

์‚ฌ์šฉ๋ฒ•์€ ๋‹ค์Œ ์ฐธ์กฐ :

https://stability.ai/stable-diffusion
https://huggingface.co/stabilityai
https://huggingface.co/stabilityai/sdxl-turbo
https://platform.stability.ai/account/keys
https://clipdrop.co/stable-diffusion-turbo
https://playground.com
https://platform.stability.ai/docs/getting-started/credits-and-billing
https://platform.stability.ai/pricing
https://dreamstudio.ai/prompt-guide
https://platform.stability.ai/docs/api-reference#tag/v1generation/operation/textToImage
https://github.com/huggingface/diffusers
https://huggingface.co/docs/diffusers/tutorials/tutorial_overview
https://huggingface.co/stabilityai