Buckets:

rtrm's picture
download
raw
30.4 kB
import{s as He,o as Ne,n as Ye}from"../chunks/scheduler.53228c21.js";import{S as Qe,i as Oe,e as p,s as r,c as f,h as Ae,a as l,d as n,b as i,f as H,g as u,j as w,k as Z,l as c,m as a,n as _,t as y,o as M,p as b}from"../chunks/index.100fac89.js";import{C as Ke}from"../chunks/CopyLLMTxtMenu.969c168d.js";import{D as re}from"../chunks/Docstring.8eea0d47.js";import{C as Fe}from"../chunks/CodeBlock.d30a6509.js";import{E as Xe}from"../chunks/ExampleCodeBlock.5e9b5749.js";import{H as we,E as et}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.92f39b94.js";function tt(N){let o,$="Examples:",h,d,m;return d=new Fe({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX2dpZiUwQSUwQWRldmljZSUyMCUzRCUyMHRvcmNoLmRldmljZSglMjJjdWRhJTIyJTIwaWYlMjB0b3JjaC5jdWRhLmlzX2F2YWlsYWJsZSgpJTIwZWxzZSUyMCUyMmNwdSUyMiklMEElMEFyZXBvJTIwJTNEJTIwJTIyb3BlbmFpJTJGc2hhcC1lJTIyJTBBcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChyZXBvJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKGRldmljZSklMEElMEFndWlkYW5jZV9zY2FsZSUyMCUzRCUyMDE1LjAlMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwc2hhcmslMjIlMEElMEFpbWFnZXMlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNEZ3VpZGFuY2Vfc2NhbGUlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENjQlMkMlMEElMjAlMjAlMjAlMjBmcmFtZV9zaXplJTNEMjU2JTJDJTBBKS5pbWFnZXMlMEElMEFnaWZfcGF0aCUyMCUzRCUyMGV4cG9ydF90b19naWYoaW1hZ2VzJTVCMCU1RCUyQyUyMCUyMnNoYXJrXzNkLmdpZiUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_gif
<span class="hljs-meta">&gt;&gt;&gt; </span>device = torch.device(<span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>repo = <span class="hljs-string">&quot;openai/shap-e&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = DiffusionPipeline.from_pretrained(repo, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span>guidance_scale = <span class="hljs-number">15.0</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;a shark&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span>gif_path = export_to_gif(images[<span class="hljs-number">0</span>], <span class="hljs-string">&quot;shark_3d.gif&quot;</span>)`,wrap:!1}}),{c(){o=p("p"),o.textContent=$,h=r(),f(d.$$.fragment)},l(s){o=l(s,"P",{"data-svelte-h":!0}),w(o)!=="svelte-kvfsh7"&&(o.textContent=$),h=i(s),u(d.$$.fragment,s)},m(s,g){a(s,o,g),a(s,h,g),_(d,s,g),m=!0},p:Ye,i(s){m||(y(d.$$.fragment,s),m=!0)},o(s){M(d.$$.fragment,s),m=!1},d(s){s&&(n(o),n(h)),b(d,s)}}}function nt(N){let o,$="Examples:",h,d,m;return d=new Fe({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX2dpZiUyQyUyMGxvYWRfaW1hZ2UlMEElMEFkZXZpY2UlMjAlM0QlMjB0b3JjaC5kZXZpY2UoJTIyY3VkYSUyMiUyMGlmJTIwdG9yY2guY3VkYS5pc19hdmFpbGFibGUoKSUyMGVsc2UlMjAlMjJjcHUlMjIpJTBBJTBBcmVwbyUyMCUzRCUyMCUyMm9wZW5haSUyRnNoYXAtZS1pbWcyaW1nJTIyJTBBcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChyZXBvJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKGRldmljZSklMEElMEFndWlkYW5jZV9zY2FsZSUyMCUzRCUyMDMuMCUwQWltYWdlX3VybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGaGYuY28lMkZkYXRhc2V0cyUyRmRpZmZ1c2VycyUyRmRvY3MtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZzaGFwLWUlMkZjb3JnaS5wbmclMjIlMEFpbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UoaW1hZ2VfdXJsKS5jb252ZXJ0KCUyMlJHQiUyMiklMEElMEFpbWFnZXMlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMGltYWdlJTJDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0RndWlkYW5jZV9zY2FsZSUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q2NCUyQyUwQSUyMCUyMCUyMCUyMGZyYW1lX3NpemUlM0QyNTYlMkMlMEEpLmltYWdlcyUwQSUwQWdpZl9wYXRoJTIwJTNEJTIwZXhwb3J0X3RvX2dpZihpbWFnZXMlNUIwJTVEJTJDJTIwJTIyY29yZ2lfM2QuZ2lmJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_gif, load_image
<span class="hljs-meta">&gt;&gt;&gt; </span>device = torch.device(<span class="hljs-string">&quot;cuda&quot;</span> <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> <span class="hljs-string">&quot;cpu&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>repo = <span class="hljs-string">&quot;openai/shap-e-img2img&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = DiffusionPipeline.from_pretrained(repo, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = pipe.to(device)
<span class="hljs-meta">&gt;&gt;&gt; </span>guidance_scale = <span class="hljs-number">3.0</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_url = <span class="hljs-string">&quot;https://hf.co/datasets/diffusers/docs-images/resolve/main/shap-e/corgi.png&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = load_image(image_url).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span>gif_path = export_to_gif(images[<span class="hljs-number">0</span>], <span class="hljs-string">&quot;corgi_3d.gif&quot;</span>)`,wrap:!1}}),{c(){o=p("p"),o.textContent=$,h=r(),f(d.$$.fragment)},l(s){o=l(s,"P",{"data-svelte-h":!0}),w(o)!=="svelte-kvfsh7"&&(o.textContent=$),h=i(s),u(d.$$.fragment,s)},m(s,g){a(s,o,g),a(s,h,g),_(d,s,g),m=!0},p:Ye,i(s){m||(y(d.$$.fragment,s),m=!0)},o(s){M(d.$$.fragment,s),m=!1},d(s){s&&(n(o),n(h)),b(d,s)}}}function st(N){let o,$,h,d,m,s,g,ie,L,Je='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>.',oe,k,Ze="The abstract from the paper is:",pe,G,Le="<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>",le,W,ke='The original codebase can be found at <a href="https://github.com/openai/shap-e" rel="nofollow">openai/shap-e</a>.',ce,S,Ge='<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>',de,z,me,E,R,Ee,Q,We="Pipeline for generating latent representation of a 3D asset and rendering with the NeRF method.",Ie,O,ze=`This model inherits from <a href="/docs/diffusers/pr_12762/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.).`,Pe,T,D,$e,A,Re="The call function to the pipeline for generation.",Te,C,he,q,ge,I,B,ve,K,De="Pipeline for generating latent representation of a 3D asset and rendering with the NeRF method from an image.",je,ee,qe=`This model inherits from <a href="/docs/diffusers/pr_12762/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.).`,xe,v,V,Se,te,Be="The call function to the pipeline for generation.",Ce,U,fe,X,ue,j,Y,Ue,ne,Ve='Output class for <a href="/docs/diffusers/pr_12762/en/api/pipelines/shap_e#diffusers.ShapEPipeline">ShapEPipeline</a> and <a href="/docs/diffusers/pr_12762/en/api/pipelines/shap_e#diffusers.ShapEImg2ImgPipeline">ShapEImg2ImgPipeline</a>.',_e,F,ye,ae,Me;return m=new Ke({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),g=new we({props:{title:"Shap-E",local:"shap-e",headingTag:"h1"}}),z=new we({props:{title:"ShapEPipeline",local:"diffusers.ShapEPipeline",headingTag:"h2"}}),R=new re({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_12762/en/api/models/prior_transformer#diffusers.PriorTransformer">PriorTransformer</a>) &#x2014;
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>) &#x2014;
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>) &#x2014;
A <code>CLIPTokenizer</code> to tokenize text.`,name:"tokenizer"},{anchor:"diffusers.ShapEPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_12762/en/api/schedulers/heun#diffusers.HeunDiscreteScheduler">HeunDiscreteScheduler</a>) &#x2014;
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>) &#x2014;
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_12762/src/diffusers/pipelines/shap_e/pipeline_shap_e.py#L88"}}),D=new re({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:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"},{name:"guidance_scale",val:": float = 4.0"},{name:"frame_size",val:": int = 64"},{name:"output_type",val:": typing.Optional[str] = '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>) &#x2014;
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) &#x2014;
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) &#x2014;
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>) &#x2014;
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>) &#x2014;
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) &#x2014;
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 &gt; 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) &#x2014;
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>&quot;pil&quot;</code>) &#x2014;
The output format of the generated image. Choose between <code>&quot;pil&quot;</code> (<code>PIL.Image.Image</code>), <code>&quot;np&quot;</code>
(<code>np.array</code>), <code>&quot;latent&quot;</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>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/pr_12762/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_12762/src/diffusers/pipelines/shap_e/pipeline_shap_e.py#L191",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>If <code>return_dict</code> is <code>True</code>, <a
href="/docs/diffusers/pr_12762/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_12762/en/api/pipelines/shap_e#diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput"
>ShapEPipelineOutput</a> or <code>tuple</code></p>
`}}),C=new Xe({props:{anchor:"diffusers.ShapEPipeline.__call__.example",$$slots:{default:[tt]},$$scope:{ctx:N}}}),q=new we({props:{title:"ShapEImg2ImgPipeline",local:"diffusers.ShapEImg2ImgPipeline",headingTag:"h2"}}),B=new re({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_12762/en/api/models/prior_transformer#diffusers.PriorTransformer">PriorTransformer</a>) &#x2014;
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>) &#x2014;
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>) &#x2014;
A <code>CLIPImageProcessor</code> to process images.`,name:"image_processor"},{anchor:"diffusers.ShapEImg2ImgPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_12762/en/api/schedulers/heun#diffusers.HeunDiscreteScheduler">HeunDiscreteScheduler</a>) &#x2014;
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>) &#x2014;
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_12762/src/diffusers/pipelines/shap_e/pipeline_shap_e_img2img.py#L89"}}),V=new re({props:{name:"__call__",anchor:"diffusers.ShapEImg2ImgPipeline.__call__",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, typing.List[PIL.Image.Image]]"},{name:"num_images_per_prompt",val:": int = 1"},{name:"num_inference_steps",val:": int = 25"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"},{name:"guidance_scale",val:": float = 4.0"},{name:"frame_size",val:": int = 64"},{name:"output_type",val:": typing.Optional[str] = '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>) &#x2014;
<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) &#x2014;
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) &#x2014;
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>) &#x2014;
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>) &#x2014;
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) &#x2014;
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 &gt; 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) &#x2014;
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>&quot;pil&quot;</code>) &#x2014;
The output format of the generated image. Choose between <code>&quot;pil&quot;</code> (<code>PIL.Image.Image</code>), <code>&quot;np&quot;</code>
(<code>np.array</code>), <code>&quot;latent&quot;</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>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/pr_12762/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_12762/src/diffusers/pipelines/shap_e/pipeline_shap_e_img2img.py#L173",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>
<p>If <code>return_dict</code> is <code>True</code>, <a
href="/docs/diffusers/pr_12762/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_12762/en/api/pipelines/shap_e#diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput"
>ShapEPipelineOutput</a> or <code>tuple</code></p>
`}}),U=new Xe({props:{anchor:"diffusers.ShapEImg2ImgPipeline.__call__.example",$$slots:{default:[nt]},$$scope:{ctx:N}}}),X=new we({props:{title:"ShapEPipelineOutput",local:"diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput",headingTag:"h2"}}),Y=new re({props:{name:"class diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput",anchor:"diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput",parameters:[{name:"images",val:": typing.Union[typing.List[typing.List[PIL.Image.Image]], typing.List[typing.List[numpy.ndarray]]]"}],parametersDescription:[{anchor:"diffusers.pipelines.shap_e.pipeline_shap_e.ShapEPipelineOutput.images",description:`<strong>images</strong> (<code>torch.Tensor</code>) &#x2014;
A list of images for 3D rendering.`,name:"images"}],source:"https://github.com/huggingface/diffusers/blob/vr_12762/src/diffusers/pipelines/shap_e/pipeline_shap_e.py#L76"}}),F=new et({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/shap_e.md"}}),{c(){o=p("meta"),$=r(),h=p("p"),d=r(),f(m.$$.fragment),s=r(),f(g.$$.fragment),ie=r(),L=p("p"),L.innerHTML=Je,oe=r(),k=p("p"),k.textContent=Ze,pe=r(),G=p("p"),G.innerHTML=Le,le=r(),W=p("p"),W.innerHTML=ke,ce=r(),S=p("blockquote"),S.innerHTML=Ge,de=r(),f(z.$$.fragment),me=r(),E=p("div"),f(R.$$.fragment),Ee=r(),Q=p("p"),Q.textContent=We,Ie=r(),O=p("p"),O.innerHTML=ze,Pe=r(),T=p("div"),f(D.$$.fragment),$e=r(),A=p("p"),A.textContent=Re,Te=r(),f(C.$$.fragment),he=r(),f(q.$$.fragment),ge=r(),I=p("div"),f(B.$$.fragment),ve=r(),K=p("p"),K.textContent=De,je=r(),ee=p("p"),ee.innerHTML=qe,xe=r(),v=p("div"),f(V.$$.fragment),Se=r(),te=p("p"),te.textContent=Be,Ce=r(),f(U.$$.fragment),fe=r(),f(X.$$.fragment),ue=r(),j=p("div"),f(Y.$$.fragment),Ue=r(),ne=p("p"),ne.innerHTML=Ve,_e=r(),f(F.$$.fragment),ye=r(),ae=p("p"),this.h()},l(e){const t=Ae("svelte-u9bgzb",document.head);o=l(t,"META",{name:!0,content:!0}),t.forEach(n),$=i(e),h=l(e,"P",{}),H(h).forEach(n),d=i(e),u(m.$$.fragment,e),s=i(e),u(g.$$.fragment,e),ie=i(e),L=l(e,"P",{"data-svelte-h":!0}),w(L)!=="svelte-hlst0d"&&(L.innerHTML=Je),oe=i(e),k=l(e,"P",{"data-svelte-h":!0}),w(k)!=="svelte-1cwsb16"&&(k.textContent=Ze),pe=i(e),G=l(e,"P",{"data-svelte-h":!0}),w(G)!=="svelte-x8b1j2"&&(G.innerHTML=Le),le=i(e),W=l(e,"P",{"data-svelte-h":!0}),w(W)!=="svelte-1ctozyl"&&(W.innerHTML=ke),ce=i(e),S=l(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),w(S)!=="svelte-9date2"&&(S.innerHTML=Ge),de=i(e),u(z.$$.fragment,e),me=i(e),E=l(e,"DIV",{class:!0});var P=H(E);u(R.$$.fragment,P),Ee=i(P),Q=l(P,"P",{"data-svelte-h":!0}),w(Q)!=="svelte-13hoayd"&&(Q.textContent=We),Ie=i(P),O=l(P,"P",{"data-svelte-h":!0}),w(O)!=="svelte-dj6fbg"&&(O.innerHTML=ze),Pe=i(P),T=l(P,"DIV",{class:!0});var x=H(T);u(D.$$.fragment,x),$e=i(x),A=l(x,"P",{"data-svelte-h":!0}),w(A)!=="svelte-50j04k"&&(A.textContent=Re),Te=i(x),u(C.$$.fragment,x),x.forEach(n),P.forEach(n),he=i(e),u(q.$$.fragment,e),ge=i(e),I=l(e,"DIV",{class:!0});var J=H(I);u(B.$$.fragment,J),ve=i(J),K=l(J,"P",{"data-svelte-h":!0}),w(K)!=="svelte-16fhar3"&&(K.textContent=De),je=i(J),ee=l(J,"P",{"data-svelte-h":!0}),w(ee)!=="svelte-dj6fbg"&&(ee.innerHTML=qe),xe=i(J),v=l(J,"DIV",{class:!0});var se=H(v);u(V.$$.fragment,se),Se=i(se),te=l(se,"P",{"data-svelte-h":!0}),w(te)!=="svelte-50j04k"&&(te.textContent=Be),Ce=i(se),u(U.$$.fragment,se),se.forEach(n),J.forEach(n),fe=i(e),u(X.$$.fragment,e),ue=i(e),j=l(e,"DIV",{class:!0});var be=H(j);u(Y.$$.fragment,be),Ue=i(be),ne=l(be,"P",{"data-svelte-h":!0}),w(ne)!=="svelte-dolhp"&&(ne.innerHTML=Ve),be.forEach(n),_e=i(e),u(F.$$.fragment,e),ye=i(e),ae=l(e,"P",{}),H(ae).forEach(n),this.h()},h(){Z(o,"name","hf:doc:metadata"),Z(o,"content",at),Z(S,"class","tip"),Z(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),Z(j,"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){c(document.head,o),a(e,$,t),a(e,h,t),a(e,d,t),_(m,e,t),a(e,s,t),_(g,e,t),a(e,ie,t),a(e,L,t),a(e,oe,t),a(e,k,t),a(e,pe,t),a(e,G,t),a(e,le,t),a(e,W,t),a(e,ce,t),a(e,S,t),a(e,de,t),_(z,e,t),a(e,me,t),a(e,E,t),_(R,E,null),c(E,Ee),c(E,Q),c(E,Ie),c(E,O),c(E,Pe),c(E,T),_(D,T,null),c(T,$e),c(T,A),c(T,Te),_(C,T,null),a(e,he,t),_(q,e,t),a(e,ge,t),a(e,I,t),_(B,I,null),c(I,ve),c(I,K),c(I,je),c(I,ee),c(I,xe),c(I,v),_(V,v,null),c(v,Se),c(v,te),c(v,Ce),_(U,v,null),a(e,fe,t),_(X,e,t),a(e,ue,t),a(e,j,t),_(Y,j,null),c(j,Ue),c(j,ne),a(e,_e,t),_(F,e,t),a(e,ye,t),a(e,ae,t),Me=!0},p(e,[t]){const P={};t&2&&(P.$$scope={dirty:t,ctx:e}),C.$set(P);const x={};t&2&&(x.$$scope={dirty:t,ctx:e}),U.$set(x)},i(e){Me||(y(m.$$.fragment,e),y(g.$$.fragment,e),y(z.$$.fragment,e),y(R.$$.fragment,e),y(D.$$.fragment,e),y(C.$$.fragment,e),y(q.$$.fragment,e),y(B.$$.fragment,e),y(V.$$.fragment,e),y(U.$$.fragment,e),y(X.$$.fragment,e),y(Y.$$.fragment,e),y(F.$$.fragment,e),Me=!0)},o(e){M(m.$$.fragment,e),M(g.$$.fragment,e),M(z.$$.fragment,e),M(R.$$.fragment,e),M(D.$$.fragment,e),M(C.$$.fragment,e),M(q.$$.fragment,e),M(B.$$.fragment,e),M(V.$$.fragment,e),M(U.$$.fragment,e),M(X.$$.fragment,e),M(Y.$$.fragment,e),M(F.$$.fragment,e),Me=!1},d(e){e&&(n($),n(h),n(d),n(s),n(ie),n(L),n(oe),n(k),n(pe),n(G),n(le),n(W),n(ce),n(S),n(de),n(me),n(E),n(he),n(ge),n(I),n(fe),n(ue),n(j),n(_e),n(ye),n(ae)),n(o),b(m,e),b(g,e),b(z,e),b(R),b(D),b(C),b(q,e),b(B),b(V),b(U),b(X,e),b(Y),b(F,e)}}}const at='{"title":"Shap-E","local":"shap-e","sections":[{"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 rt(N){return Ne(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ht extends Qe{constructor(o){super(),Oe(this,o,rt,st,He,{})}}export{ht as component};

Xet Storage Details

Size:
30.4 kB
·
Xet hash:
536407fb392cabb3f4746eb36d1ce6a8015e3fc51b3c95e20d9a803c530e3f31

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.