import{s as ue,o as de,n as pe}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 p,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.6b390b9a.js";import{H as re,E as ge}from"../chunks/EditOnGithub.1e64e623.js";function $e(L){let i,d="🧪 This is an experimental pipeline for reinforcement learning!";return{c(){i=r("p"),i.textContent=d},l(s){i=p(s,"P",{"data-svelte-h":!0}),m(i)!=="svelte-13bwjls"&&(i.textContent=d)},m(s,c){a(s,i,c)},p:pe,d(s){s&&n(i)}}}function ve(L){let i,d='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-components-across-pipelines">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=d},l(s){i=p(s,"P",{"data-svelte-h":!0}),m(i)!=="svelte-1wmc0l4"&&(i.innerHTML=d)},m(s,c){a(s,i,c)},p:pe,d(s){s&&n(i)}}}function be(L){let i,d,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.',z,b,ee="The abstract from the paper is:",A,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>",E,w,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>.',q,_,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,u,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"),d=l(),s=r("p"),c=l(),C($.$$.fragment),U=l(),C(h.$$.fragment),N=l(),v=r("p"),v.innerHTML=Q,z=l(),b=r("p"),b.textContent=ee,A=l(),x=r("p"),x.innerHTML=te,E=l(),w=r("p"),w.innerHTML=ne,q=l(),_=r("p"),_.innerHTML=ie,I=l(),C(g.$$.fragment),J=l(),C(P.$$.fragment),O=l(),u=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=p(t,"META",{name:!0,content:!0}),t.forEach(n),d=o(e),s=p(e,"P",{}),Z(s).forEach(n),c=o(e),H($.$$.fragment,e),U=o(e),H(h.$$.fragment,e),N=o(e),v=p(e,"P",{"data-svelte-h":!0}),m(v)!=="svelte-1dguds4"&&(v.innerHTML=Q),z=o(e),b=p(e,"P",{"data-svelte-h":!0}),m(b)!=="svelte-1cwsb16"&&(b.textContent=ee),A=o(e),x=p(e,"P",{"data-svelte-h":!0}),m(x)!=="svelte-k2slph"&&(x.innerHTML=te),E=o(e),w=p(e,"P",{"data-svelte-h":!0}),m(w)!=="svelte-1fh8mls"&&(w.innerHTML=ne),q=o(e),_=p(e,"P",{"data-svelte-h":!0}),m(_)!=="svelte-guadao"&&(_.innerHTML=ie),I=o(e),H(g.$$.fragment,e),J=o(e),H(P.$$.fragment,e),O=o(e),u=p(e,"DIV",{class:!0});var f=Z(u);H(M.$$.fragment,f),W=o(f),y=p(f,"P",{"data-svelte-h":!0}),m(y)!=="svelte-apl1xd"&&(y.textContent=ae),Y=o(f),D=p(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=p(e,"P",{}),Z(R).forEach(n),this.h()},h(){K(i,"name","hf:doc:metadata"),K(i,"content",xe),K(u,"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,d,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,z,t),a(e,b,t),a(e,A,t),a(e,x,t),a(e,E,t),a(e,w,t),a(e,q,t),a(e,_,t),a(e,I,t),k(g,e,t),a(e,J,t),k(P,e,t),a(e,O,t),a(e,u,t),k(M,u,null),S(u,W),S(u,y),S(u,Y),S(u,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(d),n(s),n(c),n(U),n(N),n(v),n(z),n(b),n(A),n(x),n(E),n(w),n(q),n(_),n(I),n(J),n(O),n(u),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 we(L){return de(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ye extends fe{constructor(i){super(),me(this,i,we,be,ue,{})}}export{ye as component};
