Buckets:
| import{s as os,o as cs,n as rs}from"../chunks/scheduler.53228c21.js";import{S as ms,i as ds,e as i,s as n,c,h as hs,a as p,d as s,b as l,f as Je,g as m,j as o,k as T,l as _,m as a,n as d,t as h,o as u,p as f}from"../chunks/index.100fac89.js";import{C as us}from"../chunks/CopyLLMTxtMenu.d1e397cd.js";import{D as We}from"../chunks/Docstring.0bff03bd.js";import{C as I}from"../chunks/CodeBlock.0adb3827.js";import{E as ps}from"../chunks/ExampleCodeBlock.7ae19316.js";import{H as je,E as fs}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.452cf2a8.js";function gs(Te){let g,Z="Examples:",w,y,M;return y=new I({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX2dpZiUwQSUwQWRldmljZSUyMCUzRCUyMHRvcmNoLmRldmljZSglMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiklMEElMEFyZXBvJTIwJTNEJTIwJTIyb3BlbmFpJTJGc2hhcC1lJTIyJTBBcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChyZXBvJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKGRldmljZSklMEElMEFndWlkYW5jZV9zY2FsZSUyMCUzRCUyMDE1LjAlMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwc2hhcmslMjIlMEElMEFpbWFnZXMlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNEZ3VpZGFuY2Vfc2NhbGUlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENjQlMkMlMEElMjAlMjAlMjAlMjBmcmFtZV9zaXplJTNEMjU2JTJDJTBBKS5pbWFnZXMlMEElMEFnaWZfcGF0aCUyMCUzRCUyMGV4cG9ydF90b19naWYoaW1hZ2VzJTVCMCU1RCUyQyUyMCUyMnNoYXJrXzNkLmdpZiUyMik=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_gif | |
| <span class="hljs-meta">>>> </span>device = torch.device(<span class="hljs-string">"cuda"</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">"cpu"</span>) | |
| <span class="hljs-meta">>>> </span>repo = <span class="hljs-string">"openai/shap-e"</span> | |
| <span class="hljs-meta">>>> </span>pipe = DiffusionPipeline.from_pretrained(repo, torch_dtype=torch.float16) | |
| <span class="hljs-meta">>>> </span>pipe = pipe.to(device) | |
| <span class="hljs-meta">>>> </span>guidance_scale = <span class="hljs-number">15.0</span> | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"a shark"</span> | |
| <span class="hljs-meta">>>> </span>images = pipe( | |
| <span class="hljs-meta">... </span> prompt, | |
| <span class="hljs-meta">... </span> guidance_scale=guidance_scale, | |
| <span class="hljs-meta">... </span> num_inference_steps=<span class="hljs-number">64</span>, | |
| <span class="hljs-meta">... </span> frame_size=<span class="hljs-number">256</span>, | |
| <span class="hljs-meta">... </span>).images | |
| <span class="hljs-meta">>>> </span>gif_path = export_to_gif(images[<span class="hljs-number">0</span>], <span class="hljs-string">"shark_3d.gif"</span>)`,lang:"py",wrap:!1}}),{c(){g=i("p"),g.textContent=Z,w=n(),c(y.$$.fragment)},l(r){g=p(r,"P",{"data-svelte-h":!0}),o(g)!=="svelte-kvfsh7"&&(g.textContent=Z),w=l(r),m(y.$$.fragment,r)},m(r,b){a(r,g,b),a(r,w,b),d(y,r,b),M=!0},p:rs,i(r){M||(h(y.$$.fragment,r),M=!0)},o(r){u(y.$$.fragment,r),M=!1},d(r){r&&(s(g),s(w)),f(y,r)}}}function _s(Te){let g,Z="Examples:",w,y,M;return y=new I({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX2dpZiUyQyUyMGxvYWRfaW1hZ2UlMEElMEFkZXZpY2UlMjAlM0QlMjB0b3JjaC5kZXZpY2UoJTIyY3VkYSUyMiUyMGlmJTIwdG9yY2guY3VkYS5pc19hdmFpbGFibGUoKSUyMGVsc2UlMjAlMjJjcHUlMjIpJTBBJTBBcmVwbyUyMCUzRCUyMCUyMm9wZW5haSUyRnNoYXAtZS1pbWcyaW1nJTIyJTBBcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChyZXBvJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKGRldmljZSklMEElMEFndWlkYW5jZV9zY2FsZSUyMCUzRCUyMDMuMCUwQWltYWdlX3VybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGaGYuY28lMkZkYXRhc2V0cyUyRmRpZmZ1c2VycyUyRmRvY3MtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZzaGFwLWUlMkZjb3JnaS5wbmclMjIlMEFpbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UoaW1hZ2VfdXJsKS5jb252ZXJ0KCUyMlJHQiUyMiklMEElMEFpbWFnZXMlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMGltYWdlJTJDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0RndWlkYW5jZV9zY2FsZSUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q2NCUyQyUwQSUyMCUyMCUyMCUyMGZyYW1lX3NpemUlM0QyNTYlMkMlMEEpLmltYWdlcyUwQSUwQWdpZl9wYXRoJTIwJTNEJTIwZXhwb3J0X3RvX2dpZihpbWFnZXMlNUIwJTVEJTJDJTIwJTIyY29yZ2lfM2QuZ2lmJTIyKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_gif, load_image | |
| <span class="hljs-meta">>>> </span>device = torch.device(<span class="hljs-string">"cuda"</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">"cpu"</span>) | |
| <span class="hljs-meta">>>> </span>repo = <span class="hljs-string">"openai/shap-e-img2img"</span> | |
| <span class="hljs-meta">>>> </span>pipe = DiffusionPipeline.from_pretrained(repo, torch_dtype=torch.float16) | |
| <span class="hljs-meta">>>> </span>pipe = pipe.to(device) | |
| <span class="hljs-meta">>>> </span>guidance_scale = <span class="hljs-number">3.0</span> | |
| <span class="hljs-meta">>>> </span>image_url = <span class="hljs-string">"https://hf.co/datasets/diffusers/docs-images/resolve/main/shap-e/corgi.png"</span> | |
| <span class="hljs-meta">>>> </span>image = load_image(image_url).convert(<span class="hljs-string">"RGB"</span>) | |
| <span class="hljs-meta">>>> </span>images = pipe( | |
| <span class="hljs-meta">... </span> image, | |
| <span class="hljs-meta">... </span> guidance_scale=guidance_scale, | |
| <span class="hljs-meta">... </span> num_inference_steps=<span class="hljs-number">64</span>, | |
| <span class="hljs-meta">... </span> frame_size=<span class="hljs-number">256</span>, | |
| <span class="hljs-meta">... </span>).images | |
| <span class="hljs-meta">>>> </span>gif_path = export_to_gif(images[<span class="hljs-number">0</span>], <span class="hljs-string">"corgi_3d.gif"</span>)`,lang:"py",wrap:!1}}),{c(){g=i("p"),g.textContent=Z,w=n(),c(y.$$.fragment)},l(r){g=p(r,"P",{"data-svelte-h":!0}),o(g)!=="svelte-kvfsh7"&&(g.textContent=Z),w=l(r),m(y.$$.fragment,r)},m(r,b){a(r,g,b),a(r,w,b),d(y,r,b),M=!0},p:rs,i(r){M||(h(y.$$.fragment,r),M=!0)},o(r){u(y.$$.fragment,r),M=!1},d(r){r&&(s(g),s(w)),f(y,r)}}}function ys(Te){let g,Z,w,y,M,r,b,Ge,X,Wt='The Shap-E model was proposed in <a href="https://huggingface.co/papers/2305.02463" rel="nofollow">Shap-E: Generating Conditional 3D Implicit Functions</a> by Alex Nichol and Heewoo Jun from <a href="https://github.com/openai" rel="nofollow">OpenAI</a>.',ke,V,Gt="The abstract from the paper is:",Pe,z,kt="<em>We present Shap-E, a conditional generative model for 3D assets. Unlike recent work on 3D generative models which produce a single output representation, Shap-E directly generates the parameters of implicit functions that can be rendered as both textured meshes and neural radiance fields. We train Shap-E in two stages: first, we train an encoder that deterministically maps 3D assets into the parameters of an implicit function; second, we train a conditional diffusion model on outputs of the encoder. When trained on a large dataset of paired 3D and text data, our resulting models are capable of generating complex and diverse 3D assets in a matter of seconds. When compared to Point-E, an explicit generative model over point clouds, Shap-E converges faster and reaches comparable or better sample quality despite modeling a higher-dimensional, multi-representation output space.</em>",Be,q,Pt='The original codebase can be found at <a href="https://github.com/openai/shap-e" rel="nofollow">openai/shap-e</a>.',Re,x,Bt='<p>See the <a href="../../using-diffusers/loading#reuse-a-pipeline">reuse components across pipelines</a> section to learn how to efficiently load the same components into multiple pipelines.</p>',Xe,N,Rt="Make sure you have the following libraries installed.",Ve,Y,ze,L,qe,F,Xt='To generate a gif of a 3D object, pass a text prompt to the <a href="/docs/diffusers/pr_13771/en/api/pipelines/shap_e#diffusers.ShapEPipeline">ShapEPipeline</a>. The pipeline generates a list of image frames which are used to create the 3D object.',Ne,Q,Ye,H,Vt='Now use the <a href="/docs/diffusers/pr_13771/en/api/utilities#diffusers.utils.export_to_gif">export_to_gif()</a> function to convert the list of image frames to a gif of the 3D object.',Le,D,Fe,S,zt='<div><img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/shap_e/firecracker_out.gif"/> <figcaption class="mt-2 text-center text-sm text-gray-500">prompt = "A firecracker"</figcaption></div> <div><img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/shap_e/cake_out.gif"/> <figcaption class="mt-2 text-center text-sm text-gray-500">prompt = "A birthday cupcake"</figcaption></div>',Qe,A,He,K,qt='To generate a 3D object from another image, use the <a href="/docs/diffusers/pr_13771/en/api/pipelines/shap_e#diffusers.ShapEImg2ImgPipeline">ShapEImg2ImgPipeline</a>. You can use an existing image or generate an entirely new one. Let’s use the <a href="./kandinsky">Kandinsky 2.1</a> model to generate a new image.',De,O,Ae,ee,Nt='Pass the cheeseburger to the <a href="/docs/diffusers/pr_13771/en/api/pipelines/shap_e#diffusers.ShapEImg2ImgPipeline">ShapEImg2ImgPipeline</a> to generate a 3D representation of it.',Ke,te,Oe,W,Yt='<div><img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/shap_e/burger_in.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">cheeseburger</figcaption></div> <div><img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/shap_e/burger_out.gif"/> <figcaption class="mt-2 text-center text-sm text-gray-500">3D cheeseburger</figcaption></div>',et,se,tt,ae,Lt='Shap-E is a flexible model that can also generate textured mesh outputs to be rendered for downstream applications. In this example, you’ll convert the output into a <code>glb</code> file because the 🤗 Datasets library supports mesh visualization of <code>glb</code> files which can be rendered by the <a href="https://huggingface.co/docs/hub/datasets-viewer#dataset-preview" rel="nofollow">Dataset viewer</a>.',st,ne,Ft='You can generate mesh outputs for both the <a href="/docs/diffusers/pr_13771/en/api/pipelines/shap_e#diffusers.ShapEPipeline">ShapEPipeline</a> and <a href="/docs/diffusers/pr_13771/en/api/pipelines/shap_e#diffusers.ShapEImg2ImgPipeline">ShapEImg2ImgPipeline</a> by specifying the <code>output_type</code> parameter as <code>"mesh"</code>:',at,le,nt,ie,Qt="Use the <code>export_to_ply()</code> function to save the mesh output as a <code>ply</code> file:",lt,G,Ht="<p>You can optionally save the mesh output as an <code>obj</code> file with the <code>export_to_obj()</code> function. The ability to save the mesh output in a variety of formats makes it more flexible for downstream usage!</p>",it,pe,pt,re,Dt="Then you can convert the <code>ply</code> file to a <code>glb</code> file with the trimesh library:",rt,oe,ot,ce,At="By default, the mesh output is focused from the bottom viewpoint but you can change the default viewpoint by applying a rotation transform:",ct,me,mt,de,Kt="Upload the mesh file to your dataset repository to visualize it with the Dataset viewer!",dt,k,Ot='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/3D-cake.gif"/>',ht,he,ut,J,ue,jt,Ue,es="Pipeline for generating latent representation of a 3D asset and rendering with the NeRF method.",Tt,Ie,ts=`This model inherits from <a href="/docs/diffusers/pr_13771/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>. Check the superclass documentation for the generic methods | |
| implemented for all pipelines (downloading, saving, running on a particular device, etc.).`,Ut,v,fe,It,Ze,ss="The call function to the pipeline for generation.",Zt,P,ft,ge,gt,j,_e,vt,ve,as="Pipeline for generating latent representation of a 3D asset and rendering with the NeRF method from an image.",Ct,Ce,ns=`This model inherits from <a href="/docs/diffusers/pr_13771/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>. Check the superclass documentation for the generic methods | |
| implemented for all pipelines (downloading, saving, running on a particular device, etc.).`,Et,C,ye,$t,Ee,ls="The call function to the pipeline for generation.",xt,B,_t,Me,yt,E,we,St,$e,is='Output class for <a href="/docs/diffusers/pr_13771/en/api/pipelines/shap_e#diffusers.ShapEPipeline">ShapEPipeline</a> and <a href="/docs/diffusers/pr_13771/en/api/pipelines/shap_e#diffusers.ShapEImg2ImgPipeline">ShapEImg2ImgPipeline</a>.',Mt,be,wt,Se,bt;return M=new us({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),b=new je({props:{title:"Shap-E",local:"shap-e",headingTag:"h1"}}),Y=new I({props:{code:"JTIzJTIwdW5jb21tZW50JTIwdG8lMjBpbnN0YWxsJTIwdGhlJTIwbmVjZXNzYXJ5JTIwbGlicmFyaWVzJTIwaW4lMjBDb2xhYiUwQSUyMyFwaXAlMjBpbnN0YWxsJTIwLXElMjBkaWZmdXNlcnMlMjB0cmFuc2Zvcm1lcnMlMjBhY2NlbGVyYXRlJTIwdHJpbWVzaA==",highlighted:`<span class="hljs-comment"># uncomment to install the necessary libraries in Colab</span> | |
| <span class="hljs-comment">#!pip install -q diffusers transformers accelerate trimesh</span>`,lang:"py",wrap:!1}}),L=new je({props:{title:"Text-to-3D",local:"text-to-3d",headingTag:"h2"}}),Q=new I({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU2hhcEVQaXBlbGluZSUwQSUwQWRldmljZSUyMCUzRCUyMHRvcmNoLmRldmljZSglMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiklMEElMEFwaXBlJTIwJTNEJTIwU2hhcEVQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGc2hhcC1lJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oZGV2aWNlKSUwQSUwQWd1aWRhbmNlX3NjYWxlJTIwJTNEJTIwMTUuMCUwQXByb21wdCUyMCUzRCUyMCU1QiUyMkElMjBmaXJlY3JhY2tlciUyMiUyQyUyMCUyMkElMjBiaXJ0aGRheSUyMGN1cGNha2UlMjIlNUQlMEElMEFpbWFnZXMlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNEZ3VpZGFuY2Vfc2NhbGUlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENjQlMkMlMEElMjAlMjAlMjAlMjBmcmFtZV9zaXplJTNEMjU2JTJDJTBBKS5pbWFnZXM=",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ShapEPipeline | |
| device = torch.device(<span class="hljs-string">"cuda"</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">"cpu"</span>) | |
| pipe = ShapEPipeline.from_pretrained(<span class="hljs-string">"openai/shap-e"</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">"fp16"</span>) | |
| pipe = pipe.to(device) | |
| guidance_scale = <span class="hljs-number">15.0</span> | |
| prompt = [<span class="hljs-string">"A firecracker"</span>, <span class="hljs-string">"A birthday cupcake"</span>] | |
| images = pipe( | |
| prompt, | |
| guidance_scale=guidance_scale, | |
| num_inference_steps=<span class="hljs-number">64</span>, | |
| frame_size=<span class="hljs-number">256</span>, | |
| ).images`,lang:"py",wrap:!1}}),D=new I({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGV4cG9ydF90b19naWYlMEElMEFleHBvcnRfdG9fZ2lmKGltYWdlcyU1QjAlNUQlMkMlMjAlMjJmaXJlY3JhY2tlcl8zZC5naWYlMjIpJTBBZXhwb3J0X3RvX2dpZihpbWFnZXMlNUIxJTVEJTJDJTIwJTIyY2FrZV8zZC5naWYlMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_gif | |
| export_to_gif(images[<span class="hljs-number">0</span>], <span class="hljs-string">"firecracker_3d.gif"</span>) | |
| export_to_gif(images[<span class="hljs-number">1</span>], <span class="hljs-string">"cake_3d.gif"</span>)`,lang:"py",wrap:!1}}),A=new je({props:{title:"Image-to-3D",local:"image-to-3d",headingTag:"h2"}}),O=new I({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwcmlvcl9waXBlbGluZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMS1wcmlvciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTElMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKS50byglMjJjdWRhJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBjaGVlc2VidXJnZXIlMkMlMjB3aGl0ZSUyMGJhY2tncm91bmQlMjIlMEElMEFpbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlMjAlM0QlMjBwcmlvcl9waXBlbGluZShwcm9tcHQlMkMlMjBndWlkYW5jZV9zY2FsZSUzRDEuMCkudG9fdHVwbGUoKSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwaW1hZ2VfZW1iZWRzJTNEaW1hZ2VfZW1iZWRzJTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTNEbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTJDJTBBKS5pbWFnZXMlNUIwJTVEJTBBJTBBaW1hZ2Uuc2F2ZSglMjJidXJnZXIucG5nJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline | |
| <span class="hljs-keyword">import</span> torch | |
| prior_pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">"kandinsky-community/kandinsky-2-1-prior"</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">"cuda"</span>) | |
| pipeline = DiffusionPipeline.from_pretrained(<span class="hljs-string">"kandinsky-community/kandinsky-2-1"</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">"cuda"</span>) | |
| prompt = <span class="hljs-string">"A cheeseburger, white background"</span> | |
| image_embeds, negative_image_embeds = prior_pipeline(prompt, guidance_scale=<span class="hljs-number">1.0</span>).to_tuple() | |
| image = pipeline( | |
| prompt, | |
| image_embeds=image_embeds, | |
| negative_image_embeds=negative_image_embeds, | |
| ).images[<span class="hljs-number">0</span>] | |
| image.save(<span class="hljs-string">"burger.png"</span>)`,lang:"py",wrap:!1}}),te=new I({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFNoYXBFSW1nMkltZ1BpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGV4cG9ydF90b19naWYlMEElMEFwaXBlJTIwJTNEJTIwU2hhcEVJbWcySW1nUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMm9wZW5haSUyRnNoYXAtZS1pbWcyaW1nJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIpLnRvKCUyMmN1ZGElMjIpJTBBJTBBZ3VpZGFuY2Vfc2NhbGUlMjAlM0QlMjAzLjAlMEFpbWFnZSUyMCUzRCUyMEltYWdlLm9wZW4oJTIyYnVyZ2VyLnBuZyUyMikucmVzaXplKCgyNTYlMkMlMjAyNTYpKSUwQSUwQWltYWdlcyUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwaW1hZ2UlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRGd1aWRhbmNlX3NjYWxlJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDY0JTJDJTBBJTIwJTIwJTIwJTIwZnJhbWVfc2l6ZSUzRDI1NiUyQyUwQSkuaW1hZ2VzJTBBJTBBZ2lmX3BhdGglMjAlM0QlMjBleHBvcnRfdG9fZ2lmKGltYWdlcyU1QjAlNUQlMkMlMjAlMjJidXJnZXJfM2QuZ2lmJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ShapEImg2ImgPipeline | |
| <span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_gif | |
| pipe = ShapEImg2ImgPipeline.from_pretrained(<span class="hljs-string">"openai/shap-e-img2img"</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">"fp16"</span>).to(<span class="hljs-string">"cuda"</span>) | |
| guidance_scale = <span class="hljs-number">3.0</span> | |
| image = Image.<span class="hljs-built_in">open</span>(<span class="hljs-string">"burger.png"</span>).resize((<span class="hljs-number">256</span>, <span class="hljs-number">256</span>)) | |
| images = pipe( | |
| image, | |
| guidance_scale=guidance_scale, | |
| num_inference_steps=<span class="hljs-number">64</span>, | |
| frame_size=<span class="hljs-number">256</span>, | |
| ).images | |
| gif_path = export_to_gif(images[<span class="hljs-number">0</span>], <span class="hljs-string">"burger_3d.gif"</span>)`,lang:"py",wrap:!1}}),se=new je({props:{title:"Generate mesh",local:"generate-mesh",headingTag:"h2"}}),le=new I({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU2hhcEVQaXBlbGluZSUwQSUwQWRldmljZSUyMCUzRCUyMHRvcmNoLmRldmljZSglMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiklMEElMEFwaXBlJTIwJTNEJTIwU2hhcEVQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyb3BlbmFpJTJGc2hhcC1lJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oZGV2aWNlKSUwQSUwQWd1aWRhbmNlX3NjYWxlJTIwJTNEJTIwMTUuMCUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBiaXJ0aGRheSUyMGN1cGNha2UlMjIlMEElMEFpbWFnZXMlMjAlM0QlMjBwaXBlKHByb21wdCUyQyUyMGd1aWRhbmNlX3NjYWxlJTNEZ3VpZGFuY2Vfc2NhbGUlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENjQlMkMlMjBmcmFtZV9zaXplJTNEMjU2JTJDJTIwb3V0cHV0X3R5cGUlM0QlMjJtZXNoJTIyKS5pbWFnZXM=",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ShapEPipeline | |
| device = torch.device(<span class="hljs-string">"cuda"</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">"cpu"</span>) | |
| pipe = ShapEPipeline.from_pretrained(<span class="hljs-string">"openai/shap-e"</span>, torch_dtype=torch.float16, variant=<span class="hljs-string">"fp16"</span>) | |
| pipe = pipe.to(device) | |
| guidance_scale = <span class="hljs-number">15.0</span> | |
| prompt = <span class="hljs-string">"A birthday cupcake"</span> | |
| images = pipe(prompt, guidance_scale=guidance_scale, num_inference_steps=<span class="hljs-number">64</span>, frame_size=<span class="hljs-number">256</span>, output_type=<span class="hljs-string">"mesh"</span>).images`,lang:"py",wrap:!1}}),pe=new I({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGV4cG9ydF90b19wbHklMEElMEFwbHlfcGF0aCUyMCUzRCUyMGV4cG9ydF90b19wbHkoaW1hZ2VzJTVCMCU1RCUyQyUyMCUyMjNkX2Nha2UucGx5JTIyKSUwQXByaW50KGYlMjJTYXZlZCUyMHRvJTIwZm9sZGVyJTNBJTIwJTdCcGx5X3BhdGglN0QlMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_ply | |
| ply_path = export_to_ply(images[<span class="hljs-number">0</span>], <span class="hljs-string">"3d_cake.ply"</span>) | |
| <span class="hljs-built_in">print</span>(<span class="hljs-string">f"Saved to folder: <span class="hljs-subst">{ply_path}</span>"</span>)`,lang:"py",wrap:!1}}),oe=new I({props:{code:"aW1wb3J0JTIwdHJpbWVzaCUwQSUwQW1lc2glMjAlM0QlMjB0cmltZXNoLmxvYWQoJTIyM2RfY2FrZS5wbHklMjIpJTBBbWVzaF9leHBvcnQlMjAlM0QlMjBtZXNoLmV4cG9ydCglMjIzZF9jYWtlLmdsYiUyMiUyQyUyMGZpbGVfdHlwZSUzRCUyMmdsYiUyMik=",highlighted:`<span class="hljs-keyword">import</span> trimesh | |
| mesh = trimesh.load(<span class="hljs-string">"3d_cake.ply"</span>) | |
| mesh_export = mesh.export(<span class="hljs-string">"3d_cake.glb"</span>, file_type=<span class="hljs-string">"glb"</span>)`,lang:"py",wrap:!1}}),me=new I({props:{code:"aW1wb3J0JTIwdHJpbWVzaCUwQWltcG9ydCUyMG51bXB5JTIwYXMlMjBucCUwQSUwQW1lc2glMjAlM0QlMjB0cmltZXNoLmxvYWQoJTIyM2RfY2FrZS5wbHklMjIpJTBBcm90JTIwJTNEJTIwdHJpbWVzaC50cmFuc2Zvcm1hdGlvbnMucm90YXRpb25fbWF0cml4KC1ucC5waSUyMCUyRiUyMDIlMkMlMjAlNUIxJTJDJTIwMCUyQyUyMDAlNUQpJTBBbWVzaCUyMCUzRCUyMG1lc2guYXBwbHlfdHJhbnNmb3JtKHJvdCklMEFtZXNoX2V4cG9ydCUyMCUzRCUyMG1lc2guZXhwb3J0KCUyMjNkX2Nha2UuZ2xiJTIyJTJDJTIwZmlsZV90eXBlJTNEJTIyZ2xiJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> trimesh | |
| <span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np | |
| mesh = trimesh.load(<span class="hljs-string">"3d_cake.ply"</span>) | |
| rot = trimesh.transformations.rotation_matrix(-np.pi / <span class="hljs-number">2</span>, [<span class="hljs-number">1</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]) | |
| mesh = mesh.apply_transform(rot) | |
| mesh_export = mesh.export(<span class="hljs-string">"3d_cake.glb"</span>, file_type=<span class="hljs-string">"glb"</span>)`,lang:"py",wrap:!1}}),he=new je({props:{title:"ShapEPipeline",local:"diffusers.ShapEPipeline",headingTag:"h2"}}),ue=new We({props:{name:"class diffusers.ShapEPipeline",anchor:"diffusers.ShapEPipeline",parameters:[{name:"prior",val:": PriorTransformer"},{name:"text_encoder",val:": CLIPTextModelWithProjection"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"scheduler",val:": HeunDiscreteScheduler"},{name:"shap_e_renderer",val:": ShapERenderer"}],parametersDescription:[{anchor:"diffusers.ShapEPipeline.prior",description:`<strong>prior</strong> (<a href="/docs/diffusers/pr_13771/en/api/models/prior_transformer#diffusers.PriorTransformer">PriorTransformer</a>) — | |
| The canonical unCLIP prior to approximate the image embedding from the text embedding.`,name:"prior"},{anchor:"diffusers.ShapEPipeline.text_encoder",description:`<strong>text_encoder</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextModelWithProjection" rel="nofollow">CLIPTextModelWithProjection</a>) — | |
| Frozen text-encoder.`,name:"text_encoder"},{anchor:"diffusers.ShapEPipeline.tokenizer",description:`<strong>tokenizer</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>) — | |
| A <code>CLIPTokenizer</code> to tokenize text.`,name:"tokenizer"},{anchor:"diffusers.ShapEPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_13771/en/api/schedulers/heun#diffusers.HeunDiscreteScheduler">HeunDiscreteScheduler</a>) — | |
| A scheduler to be used in combination with the <code>prior</code> model to generate image embedding.`,name:"scheduler"},{anchor:"diffusers.ShapEPipeline.shap_e_renderer",description:`<strong>shap_e_renderer</strong> (<code>ShapERenderer</code>) — | |
| Shap-E renderer projects the generated latents into parameters of a MLP to create 3D objects with the NeRF | |
| rendering method.`,name:"shap_e_renderer"}],source:"https://github.com/huggingface/diffusers/blob/vr_13771/src/diffusers/pipelines/shap_e/pipeline_shap_e.py#L87"}}),fe=new We({props:{name:"__call__",anchor:"diffusers.ShapEPipeline.__call__",parameters:[{name:"prompt",val:": str"},{name:"num_images_per_prompt",val:": int = 1"},{name:"num_inference_steps",val:": int = 25"},{name:"generator",val:": torch._C.Generator | list[torch._C.Generator] | None = None"},{name:"latents",val:": torch.Tensor | None = None"},{name:"guidance_scale",val:": float = 4.0"},{name:"frame_size",val:": int = 64"},{name:"output_type",val:": str | None = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.ShapEPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>list[str]</code>) — | |
| The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.ShapEPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.ShapEPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 25) — | |
| The number of denoising steps. More denoising steps usually lead to a higher quality image at the | |
| expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.ShapEPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>list[torch.Generator]</code>, <em>optional</em>) — | |
| A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make | |
| generation deterministic.`,name:"generator"},{anchor:"diffusers.ShapEPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image | |
| generation. Can be used to tweak the same generation with different prompts. If not provided, a latents | |
| tensor is generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.ShapEPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) — | |
| A higher guidance scale value encourages the model to generate images closely linked to the text | |
| <code>prompt</code> at the expense of lower image quality. Guidance scale is enabled when <code>guidance_scale > 1</code>.`,name:"guidance_scale"},{anchor:"diffusers.ShapEPipeline.__call__.frame_size",description:`<strong>frame_size</strong> (<code>int</code>, <em>optional</em>, default to 64) — | |
| The width and height of each image frame of the generated 3D output.`,name:"frame_size"},{anchor:"diffusers.ShapEPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"pil"</code>) — | |
| The output format of the generated image. Choose between <code>"pil"</code> (<code>PIL.Image.Image</code>), <code>"np"</code> | |
| (<code>np.array</code>), <code>"latent"</code> (<code>torch.Tensor</code>), or mesh (<code>MeshDecoderOutput</code>).`,name:"output_type"},{anchor:"diffusers.ShapEPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to return a <a href="/docs/diffusers/pr_13771/en/api/pipelines/shap_e#diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput">ShapEPipelineOutput</a> instead of a plain | |
| tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_13771/src/diffusers/pipelines/shap_e/pipeline_shap_e.py#L190",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If <code>return_dict</code> is <code>True</code>, <a | |
| href="/docs/diffusers/pr_13771/en/api/pipelines/shap_e#diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput" | |
| >ShapEPipelineOutput</a> is returned, | |
| otherwise a <code>tuple</code> is returned where the first element is a list with the generated images.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/diffusers/pr_13771/en/api/pipelines/shap_e#diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput" | |
| >ShapEPipelineOutput</a> or <code>tuple</code></p> | |
| `}}),P=new ps({props:{anchor:"diffusers.ShapEPipeline.__call__.example",$$slots:{default:[gs]},$$scope:{ctx:Te}}}),ge=new je({props:{title:"ShapEImg2ImgPipeline",local:"diffusers.ShapEImg2ImgPipeline",headingTag:"h2"}}),_e=new We({props:{name:"class diffusers.ShapEImg2ImgPipeline",anchor:"diffusers.ShapEImg2ImgPipeline",parameters:[{name:"prior",val:": PriorTransformer"},{name:"image_encoder",val:": CLIPVisionModel"},{name:"image_processor",val:": CLIPImageProcessor"},{name:"scheduler",val:": HeunDiscreteScheduler"},{name:"shap_e_renderer",val:": ShapERenderer"}],parametersDescription:[{anchor:"diffusers.ShapEImg2ImgPipeline.prior",description:`<strong>prior</strong> (<a href="/docs/diffusers/pr_13771/en/api/models/prior_transformer#diffusers.PriorTransformer">PriorTransformer</a>) — | |
| The canonical unCLIP prior to approximate the image embedding from the text embedding.`,name:"prior"},{anchor:"diffusers.ShapEImg2ImgPipeline.image_encoder",description:`<strong>image_encoder</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPVisionModel" rel="nofollow">CLIPVisionModel</a>) — | |
| Frozen image-encoder.`,name:"image_encoder"},{anchor:"diffusers.ShapEImg2ImgPipeline.image_processor",description:`<strong>image_processor</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPImageProcessor" rel="nofollow">CLIPImageProcessor</a>) — | |
| A <code>CLIPImageProcessor</code> to process images.`,name:"image_processor"},{anchor:"diffusers.ShapEImg2ImgPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_13771/en/api/schedulers/heun#diffusers.HeunDiscreteScheduler">HeunDiscreteScheduler</a>) — | |
| A scheduler to be used in combination with the <code>prior</code> model to generate image embedding.`,name:"scheduler"},{anchor:"diffusers.ShapEImg2ImgPipeline.shap_e_renderer",description:`<strong>shap_e_renderer</strong> (<code>ShapERenderer</code>) — | |
| Shap-E renderer projects the generated latents into parameters of a MLP to create 3D objects with the NeRF | |
| rendering method.`,name:"shap_e_renderer"}],source:"https://github.com/huggingface/diffusers/blob/vr_13771/src/diffusers/pipelines/shap_e/pipeline_shap_e_img2img.py#L88"}}),ye=new We({props:{name:"__call__",anchor:"diffusers.ShapEImg2ImgPipeline.__call__",parameters:[{name:"image",val:": PIL.Image.Image | list[PIL.Image.Image]"},{name:"num_images_per_prompt",val:": int = 1"},{name:"num_inference_steps",val:": int = 25"},{name:"generator",val:": torch._C.Generator | list[torch._C.Generator] | None = None"},{name:"latents",val:": torch.Tensor | None = None"},{name:"guidance_scale",val:": float = 4.0"},{name:"frame_size",val:": int = 64"},{name:"output_type",val:": str | None = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.ShapEImg2ImgPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.Tensor</code>, <code>PIL.Image.Image</code>, <code>np.ndarray</code>, <code>list[torch.Tensor]</code>, <code>list[PIL.Image.Image]</code>, or <code>list[np.ndarray]</code>) — | |
| <code>Image</code> or tensor representing an image batch to be used as the starting point. Can also accept image | |
| latents as image, but if passing latents directly it is not encoded again.`,name:"image"},{anchor:"diffusers.ShapEImg2ImgPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.ShapEImg2ImgPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 25) — | |
| The number of denoising steps. More denoising steps usually lead to a higher quality image at the | |
| expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.ShapEImg2ImgPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>list[torch.Generator]</code>, <em>optional</em>) — | |
| A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make | |
| generation deterministic.`,name:"generator"},{anchor:"diffusers.ShapEImg2ImgPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image | |
| generation. Can be used to tweak the same generation with different prompts. If not provided, a latents | |
| tensor is generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.ShapEImg2ImgPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) — | |
| A higher guidance scale value encourages the model to generate images closely linked to the text | |
| <code>prompt</code> at the expense of lower image quality. Guidance scale is enabled when <code>guidance_scale > 1</code>.`,name:"guidance_scale"},{anchor:"diffusers.ShapEImg2ImgPipeline.__call__.frame_size",description:`<strong>frame_size</strong> (<code>int</code>, <em>optional</em>, default to 64) — | |
| The width and height of each image frame of the generated 3D output.`,name:"frame_size"},{anchor:"diffusers.ShapEImg2ImgPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"pil"</code>) — | |
| The output format of the generated image. Choose between <code>"pil"</code> (<code>PIL.Image.Image</code>), <code>"np"</code> | |
| (<code>np.array</code>), <code>"latent"</code> (<code>torch.Tensor</code>), or mesh (<code>MeshDecoderOutput</code>).`,name:"output_type"},{anchor:"diffusers.ShapEImg2ImgPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to return a <a href="/docs/diffusers/pr_13771/en/api/pipelines/shap_e#diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput">ShapEPipelineOutput</a> instead of a plain | |
| tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/vr_13771/src/diffusers/pipelines/shap_e/pipeline_shap_e_img2img.py#L172",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If <code>return_dict</code> is <code>True</code>, <a | |
| href="/docs/diffusers/pr_13771/en/api/pipelines/shap_e#diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput" | |
| >ShapEPipelineOutput</a> is returned, | |
| otherwise a <code>tuple</code> is returned where the first element is a list with the generated images.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/diffusers/pr_13771/en/api/pipelines/shap_e#diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput" | |
| >ShapEPipelineOutput</a> or <code>tuple</code></p> | |
| `}}),B=new ps({props:{anchor:"diffusers.ShapEImg2ImgPipeline.__call__.example",$$slots:{default:[_s]},$$scope:{ctx:Te}}}),Me=new je({props:{title:"ShapEPipelineOutput",local:"diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput",headingTag:"h2"}}),we=new We({props:{name:"class diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput",anchor:"diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput",parameters:[{name:"images",val:": list[list[PIL.Image.Image]] | list[list[numpy.ndarray]]"}],parametersDescription:[{anchor:"diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput.images",description:`<strong>images</strong> (<code>torch.Tensor</code>) — | |
| A list of images for 3D rendering.`,name:"images"}],source:"https://github.com/huggingface/diffusers/blob/vr_13771/src/diffusers/pipelines/shap_e/pipeline_shap_e.py#L75"}}),be=new fs({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/shap_e.md"}}),{c(){g=i("meta"),Z=n(),w=i("p"),y=n(),c(M.$$.fragment),r=n(),c(b.$$.fragment),Ge=n(),X=i("p"),X.innerHTML=Wt,ke=n(),V=i("p"),V.textContent=Gt,Pe=n(),z=i("p"),z.innerHTML=kt,Be=n(),q=i("p"),q.innerHTML=Pt,Re=n(),x=i("blockquote"),x.innerHTML=Bt,Xe=n(),N=i("p"),N.textContent=Rt,Ve=n(),c(Y.$$.fragment),ze=n(),c(L.$$.fragment),qe=n(),F=i("p"),F.innerHTML=Xt,Ne=n(),c(Q.$$.fragment),Ye=n(),H=i("p"),H.innerHTML=Vt,Le=n(),c(D.$$.fragment),Fe=n(),S=i("div"),S.innerHTML=zt,Qe=n(),c(A.$$.fragment),He=n(),K=i("p"),K.innerHTML=qt,De=n(),c(O.$$.fragment),Ae=n(),ee=i("p"),ee.innerHTML=Nt,Ke=n(),c(te.$$.fragment),Oe=n(),W=i("div"),W.innerHTML=Yt,et=n(),c(se.$$.fragment),tt=n(),ae=i("p"),ae.innerHTML=Lt,st=n(),ne=i("p"),ne.innerHTML=Ft,at=n(),c(le.$$.fragment),nt=n(),ie=i("p"),ie.innerHTML=Qt,lt=n(),G=i("blockquote"),G.innerHTML=Ht,it=n(),c(pe.$$.fragment),pt=n(),re=i("p"),re.innerHTML=Dt,rt=n(),c(oe.$$.fragment),ot=n(),ce=i("p"),ce.textContent=At,ct=n(),c(me.$$.fragment),mt=n(),de=i("p"),de.textContent=Kt,dt=n(),k=i("div"),k.innerHTML=Ot,ht=n(),c(he.$$.fragment),ut=n(),J=i("div"),c(ue.$$.fragment),jt=n(),Ue=i("p"),Ue.textContent=es,Tt=n(),Ie=i("p"),Ie.innerHTML=ts,Ut=n(),v=i("div"),c(fe.$$.fragment),It=n(),Ze=i("p"),Ze.textContent=ss,Zt=n(),c(P.$$.fragment),ft=n(),c(ge.$$.fragment),gt=n(),j=i("div"),c(_e.$$.fragment),vt=n(),ve=i("p"),ve.textContent=as,Ct=n(),Ce=i("p"),Ce.innerHTML=ns,Et=n(),C=i("div"),c(ye.$$.fragment),$t=n(),Ee=i("p"),Ee.textContent=ls,xt=n(),c(B.$$.fragment),_t=n(),c(Me.$$.fragment),yt=n(),E=i("div"),c(we.$$.fragment),St=n(),$e=i("p"),$e.innerHTML=is,Mt=n(),c(be.$$.fragment),wt=n(),Se=i("p"),this.h()},l(e){const t=hs("svelte-u9bgzb",document.head);g=p(t,"META",{name:!0,content:!0}),t.forEach(s),Z=l(e),w=p(e,"P",{}),Je(w).forEach(s),y=l(e),m(M.$$.fragment,e),r=l(e),m(b.$$.fragment,e),Ge=l(e),X=p(e,"P",{"data-svelte-h":!0}),o(X)!=="svelte-hlst0d"&&(X.innerHTML=Wt),ke=l(e),V=p(e,"P",{"data-svelte-h":!0}),o(V)!=="svelte-1cwsb16"&&(V.textContent=Gt),Pe=l(e),z=p(e,"P",{"data-svelte-h":!0}),o(z)!=="svelte-x8b1j2"&&(z.innerHTML=kt),Be=l(e),q=p(e,"P",{"data-svelte-h":!0}),o(q)!=="svelte-1ctozyl"&&(q.innerHTML=Pt),Re=l(e),x=p(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),o(x)!=="svelte-9date2"&&(x.innerHTML=Bt),Xe=l(e),N=p(e,"P",{"data-svelte-h":!0}),o(N)!=="svelte-13abajr"&&(N.textContent=Rt),Ve=l(e),m(Y.$$.fragment,e),ze=l(e),m(L.$$.fragment,e),qe=l(e),F=p(e,"P",{"data-svelte-h":!0}),o(F)!=="svelte-90nwog"&&(F.innerHTML=Xt),Ne=l(e),m(Q.$$.fragment,e),Ye=l(e),H=p(e,"P",{"data-svelte-h":!0}),o(H)!=="svelte-1ywcfjl"&&(H.innerHTML=Vt),Le=l(e),m(D.$$.fragment,e),Fe=l(e),S=p(e,"DIV",{class:!0,"data-svelte-h":!0}),o(S)!=="svelte-1lcwzvo"&&(S.innerHTML=zt),Qe=l(e),m(A.$$.fragment,e),He=l(e),K=p(e,"P",{"data-svelte-h":!0}),o(K)!=="svelte-1v1zpbo"&&(K.innerHTML=qt),De=l(e),m(O.$$.fragment,e),Ae=l(e),ee=p(e,"P",{"data-svelte-h":!0}),o(ee)!=="svelte-asnakr"&&(ee.innerHTML=Nt),Ke=l(e),m(te.$$.fragment,e),Oe=l(e),W=p(e,"DIV",{class:!0,"data-svelte-h":!0}),o(W)!=="svelte-xd6lpk"&&(W.innerHTML=Yt),et=l(e),m(se.$$.fragment,e),tt=l(e),ae=p(e,"P",{"data-svelte-h":!0}),o(ae)!=="svelte-b3two7"&&(ae.innerHTML=Lt),st=l(e),ne=p(e,"P",{"data-svelte-h":!0}),o(ne)!=="svelte-12ne9ue"&&(ne.innerHTML=Ft),at=l(e),m(le.$$.fragment,e),nt=l(e),ie=p(e,"P",{"data-svelte-h":!0}),o(ie)!=="svelte-1c35t88"&&(ie.innerHTML=Qt),lt=l(e),G=p(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),o(G)!=="svelte-2yfe2x"&&(G.innerHTML=Ht),it=l(e),m(pe.$$.fragment,e),pt=l(e),re=p(e,"P",{"data-svelte-h":!0}),o(re)!=="svelte-15r1kyy"&&(re.innerHTML=Dt),rt=l(e),m(oe.$$.fragment,e),ot=l(e),ce=p(e,"P",{"data-svelte-h":!0}),o(ce)!=="svelte-14frru"&&(ce.textContent=At),ct=l(e),m(me.$$.fragment,e),mt=l(e),de=p(e,"P",{"data-svelte-h":!0}),o(de)!=="svelte-1dqio5f"&&(de.textContent=Kt),dt=l(e),k=p(e,"DIV",{class:!0,"data-svelte-h":!0}),o(k)!=="svelte-1dmju3n"&&(k.innerHTML=Ot),ht=l(e),m(he.$$.fragment,e),ut=l(e),J=p(e,"DIV",{class:!0});var U=Je(J);m(ue.$$.fragment,U),jt=l(U),Ue=p(U,"P",{"data-svelte-h":!0}),o(Ue)!=="svelte-13hoayd"&&(Ue.textContent=es),Tt=l(U),Ie=p(U,"P",{"data-svelte-h":!0}),o(Ie)!=="svelte-mfo02z"&&(Ie.innerHTML=ts),Ut=l(U),v=p(U,"DIV",{class:!0});var $=Je(v);m(fe.$$.fragment,$),It=l($),Ze=p($,"P",{"data-svelte-h":!0}),o(Ze)!=="svelte-50j04k"&&(Ze.textContent=ss),Zt=l($),m(P.$$.fragment,$),$.forEach(s),U.forEach(s),ft=l(e),m(ge.$$.fragment,e),gt=l(e),j=p(e,"DIV",{class:!0});var R=Je(j);m(_e.$$.fragment,R),vt=l(R),ve=p(R,"P",{"data-svelte-h":!0}),o(ve)!=="svelte-16fhar3"&&(ve.textContent=as),Ct=l(R),Ce=p(R,"P",{"data-svelte-h":!0}),o(Ce)!=="svelte-mfo02z"&&(Ce.innerHTML=ns),Et=l(R),C=p(R,"DIV",{class:!0});var xe=Je(C);m(ye.$$.fragment,xe),$t=l(xe),Ee=p(xe,"P",{"data-svelte-h":!0}),o(Ee)!=="svelte-50j04k"&&(Ee.textContent=ls),xt=l(xe),m(B.$$.fragment,xe),xe.forEach(s),R.forEach(s),_t=l(e),m(Me.$$.fragment,e),yt=l(e),E=p(e,"DIV",{class:!0});var Jt=Je(E);m(we.$$.fragment,Jt),St=l(Jt),$e=p(Jt,"P",{"data-svelte-h":!0}),o($e)!=="svelte-1xtyy4l"&&($e.innerHTML=is),Jt.forEach(s),Mt=l(e),m(be.$$.fragment,e),wt=l(e),Se=p(e,"P",{}),Je(Se).forEach(s),this.h()},h(){T(g,"name","hf:doc:metadata"),T(g,"content",Ms),T(x,"class","tip"),T(S,"class","flex gap-4"),T(W,"class","flex gap-4"),T(G,"class","tip"),T(k,"class","flex justify-center"),T(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),T(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){_(document.head,g),a(e,Z,t),a(e,w,t),a(e,y,t),d(M,e,t),a(e,r,t),d(b,e,t),a(e,Ge,t),a(e,X,t),a(e,ke,t),a(e,V,t),a(e,Pe,t),a(e,z,t),a(e,Be,t),a(e,q,t),a(e,Re,t),a(e,x,t),a(e,Xe,t),a(e,N,t),a(e,Ve,t),d(Y,e,t),a(e,ze,t),d(L,e,t),a(e,qe,t),a(e,F,t),a(e,Ne,t),d(Q,e,t),a(e,Ye,t),a(e,H,t),a(e,Le,t),d(D,e,t),a(e,Fe,t),a(e,S,t),a(e,Qe,t),d(A,e,t),a(e,He,t),a(e,K,t),a(e,De,t),d(O,e,t),a(e,Ae,t),a(e,ee,t),a(e,Ke,t),d(te,e,t),a(e,Oe,t),a(e,W,t),a(e,et,t),d(se,e,t),a(e,tt,t),a(e,ae,t),a(e,st,t),a(e,ne,t),a(e,at,t),d(le,e,t),a(e,nt,t),a(e,ie,t),a(e,lt,t),a(e,G,t),a(e,it,t),d(pe,e,t),a(e,pt,t),a(e,re,t),a(e,rt,t),d(oe,e,t),a(e,ot,t),a(e,ce,t),a(e,ct,t),d(me,e,t),a(e,mt,t),a(e,de,t),a(e,dt,t),a(e,k,t),a(e,ht,t),d(he,e,t),a(e,ut,t),a(e,J,t),d(ue,J,null),_(J,jt),_(J,Ue),_(J,Tt),_(J,Ie),_(J,Ut),_(J,v),d(fe,v,null),_(v,It),_(v,Ze),_(v,Zt),d(P,v,null),a(e,ft,t),d(ge,e,t),a(e,gt,t),a(e,j,t),d(_e,j,null),_(j,vt),_(j,ve),_(j,Ct),_(j,Ce),_(j,Et),_(j,C),d(ye,C,null),_(C,$t),_(C,Ee),_(C,xt),d(B,C,null),a(e,_t,t),d(Me,e,t),a(e,yt,t),a(e,E,t),d(we,E,null),_(E,St),_(E,$e),a(e,Mt,t),d(be,e,t),a(e,wt,t),a(e,Se,t),bt=!0},p(e,[t]){const U={};t&2&&(U.$$scope={dirty:t,ctx:e}),P.$set(U);const $={};t&2&&($.$$scope={dirty:t,ctx:e}),B.$set($)},i(e){bt||(h(M.$$.fragment,e),h(b.$$.fragment,e),h(Y.$$.fragment,e),h(L.$$.fragment,e),h(Q.$$.fragment,e),h(D.$$.fragment,e),h(A.$$.fragment,e),h(O.$$.fragment,e),h(te.$$.fragment,e),h(se.$$.fragment,e),h(le.$$.fragment,e),h(pe.$$.fragment,e),h(oe.$$.fragment,e),h(me.$$.fragment,e),h(he.$$.fragment,e),h(ue.$$.fragment,e),h(fe.$$.fragment,e),h(P.$$.fragment,e),h(ge.$$.fragment,e),h(_e.$$.fragment,e),h(ye.$$.fragment,e),h(B.$$.fragment,e),h(Me.$$.fragment,e),h(we.$$.fragment,e),h(be.$$.fragment,e),bt=!0)},o(e){u(M.$$.fragment,e),u(b.$$.fragment,e),u(Y.$$.fragment,e),u(L.$$.fragment,e),u(Q.$$.fragment,e),u(D.$$.fragment,e),u(A.$$.fragment,e),u(O.$$.fragment,e),u(te.$$.fragment,e),u(se.$$.fragment,e),u(le.$$.fragment,e),u(pe.$$.fragment,e),u(oe.$$.fragment,e),u(me.$$.fragment,e),u(he.$$.fragment,e),u(ue.$$.fragment,e),u(fe.$$.fragment,e),u(P.$$.fragment,e),u(ge.$$.fragment,e),u(_e.$$.fragment,e),u(ye.$$.fragment,e),u(B.$$.fragment,e),u(Me.$$.fragment,e),u(we.$$.fragment,e),u(be.$$.fragment,e),bt=!1},d(e){e&&(s(Z),s(w),s(y),s(r),s(Ge),s(X),s(ke),s(V),s(Pe),s(z),s(Be),s(q),s(Re),s(x),s(Xe),s(N),s(Ve),s(ze),s(qe),s(F),s(Ne),s(Ye),s(H),s(Le),s(Fe),s(S),s(Qe),s(He),s(K),s(De),s(Ae),s(ee),s(Ke),s(Oe),s(W),s(et),s(tt),s(ae),s(st),s(ne),s(at),s(nt),s(ie),s(lt),s(G),s(it),s(pt),s(re),s(rt),s(ot),s(ce),s(ct),s(mt),s(de),s(dt),s(k),s(ht),s(ut),s(J),s(ft),s(gt),s(j),s(_t),s(yt),s(E),s(Mt),s(wt),s(Se)),s(g),f(M,e),f(b,e),f(Y,e),f(L,e),f(Q,e),f(D,e),f(A,e),f(O,e),f(te,e),f(se,e),f(le,e),f(pe,e),f(oe,e),f(me,e),f(he,e),f(ue),f(fe),f(P),f(ge,e),f(_e),f(ye),f(B),f(Me,e),f(we),f(be,e)}}}const Ms='{"title":"Shap-E","local":"shap-e","sections":[{"title":"Text-to-3D","local":"text-to-3d","sections":[],"depth":2},{"title":"Image-to-3D","local":"image-to-3d","sections":[],"depth":2},{"title":"Generate mesh","local":"generate-mesh","sections":[],"depth":2},{"title":"ShapEPipeline","local":"diffusers.ShapEPipeline","sections":[],"depth":2},{"title":"ShapEImg2ImgPipeline","local":"diffusers.ShapEImg2ImgPipeline","sections":[],"depth":2},{"title":"ShapEPipelineOutput","local":"diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput","sections":[],"depth":2}],"depth":1}';function ws(Te){return cs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class vs extends ms{constructor(g){super(),ds(this,g,ws,ys,os,{})}}export{vs as component}; | |
Xet Storage Details
- Size:
- 49.7 kB
- Xet hash:
- a228242fd5a864c791e2bae90a9794d2ae9028b3b8a0bf3c5281b375207fda2b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.