import{s as ue,o as de,n as pe}from"../chunks/scheduler.8c3d61f6.js";import{S as fe,i as me,g as o,s as r,r as C,A as ce,h as p,f as n,c as l,j as Z,u as H,x as m,k as K,y as S,a,v as j,d as k,t as V,w as G}from"../chunks/index.589a98e8.js";import{T as le}from"../chunks/Tip.42aa8582.js";import{D as he}from"../chunks/Docstring.27406313.js";import{H as oe,E as ge}from"../chunks/EditOnGithub.e5a8d9cb.js";function $e(L){let i,d="🧪 This is an experimental pipeline for reinforcement learning!";return{c(){i=o("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=o("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 _e(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,_,ee="The abstract from the paper is:",A,b,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,x,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,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,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/pr_7944/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 oe({props:{title:"Value-guided planning",local:"value-guided-planning",headingTag:"h1"}}),h=new le({props:{warning:!0,$$slots:{default:[$e]},$$scope:{ctx:L}}}),g=new le({props:{$$slots:{default:[ve]},$$scope:{ctx:L}}}),P=new oe({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/pr_7944/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/pr_7944/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/pr_7944/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/pr_7944/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/vr_7944/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=o("meta"),d=r(),s=o("p"),c=r(),C($.$$.fragment),U=r(),C(h.$$.fragment),N=r(),v=o("p"),v.innerHTML=Q,z=r(),_=o("p"),_.textContent=ee,A=r(),b=o("p"),b.innerHTML=te,E=r(),x=o("p"),x.innerHTML=ne,q=r(),w=o("p"),w.innerHTML=ie,I=r(),C(g.$$.fragment),J=r(),C(P.$$.fragment),O=r(),u=o("div"),C(M.$$.fragment),W=r(),y=o("p"),y.textContent=ae,Y=r(),D=o("p"),D.innerHTML=se,X=r(),C(T.$$.fragment),B=r(),R=o("p"),this.h()},l(e){const t=ce("svelte-u9bgzb",document.head);i=p(t,"META",{name:!0,content:!0}),t.forEach(n),d=l(e),s=p(e,"P",{}),Z(s).forEach(n),c=l(e),H($.$$.fragment,e),U=l(e),H(h.$$.fragment,e),N=l(e),v=p(e,"P",{"data-svelte-h":!0}),m(v)!=="svelte-1dguds4"&&(v.innerHTML=Q),z=l(e),_=p(e,"P",{"data-svelte-h":!0}),m(_)!=="svelte-1cwsb16"&&(_.textContent=ee),A=l(e),b=p(e,"P",{"data-svelte-h":!0}),m(b)!=="svelte-k2slph"&&(b.innerHTML=te),E=l(e),x=p(e,"P",{"data-svelte-h":!0}),m(x)!=="svelte-1fh8mls"&&(x.innerHTML=ne),q=l(e),w=p(e,"P",{"data-svelte-h":!0}),m(w)!=="svelte-guadao"&&(w.innerHTML=ie),I=l(e),H(g.$$.fragment,e),J=l(e),H(P.$$.fragment,e),O=l(e),u=p(e,"DIV",{class:!0});var f=Z(u);H(M.$$.fragment,f),W=l(f),y=p(f,"P",{"data-svelte-h":!0}),m(y)!=="svelte-apl1xd"&&(y.textContent=ae),Y=l(f),D=p(f,"P",{"data-svelte-h":!0}),m(D)!=="svelte-rrnj08"&&(D.innerHTML=se),f.forEach(n),X=l(e),H(T.$$.fragment,e),B=l(e),R=p(e,"P",{}),Z(R).forEach(n),this.h()},h(){K(i,"name","hf:doc:metadata"),K(i,"content",be),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),j($,e,t),a(e,U,t),j(h,e,t),a(e,N,t),a(e,v,t),a(e,z,t),a(e,_,t),a(e,A,t),a(e,b,t),a(e,E,t),a(e,x,t),a(e,q,t),a(e,w,t),a(e,I,t),j(g,e,t),a(e,J,t),j(P,e,t),a(e,O,t),a(e,u,t),j(M,u,null),S(u,W),S(u,y),S(u,Y),S(u,D),a(e,X,t),j(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 re={};t&2&&(re.$$scope={dirty:t,ctx:e}),g.$set(re)},i(e){F||(k($.$$.fragment,e),k(h.$$.fragment,e),k(g.$$.fragment,e),k(P.$$.fragment,e),k(M.$$.fragment,e),k(T.$$.fragment,e),F=!0)},o(e){V($.$$.fragment,e),V(h.$$.fragment,e),V(g.$$.fragment,e),V(P.$$.fragment,e),V(M.$$.fragment,e),V(T.$$.fragment,e),F=!1},d(e){e&&(n(d),n(s),n(c),n(U),n(N),n(v),n(z),n(_),n(A),n(b),n(E),n(x),n(q),n(w),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 be='{"title":"Value-guided planning","local":"value-guided-planning","sections":[{"title":"ValueGuidedRLPipeline","local":"diffusers.experimental.ValueGuidedRLPipeline","sections":[],"depth":2}],"depth":1}';function xe(L){return de(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ye extends fe{constructor(i){super(),me(this,i,xe,_e,ue,{})}}export{ye as component};
