import{s as de,o as pe,n as ue}from"../chunks/scheduler.8c3d61f6.js";import{S as fe,i as me,g as r,s as l,r as C,A as ce,h as u,f as n,c as o,j as Z,u as H,x as m,k as K,y as S,a,v as k,d as V,t as j,w as G}from"../chunks/index.da70eac4.js";import{T as oe}from"../chunks/Tip.1d9b8c37.js";import{D as he}from"../chunks/Docstring.36ab7a66.js";import{H as re,E as ge}from"../chunks/getInferenceSnippets.33773fa8.js";function $e(L){let i,p="🧪 This is an experimental pipeline for reinforcement learning!";return{c(){i=r("p"),i.textContent=p},l(s){i=u(s,"P",{"data-svelte-h":!0}),m(i)!=="svelte-13bwjls"&&(i.textContent=p)},m(s,c){a(s,i,c)},p:ue,d(s){s&&n(i)}}}function ve(L){let i,p='Make sure to check out the Schedulers <a href="../../using-diffusers/schedulers">guide</a> to learn how to explore the tradeoff between scheduler speed and quality, and 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.';return{c(){i=r("p"),i.innerHTML=p},l(s){i=u(s,"P",{"data-svelte-h":!0}),m(i)!=="svelte-1qn15hi"&&(i.innerHTML=p)},m(s,c){a(s,i,c)},p:ue,d(s){s&&n(i)}}}function be(L){let i,p,s,c,$,U,h,N,v,Q='This pipeline is based on the <a href="https://huggingface.co/papers/2205.09991" rel="nofollow">Planning with Diffusion for Flexible Behavior Synthesis</a> paper by Michael Janner, Yilun Du, Joshua B. Tenenbaum, Sergey Levine.',q,b,ee="The abstract from the paper is:",z,x,te="<em>Model-based reinforcement learning methods often use learning only for the purpose of estimating an approximate dynamics model, offloading the rest of the decision-making work to classical trajectory optimizers. While conceptually simple, this combination has a number of empirical shortcomings, suggesting that learned models may not be well-suited to standard trajectory optimization. In this paper, we consider what it would look like to fold as much of the trajectory optimization pipeline as possible into the modeling problem, such that sampling from the model and planning with it become nearly identical. The core of our technical approach lies in a diffusion probabilistic model that plans by iteratively denoising trajectories. We show how classifier-guided sampling and image inpainting can be reinterpreted as coherent planning strategies, explore the unusual and useful properties of diffusion-based planning methods, and demonstrate the effectiveness of our framework in control settings that emphasize long-horizon decision-making and test-time flexibility.</em>",A,_,ne='You can find additional information about the model on the <a href="https://diffusion-planning.github.io/" rel="nofollow">project page</a>, the <a href="https://github.com/jannerm/diffuser" rel="nofollow">original codebase</a>, or try it out in a demo <a href="https://colab.research.google.com/drive/1rXm8CX4ZdN5qivjJ2lhwhkOmt_m0CvU0#scrollTo=6HXJvhyqcITc&amp;uniqifier=1" rel="nofollow">notebook</a>.',E,w,ie='The script to run the model is available <a href="https://github.com/huggingface/diffusers/tree/main/examples/reinforcement_learning" rel="nofollow">here</a>.',I,g,J,P,O,d,M,W,y,ae="Pipeline for value-guided sampling from a diffusion model trained to predict sequences of states.",Y,D,se=`This model inherits from <a href="/docs/diffusers/main/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.).`,X,T,B,R,F;return $=new re({props:{title:"Value-guided planning",local:"value-guided-planning",headingTag:"h1"}}),h=new oe({props:{warning:!0,$$slots:{default:[$e]},$$scope:{ctx:L}}}),g=new oe({props:{$$slots:{default:[ve]},$$scope:{ctx:L}}}),P=new re({props:{title:"ValueGuidedRLPipeline",local:"diffusers.experimental.ValueGuidedRLPipeline",headingTag:"h2"}}),M=new he({props:{name:"class diffusers.experimental.ValueGuidedRLPipeline",anchor:"diffusers.experimental.ValueGuidedRLPipeline",parameters:[{name:"value_function",val:": UNet1DModel"},{name:"unet",val:": UNet1DModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"env",val:""}],parametersDescription:[{anchor:"diffusers.experimental.ValueGuidedRLPipeline.value_function",description:`<strong>value_function</strong> (<a href="/docs/diffusers/main/en/api/models/unet#diffusers.UNet1DModel">UNet1DModel</a>) &#x2014;
A specialized UNet for fine-tuning trajectories base on reward.`,name:"value_function"},{anchor:"diffusers.experimental.ValueGuidedRLPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/main/en/api/models/unet#diffusers.UNet1DModel">UNet1DModel</a>) &#x2014;
UNet architecture to denoise the encoded trajectories.`,name:"unet"},{anchor:"diffusers.experimental.ValueGuidedRLPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded trajectories. Default for this
application is <a href="/docs/diffusers/main/en/api/schedulers/ddpm#diffusers.DDPMScheduler">DDPMScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.experimental.ValueGuidedRLPipeline.env",description:`<strong>env</strong> () &#x2014;
An environment following the OpenAI gym API to act in. For now only Hopper has pretrained models.`,name:"env"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/experimental/rl/value_guided_sampling.py#L25"}}),T=new ge({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/value_guided_sampling.md"}}),{c(){i=r("meta"),p=l(),s=r("p"),c=l(),C($.$$.fragment),U=l(),C(h.$$.fragment),N=l(),v=r("p"),v.innerHTML=Q,q=l(),b=r("p"),b.textContent=ee,z=l(),x=r("p"),x.innerHTML=te,A=l(),_=r("p"),_.innerHTML=ne,E=l(),w=r("p"),w.innerHTML=ie,I=l(),C(g.$$.fragment),J=l(),C(P.$$.fragment),O=l(),d=r("div"),C(M.$$.fragment),W=l(),y=r("p"),y.textContent=ae,Y=l(),D=r("p"),D.innerHTML=se,X=l(),C(T.$$.fragment),B=l(),R=r("p"),this.h()},l(e){const t=ce("svelte-u9bgzb",document.head);i=u(t,"META",{name:!0,content:!0}),t.forEach(n),p=o(e),s=u(e,"P",{}),Z(s).forEach(n),c=o(e),H($.$$.fragment,e),U=o(e),H(h.$$.fragment,e),N=o(e),v=u(e,"P",{"data-svelte-h":!0}),m(v)!=="svelte-1dguds4"&&(v.innerHTML=Q),q=o(e),b=u(e,"P",{"data-svelte-h":!0}),m(b)!=="svelte-1cwsb16"&&(b.textContent=ee),z=o(e),x=u(e,"P",{"data-svelte-h":!0}),m(x)!=="svelte-k2slph"&&(x.innerHTML=te),A=o(e),_=u(e,"P",{"data-svelte-h":!0}),m(_)!=="svelte-1fh8mls"&&(_.innerHTML=ne),E=o(e),w=u(e,"P",{"data-svelte-h":!0}),m(w)!=="svelte-guadao"&&(w.innerHTML=ie),I=o(e),H(g.$$.fragment,e),J=o(e),H(P.$$.fragment,e),O=o(e),d=u(e,"DIV",{class:!0});var f=Z(d);H(M.$$.fragment,f),W=o(f),y=u(f,"P",{"data-svelte-h":!0}),m(y)!=="svelte-apl1xd"&&(y.textContent=ae),Y=o(f),D=u(f,"P",{"data-svelte-h":!0}),m(D)!=="svelte-496sm0"&&(D.innerHTML=se),f.forEach(n),X=o(e),H(T.$$.fragment,e),B=o(e),R=u(e,"P",{}),Z(R).forEach(n),this.h()},h(){K(i,"name","hf:doc:metadata"),K(i,"content",xe),K(d,"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){S(document.head,i),a(e,p,t),a(e,s,t),a(e,c,t),k($,e,t),a(e,U,t),k(h,e,t),a(e,N,t),a(e,v,t),a(e,q,t),a(e,b,t),a(e,z,t),a(e,x,t),a(e,A,t),a(e,_,t),a(e,E,t),a(e,w,t),a(e,I,t),k(g,e,t),a(e,J,t),k(P,e,t),a(e,O,t),a(e,d,t),k(M,d,null),S(d,W),S(d,y),S(d,Y),S(d,D),a(e,X,t),k(T,e,t),a(e,B,t),a(e,R,t),F=!0},p(e,[t]){const f={};t&2&&(f.$$scope={dirty:t,ctx:e}),h.$set(f);const le={};t&2&&(le.$$scope={dirty:t,ctx:e}),g.$set(le)},i(e){F||(V($.$$.fragment,e),V(h.$$.fragment,e),V(g.$$.fragment,e),V(P.$$.fragment,e),V(M.$$.fragment,e),V(T.$$.fragment,e),F=!0)},o(e){j($.$$.fragment,e),j(h.$$.fragment,e),j(g.$$.fragment,e),j(P.$$.fragment,e),j(M.$$.fragment,e),j(T.$$.fragment,e),F=!1},d(e){e&&(n(p),n(s),n(c),n(U),n(N),n(v),n(q),n(b),n(z),n(x),n(A),n(_),n(E),n(w),n(I),n(J),n(O),n(d),n(X),n(B),n(R)),n(i),G($,e),G(h,e),G(g,e),G(P,e),G(M),G(T,e)}}}const xe='{"title":"Value-guided planning","local":"value-guided-planning","sections":[{"title":"ValueGuidedRLPipeline","local":"diffusers.experimental.ValueGuidedRLPipeline","sections":[],"depth":2}],"depth":1}';function _e(L){return pe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ye extends fe{constructor(i){super(),me(this,i,_e,be,de,{})}}export{ye as component};
