import{s as ie,o as ae,n as se}from"../chunks/scheduler.182ea377.js";import{S as le,i as oe,g as o,s,r as N,A as re,h as r,f as n,c as l,j as W,u as A,x as m,k as Y,y as T,a as i,v as E,d as I,t as q,w as B}from"../chunks/index.abf12888.js";import{T as de}from"../chunks/Tip.230e2334.js";import{D as ue}from"../chunks/Docstring.93f6f462.js";import{H as ne}from"../chunks/Heading.16916d63.js";function fe(D){let a,c="🧪 This is an experimental pipeline for reinforcement learning!";return{c(){a=o("p"),a.textContent=c},l(d){a=r(d,"P",{"data-svelte-h":!0}),m(a)!=="svelte-13bwjls"&&(a.textContent=c)},m(d,P){i(d,a,P)},p:se,d(d){d&&n(a)}}}function pe(D){let a,c,d,P,h,C,p,H,g,O='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.',V,v,K="The abstract from the paper is:",j,b,Q="<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>.",R,x,X='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/github/huggingface/notebooks/blob/main/diffusers/reinforcement_learning_with_diffusers.ipynb" rel="nofollow">notebook</a>.',k,$,Z='The script to run the model is available <a href="https://github.com/huggingface/diffusers/tree/main/examples/reinforcement_learning" rel="nofollow">here</a>.',G,_,S,u,w,F,y,ee="Pipeline for value-guided sampling from a diffusion model trained to predict sequences of states.",J,M,te=`This model inherits from <a href="/docs/diffusers/v0.22.1/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.).`,U,L,z;return h=new ne({props:{title:"Value-guided planning",local:"value-guided-planning",headingTag:"h1"}}),p=new de({props:{warning:!0,$$slots:{default:[fe]},$$scope:{ctx:D}}}),_=new ne({props:{title:"ValueGuidedRLPipeline",local:"diffusers.experimental.ValueGuidedRLPipeline",headingTag:"h2"}}),w=new ue({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/v0.22.1/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/v0.22.1/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/v0.22.1/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/v0.22.1/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/v0.22.1/src/diffusers/experimental/rl/value_guided_sampling.py#L25"}}),{c(){a=o("meta"),c=s(),d=o("p"),P=s(),N(h.$$.fragment),C=s(),N(p.$$.fragment),H=s(),g=o("p"),g.innerHTML=O,V=s(),v=o("p"),v.textContent=K,j=s(),b=o("p"),b.innerHTML=Q,R=s(),x=o("p"),x.innerHTML=X,k=s(),$=o("p"),$.innerHTML=Z,G=s(),N(_.$$.fragment),S=s(),u=o("div"),N(w.$$.fragment),F=s(),y=o("p"),y.textContent=ee,J=s(),M=o("p"),M.innerHTML=te,U=s(),L=o("p"),this.h()},l(e){const t=re("svelte-u9bgzb",document.head);a=r(t,"META",{name:!0,content:!0}),t.forEach(n),c=l(e),d=r(e,"P",{}),W(d).forEach(n),P=l(e),A(h.$$.fragment,e),C=l(e),A(p.$$.fragment,e),H=l(e),g=r(e,"P",{"data-svelte-h":!0}),m(g)!=="svelte-1dguds4"&&(g.innerHTML=O),V=l(e),v=r(e,"P",{"data-svelte-h":!0}),m(v)!=="svelte-1cwsb16"&&(v.textContent=K),j=l(e),b=r(e,"P",{"data-svelte-h":!0}),m(b)!=="svelte-5lwooz"&&(b.innerHTML=Q),R=l(e),x=r(e,"P",{"data-svelte-h":!0}),m(x)!=="svelte-1llus9j"&&(x.innerHTML=X),k=l(e),$=r(e,"P",{"data-svelte-h":!0}),m($)!=="svelte-guadao"&&($.innerHTML=Z),G=l(e),A(_.$$.fragment,e),S=l(e),u=r(e,"DIV",{class:!0});var f=W(u);A(w.$$.fragment,f),F=l(f),y=r(f,"P",{"data-svelte-h":!0}),m(y)!=="svelte-apl1xd"&&(y.textContent=ee),J=l(f),M=r(f,"P",{"data-svelte-h":!0}),m(M)!=="svelte-cys7ny"&&(M.innerHTML=te),f.forEach(n),U=l(e),L=r(e,"P",{}),W(L).forEach(n),this.h()},h(){Y(a,"name","hf:doc:metadata"),Y(a,"content",me),Y(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){T(document.head,a),i(e,c,t),i(e,d,t),i(e,P,t),E(h,e,t),i(e,C,t),E(p,e,t),i(e,H,t),i(e,g,t),i(e,V,t),i(e,v,t),i(e,j,t),i(e,b,t),i(e,R,t),i(e,x,t),i(e,k,t),i(e,$,t),i(e,G,t),E(_,e,t),i(e,S,t),i(e,u,t),E(w,u,null),T(u,F),T(u,y),T(u,J),T(u,M),i(e,U,t),i(e,L,t),z=!0},p(e,[t]){const f={};t&2&&(f.$$scope={dirty:t,ctx:e}),p.$set(f)},i(e){z||(I(h.$$.fragment,e),I(p.$$.fragment,e),I(_.$$.fragment,e),I(w.$$.fragment,e),z=!0)},o(e){q(h.$$.fragment,e),q(p.$$.fragment,e),q(_.$$.fragment,e),q(w.$$.fragment,e),z=!1},d(e){e&&(n(c),n(d),n(P),n(C),n(H),n(g),n(V),n(v),n(j),n(b),n(R),n(x),n(k),n($),n(G),n(S),n(u),n(U),n(L)),n(a),B(h,e),B(p,e),B(_,e),B(w)}}}const me='{"title":"Value-guided planning","local":"value-guided-planning","sections":[{"title":"ValueGuidedRLPipeline","local":"diffusers.experimental.ValueGuidedRLPipeline","sections":[],"depth":2}],"depth":1}';function ce(D){return ae(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $e extends le{constructor(a){super(),oe(this,a,ce,pe,ie,{})}}export{$e as component};
