import{s as Re,n as Xe,o as ze}from"../chunks/scheduler.d6170356.js";import{S as Qe,i as Ve,g as s,s as i,r as p,A as Ne,h as o,f as l,c as n,j as Ee,u as r,x as u,k as ve,y as Oe,a,v as m,d,t as f,w as M}from"../chunks/index.fcd4cc08.js";import{C as Je}from"../chunks/CodeBlock.db16bf50.js";import{H as E,E as De}from"../chunks/getInferenceSnippets.0f6acb26.js";function Ke(Ie){let h,z,R,Q,b,V,g,Ce="<code>stable-baselines3</code> is a set of reliable implementations of reinforcement learning algorithms in PyTorch.",N,w,O,T,_e='You can find Stable-Baselines3 models by filtering at the left of the <a href="https://huggingface.co/models?library=stable-baselines3" rel="nofollow">models page</a>.',D,y,Ue="All models on the Hub come up with useful features:",K,$,Ae="<li>An automatically generated model card with a description, a training configuration, and more.</li> <li>Metadata tags that help for discoverability.</li> <li>Evaluation results to compare with other models.</li> <li>A video widget where you can watch your agent performing.</li>",ee,j,te,J,Le="To install the <code>stable-baselines3</code> library, you need to install two packages:",le,v,xe="<li><code>stable-baselines3</code>: Stable-Baselines3 library.</li> <li><code>huggingface-sb3</code>: additional code to load and upload Stable-baselines3 models from the Hub.</li>",ae,I,ie,C,ne,_,He="You can simply download a model from the Hub using the <code>load_from_hub</code> function",se,U,oe,A,Be="You need to define two parameters:",ue,L,ke="<li><code>--repo-id</code>: the name of the Hugging Face repo you want to download.</li> <li><code>--filename</code>: the file you want to download.</li>",pe,x,re,H,We="You can easily upload your models using two different functions:",me,B,Ze="<li><code>package_to_hub()</code>: save the model, evaluate it, generate a model card and record a replay video of your agent before pushing the complete repo to the Hub.</li>",de,k,fe,W,Ge="You need to define seven parameters:",Me,Z,Ye="<li><code>--model</code>: your trained model.</li> <li><code>--model_architecture</code>: name of the architecture of your model (DQN, PPO, A2C, SAC…).</li> <li><code>--env_id</code>: name of the environment.</li> <li><code>--eval_env</code>: environment used to evaluate the agent.</li> <li><code>--repo-id</code>: the name of the Hugging Face repo you want to create or update. It’s <code>&lt;your huggingface username&gt;/&lt;the repo name&gt;</code>.</li> <li><code>--commit-message</code>.</li> <li><code>--filename</code>: the file you want to push to the Hub.</li>",he,c,Fe="<li><code>push_to_hub()</code>: simply push a file to the Hub</li>",ce,G,be,Y,Pe="You need to define three parameters:",ge,F,qe="<li><code>--repo-id</code>: the name of the Hugging Face repo you want to create or update. It’s <code>&lt;your huggingface username&gt;/&lt;the repo name&gt;</code>.</li> <li><code>--filename</code>: the file you want to push to the Hub.</li> <li><code>--commit-message</code>.</li>",we,P,Te,q,Se='<li>Hugging Face Stable-Baselines3 <a href="https://github.com/huggingface/huggingface_sb3#hugging-face--x-stable-baselines3-v20" rel="nofollow">documentation</a></li> <li>Stable-Baselines3 <a href="https://stable-baselines3.readthedocs.io/en/master/" rel="nofollow">documentation</a></li>',ye,S,$e,X,je;return b=new E({props:{title:"Using Stable-Baselines3 at Hugging Face",local:"using-stable-baselines3-at-hugging-face",headingTag:"h1"}}),w=new E({props:{title:"Exploring Stable-Baselines3 in the Hub",local:"exploring-stable-baselines3-in-the-hub",headingTag:"h2"}}),j=new E({props:{title:"Install the library",local:"install-the-library",headingTag:"h2"}}),I=new Je({props:{code:"cGlwJTIwaW5zdGFsbCUyMHN0YWJsZS1iYXNlbGluZXMzJTBBcGlwJTIwaW5zdGFsbCUyMGh1Z2dpbmdmYWNlLXNiMw==",highlighted:`pip <span class="hljs-keyword">install </span>stable-<span class="hljs-keyword">baselines3
</span>pip <span class="hljs-keyword">install </span>huggingface-<span class="hljs-keyword">sb3</span>`,wrap:!1}}),C=new E({props:{title:"Using existing models",local:"using-existing-models",headingTag:"h2"}}),U=new Je({props:{code:"Y2hlY2twb2ludCUyMCUzRCUyMGxvYWRfZnJvbV9odWIoJTBBJTIwJTIwJTIwJTIwcmVwb19pZCUzRCUyMnNiMyUyRmRlbW8taGYtQ2FydFBvbGUtdjElMjIlMkMlMEElMjAlMjAlMjAlMjBmaWxlbmFtZSUzRCUyMnBwby1DYXJ0UG9sZS12MS56aXAlMjIlMkMlMEEp",highlighted:`<span class="hljs-keyword">checkpoint</span> = load_from_hub(
    repo_id=&quot;sb3/demo-hf-CartPole-v1&quot;,
    filename=&quot;ppo-CartPole-v1.zip&quot;,
)`,wrap:!1}}),x=new E({props:{title:"Sharing your models",local:"sharing-your-models",headingTag:"h2"}}),k=new Je({props:{code:"cGFja2FnZV90b19odWIobW9kZWwlM0Rtb2RlbCUyQyUyMCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG1vZGVsX25hbWUlM0QlMjJwcG8tTHVuYXJMYW5kZXItdjIlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtb2RlbF9hcmNoaXRlY3R1cmUlM0QlMjJQUE8lMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBlbnZfaWQlM0RlbnZfaWQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBldmFsX2VudiUzRGV2YWxfZW52JTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcmVwb19pZCUzRCUyMlRob21hc1NpbW9uaW5pJTJGcHBvLUx1bmFyTGFuZGVyLXYyJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwY29tbWl0X21lc3NhZ2UlM0QlMjJUZXN0JTIwY29tbWl0JTIyKQ==",highlighted:`package_to_hub(<span class="hljs-attribute">model</span>=model, 
               <span class="hljs-attribute">model_name</span>=<span class="hljs-string">&quot;ppo-LunarLander-v2&quot;</span>,
               <span class="hljs-attribute">model_architecture</span>=<span class="hljs-string">&quot;PPO&quot;</span>,
               <span class="hljs-attribute">env_id</span>=env_id,
               <span class="hljs-attribute">eval_env</span>=eval_env,
               <span class="hljs-attribute">repo_id</span>=<span class="hljs-string">&quot;ThomasSimonini/ppo-LunarLander-v2&quot;</span>,
               <span class="hljs-attribute">commit_message</span>=<span class="hljs-string">&quot;Test commit&quot;</span>)`,wrap:!1}}),G=new Je({props:{code:"cHVzaF90b19odWIoJTBBJTIwJTIwJTIwJTIwcmVwb19pZCUzRCUyMlRob21hc1NpbW9uaW5pJTJGcHBvLUx1bmFyTGFuZGVyLXYyJTIyJTJDJTBBJTIwJTIwJTIwJTIwZmlsZW5hbWUlM0QlMjJwcG8tTHVuYXJMYW5kZXItdjIuemlwJTIyJTJDJTBBJTIwJTIwJTIwJTIwY29tbWl0X21lc3NhZ2UlM0QlMjJBZGRlZCUyMEx1bmFyTGFuZGVyLXYyJTIwbW9kZWwlMjB0cmFpbmVkJTIwd2l0aCUyMFBQTyUyMiUyQyUwQSk=",highlighted:`push_to_hub(
    <span class="hljs-attribute">repo_id</span>=<span class="hljs-string">&quot;ThomasSimonini/ppo-LunarLander-v2&quot;</span>,
    <span class="hljs-attribute">filename</span>=<span class="hljs-string">&quot;ppo-LunarLander-v2.zip&quot;</span>,
    <span class="hljs-attribute">commit_message</span>=<span class="hljs-string">&quot;Added LunarLander-v2 model trained with PPO&quot;</span>,
)`,wrap:!1}}),P=new E({props:{title:"Additional resources",local:"additional-resources",headingTag:"h2"}}),S=new De({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/stable-baselines3.md"}}),{c(){h=s("meta"),z=i(),R=s("p"),Q=i(),p(b.$$.fragment),V=i(),g=s("p"),g.innerHTML=Ce,N=i(),p(w.$$.fragment),O=i(),T=s("p"),T.innerHTML=_e,D=i(),y=s("p"),y.textContent=Ue,K=i(),$=s("ol"),$.innerHTML=Ae,ee=i(),p(j.$$.fragment),te=i(),J=s("p"),J.innerHTML=Le,le=i(),v=s("ul"),v.innerHTML=xe,ae=i(),p(I.$$.fragment),ie=i(),p(C.$$.fragment),ne=i(),_=s("p"),_.innerHTML=He,se=i(),p(U.$$.fragment),oe=i(),A=s("p"),A.textContent=Be,ue=i(),L=s("ul"),L.innerHTML=ke,pe=i(),p(x.$$.fragment),re=i(),H=s("p"),H.textContent=We,me=i(),B=s("ol"),B.innerHTML=Ze,de=i(),p(k.$$.fragment),fe=i(),W=s("p"),W.textContent=Ge,Me=i(),Z=s("ul"),Z.innerHTML=Ye,he=i(),c=s("ol"),c.innerHTML=Fe,ce=i(),p(G.$$.fragment),be=i(),Y=s("p"),Y.textContent=Pe,ge=i(),F=s("ul"),F.innerHTML=qe,we=i(),p(P.$$.fragment),Te=i(),q=s("ul"),q.innerHTML=Se,ye=i(),p(S.$$.fragment),$e=i(),X=s("p"),this.h()},l(e){const t=Ne("svelte-u9bgzb",document.head);h=o(t,"META",{name:!0,content:!0}),t.forEach(l),z=n(e),R=o(e,"P",{}),Ee(R).forEach(l),Q=n(e),r(b.$$.fragment,e),V=n(e),g=o(e,"P",{"data-svelte-h":!0}),u(g)!=="svelte-1qvbwux"&&(g.innerHTML=Ce),N=n(e),r(w.$$.fragment,e),O=n(e),T=o(e,"P",{"data-svelte-h":!0}),u(T)!=="svelte-ybuo0r"&&(T.innerHTML=_e),D=n(e),y=o(e,"P",{"data-svelte-h":!0}),u(y)!=="svelte-1krwbts"&&(y.textContent=Ue),K=n(e),$=o(e,"OL",{"data-svelte-h":!0}),u($)!=="svelte-117jq8g"&&($.innerHTML=Ae),ee=n(e),r(j.$$.fragment,e),te=n(e),J=o(e,"P",{"data-svelte-h":!0}),u(J)!=="svelte-1b2iahk"&&(J.innerHTML=Le),le=n(e),v=o(e,"UL",{"data-svelte-h":!0}),u(v)!=="svelte-rs53ls"&&(v.innerHTML=xe),ae=n(e),r(I.$$.fragment,e),ie=n(e),r(C.$$.fragment,e),ne=n(e),_=o(e,"P",{"data-svelte-h":!0}),u(_)!=="svelte-15snlvs"&&(_.innerHTML=He),se=n(e),r(U.$$.fragment,e),oe=n(e),A=o(e,"P",{"data-svelte-h":!0}),u(A)!=="svelte-3zu0j3"&&(A.textContent=Be),ue=n(e),L=o(e,"UL",{"data-svelte-h":!0}),u(L)!=="svelte-btz9m6"&&(L.innerHTML=ke),pe=n(e),r(x.$$.fragment,e),re=n(e),H=o(e,"P",{"data-svelte-h":!0}),u(H)!=="svelte-cgi5ig"&&(H.textContent=We),me=n(e),B=o(e,"OL",{"data-svelte-h":!0}),u(B)!=="svelte-124e0c9"&&(B.innerHTML=Ze),de=n(e),r(k.$$.fragment,e),fe=n(e),W=o(e,"P",{"data-svelte-h":!0}),u(W)!=="svelte-1j3q7ku"&&(W.textContent=Ge),Me=n(e),Z=o(e,"UL",{"data-svelte-h":!0}),u(Z)!=="svelte-1orohkz"&&(Z.innerHTML=Ye),he=n(e),c=o(e,"OL",{start:!0,"data-svelte-h":!0}),u(c)!=="svelte-ta2cke"&&(c.innerHTML=Fe),ce=n(e),r(G.$$.fragment,e),be=n(e),Y=o(e,"P",{"data-svelte-h":!0}),u(Y)!=="svelte-maovvp"&&(Y.textContent=Pe),ge=n(e),F=o(e,"UL",{"data-svelte-h":!0}),u(F)!=="svelte-2z5aiw"&&(F.innerHTML=qe),we=n(e),r(P.$$.fragment,e),Te=n(e),q=o(e,"UL",{"data-svelte-h":!0}),u(q)!=="svelte-1h97kql"&&(q.innerHTML=Se),ye=n(e),r(S.$$.fragment,e),$e=n(e),X=o(e,"P",{}),Ee(X).forEach(l),this.h()},h(){ve(h,"name","hf:doc:metadata"),ve(h,"content",et),ve(c,"start","2")},m(e,t){Oe(document.head,h),a(e,z,t),a(e,R,t),a(e,Q,t),m(b,e,t),a(e,V,t),a(e,g,t),a(e,N,t),m(w,e,t),a(e,O,t),a(e,T,t),a(e,D,t),a(e,y,t),a(e,K,t),a(e,$,t),a(e,ee,t),m(j,e,t),a(e,te,t),a(e,J,t),a(e,le,t),a(e,v,t),a(e,ae,t),m(I,e,t),a(e,ie,t),m(C,e,t),a(e,ne,t),a(e,_,t),a(e,se,t),m(U,e,t),a(e,oe,t),a(e,A,t),a(e,ue,t),a(e,L,t),a(e,pe,t),m(x,e,t),a(e,re,t),a(e,H,t),a(e,me,t),a(e,B,t),a(e,de,t),m(k,e,t),a(e,fe,t),a(e,W,t),a(e,Me,t),a(e,Z,t),a(e,he,t),a(e,c,t),a(e,ce,t),m(G,e,t),a(e,be,t),a(e,Y,t),a(e,ge,t),a(e,F,t),a(e,we,t),m(P,e,t),a(e,Te,t),a(e,q,t),a(e,ye,t),m(S,e,t),a(e,$e,t),a(e,X,t),je=!0},p:Xe,i(e){je||(d(b.$$.fragment,e),d(w.$$.fragment,e),d(j.$$.fragment,e),d(I.$$.fragment,e),d(C.$$.fragment,e),d(U.$$.fragment,e),d(x.$$.fragment,e),d(k.$$.fragment,e),d(G.$$.fragment,e),d(P.$$.fragment,e),d(S.$$.fragment,e),je=!0)},o(e){f(b.$$.fragment,e),f(w.$$.fragment,e),f(j.$$.fragment,e),f(I.$$.fragment,e),f(C.$$.fragment,e),f(U.$$.fragment,e),f(x.$$.fragment,e),f(k.$$.fragment,e),f(G.$$.fragment,e),f(P.$$.fragment,e),f(S.$$.fragment,e),je=!1},d(e){e&&(l(z),l(R),l(Q),l(V),l(g),l(N),l(O),l(T),l(D),l(y),l(K),l($),l(ee),l(te),l(J),l(le),l(v),l(ae),l(ie),l(ne),l(_),l(se),l(oe),l(A),l(ue),l(L),l(pe),l(re),l(H),l(me),l(B),l(de),l(fe),l(W),l(Me),l(Z),l(he),l(c),l(ce),l(be),l(Y),l(ge),l(F),l(we),l(Te),l(q),l(ye),l($e),l(X)),l(h),M(b,e),M(w,e),M(j,e),M(I,e),M(C,e),M(U,e),M(x,e),M(k,e),M(G,e),M(P,e),M(S,e)}}}const et='{"title":"Using Stable-Baselines3 at Hugging Face","local":"using-stable-baselines3-at-hugging-face","sections":[{"title":"Exploring Stable-Baselines3 in the Hub","local":"exploring-stable-baselines3-in-the-hub","sections":[],"depth":2},{"title":"Install the library","local":"install-the-library","sections":[],"depth":2},{"title":"Using existing models","local":"using-existing-models","sections":[],"depth":2},{"title":"Sharing your models","local":"sharing-your-models","sections":[],"depth":2},{"title":"Additional resources","local":"additional-resources","sections":[],"depth":2}],"depth":1}';function tt(Ie){return ze(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class st extends Qe{constructor(h){super(),Ve(this,h,tt,Ke,Re,{})}}export{st as component};
