Buckets:
| import"../chunks/DsnmJJEf.js";import{i as b,h as y,C as _,H as w,a as e,E as v,s as M}from"../chunks/CFM6C53a.js";import{p as Z,o as k,s as a,f as j,a as d,b as G,c as h,n as J}from"../chunks/CNc7KuUZ.js";import{D as T}from"../chunks/BK2xlcGK.js";const U='{"title":"조건부 이미지 생성","local":"조건부-이미지-생성","sections":[],"depth":1}';var x=h('<meta name="hf:doc:metadata"/>'),P=h(`<p></p> <!> <!> <!> <p>조건부 이미지 생성을 사용하면 텍스트 프롬프트에서 이미지를 생성할 수 있습니다. 텍스트는 임베딩으로 변환되며, 임베딩은 노이즈에서 이미지를 생성하도록 모델을 조건화하는 데 사용됩니다.</p> <p><code>DiffusionPipeline</code>은 추론을 위해 사전 훈련된 diffusion 시스템을 사용하는 가장 쉬운 방법입니다.</p> <p>먼저 <code>DiffusionPipeline</code>의 인스턴스를 생성하고 다운로드할 파이프라인 <a href="https://huggingface.co/models?library=diffusers&sort=downloads" rel="nofollow">체크포인트</a>를 지정합니다.</p> <p>이 가이드에서는 <a href="https://huggingface.co/CompVis/ldm-text2im-large-256" rel="nofollow">잠재 Diffusion</a>과 함께 텍스트-이미지 생성에 <code>DiffusionPipeline</code>을 사용합니다:</p> <!> <p><code>DiffusionPipeline</code>은 모든 모델링, 토큰화, 스케줄링 구성 요소를 다운로드하고 캐시합니다. | |
| 이 모델은 약 14억 개의 파라미터로 구성되어 있기 때문에 GPU에서 실행할 것을 강력히 권장합니다. | |
| PyTorch에서와 마찬가지로 생성기 객체를 GPU로 이동할 수 있습니다:</p> <!> <p>이제 텍스트 프롬프트에서 <code>생성기</code>를 사용할 수 있습니다:</p> <!> <p>출력값은 기본적으로 <a href="https://pillow.readthedocs.io/en/stable/reference/Image.html?highlight=image#the-image-class" rel="nofollow"><code>PIL.Image</code></a> 객체로 래핑됩니다.</p> <p>호출하여 이미지를 저장할 수 있습니다:</p> <!> <p>아래 스페이스를 사용해보고 안내 배율 매개변수를 자유롭게 조정하여 이미지 품질에 어떤 영향을 미치는지 확인해 보세요!</p> <iframe src="https://stabilityai-stable-diffusion.hf.space" frameborder="0" width="850" height="500"></iframe> <!> <p></p>`,1);function q(m,f){Z(f,!1),k(()=>{new URLSearchParams(window.location.search).get("fw")}),b();var o=P();y("1t3xpvd",g=>{var c=x();M(c,"content",U),d(g,c)});var s=a(j(o),2);_(s,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var i=a(s,2);T(i,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/conditional_image_generation.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/pytorch/conditional_image_generation.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/ko/tensorflow/conditional_image_generation.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/conditional_image_generation.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/pytorch/conditional_image_generation.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/ko/tensorflow/conditional_image_generation.ipynb"}]});var n=a(i,2);w(n,{title:"조건부 이미지 생성",local:"조건부-이미지-생성",headingTag:"h1"});var t=a(n,10);e(t,{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTBBZ2VuZXJhdG9yJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMkNvbXBWaXMlMkZsZG0tdGV4dDJpbS1sYXJnZS0yNTYlMjIp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline | |
| <span class="hljs-meta">>>> </span>generator = DiffusionPipeline.from_pretrained(<span class="hljs-string">"CompVis/ldm-text2im-large-256"</span>)`,lang:"python",wrap:!1});var l=a(t,4);e(l,{code:"Z2VuZXJhdG9yLnRvKCUyMmN1ZGElMjIp",highlighted:'<span class="hljs-meta">>>> </span>generator.to(<span class="hljs-string">"cuda"</span>)',lang:"python",wrap:!1});var p=a(l,4);e(p,{code:"aW1hZ2UlMjAlM0QlMjBnZW5lcmF0b3IoJTIyQW4lMjBpbWFnZSUyMG9mJTIwYSUyMHNxdWlycmVsJTIwaW4lMjBQaWNhc3NvJTIwc3R5bGUlMjIpLmltYWdlcyU1QjAlNUQ=",highlighted:'<span class="hljs-meta">>>> </span>image = generator(<span class="hljs-string">"An image of a squirrel in Picasso style"</span>).images[<span class="hljs-number">0</span>]',lang:"python",wrap:!1});var r=a(p,6);e(r,{code:"aW1hZ2Uuc2F2ZSglMjJpbWFnZV9vZl9zcXVpcnJlbF9wYWludGluZy5wbmclMjIp",highlighted:'<span class="hljs-meta">>>> </span>image.save(<span class="hljs-string">"image_of_squirrel_painting.png"</span>)',lang:"python",wrap:!1});var u=a(r,6);v(u,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/ko/using-diffusers/conditional_image_generation.md"}),J(2),d(m,o),G()}export{q as component}; | |
Xet Storage Details
- Size:
- 5.42 kB
- Xet hash:
- c113a646245ed99f5218dd4f25723161145ba5aa5610cd4c4c6b9d2df4daca70
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.