import{s as Xe,n as Qe,o as Ve}from"../chunks/scheduler.9cda857a.js";import{S as Ne,i as Oe,e as s,s as i,c as p,h as De,a as o,d as l,b as n,f as ze,g as m,j as u,k as Ce,l as Ke,m as a,n as r,t as d,o as f,p as M}from"../chunks/index.003612b0.js";import{C as et}from"../chunks/CopyLLMTxtMenu.44d08a39.js";import{C as Ie}from"../chunks/CodeBlock.a90632f1.js";import{H as R,E as tt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.e5cfda8c.js";function lt(_e){let h,Q,z,V,c,N,g,O,w,Ue="<code>stable-baselines3</code> is a set of reliable implementations of reinforcement learning algorithms in PyTorch.",D,T,K,$,Ae='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>.',ee,y,xe="All models on the Hub come up with useful features:",te,j,Le="<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>",le,J,ae,v,He="To install the <code>stable-baselines3</code> library, you need to install two packages:",ie,I,Be="<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>",ne,C,se,_,oe,U,ke="You can simply download a model from the Hub using the <code>load_from_hub</code> function",ue,A,pe,x,We="You need to define two parameters:",me,L,Ze="<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>",re,H,de,B,Ge="You can easily upload your models using two different functions:",fe,k,Ye="<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>",Me,W,he,Z,Fe="You need to define seven parameters:",be,G,Pe="<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>",ce,b,Se="<li><code>push_to_hub()</code>: simply push a file to the Hub</li>",ge,Y,we,F,qe="You need to define three parameters:",Te,P,Ee="<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>",$e,S,ye,q,Re='<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>',je,E,Je,X,ve;return c=new et({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),g=new R({props:{title:"Using Stable-Baselines3 at Hugging Face",local:"using-stable-baselines3-at-hugging-face",headingTag:"h1"}}),T=new R({props:{title:"Exploring Stable-Baselines3 in the Hub",local:"exploring-stable-baselines3-in-the-hub",headingTag:"h2"}}),J=new R({props:{title:"Install the library",local:"install-the-library",headingTag:"h2"}}),C=new Ie({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}}),_=new R({props:{title:"Using existing models",local:"using-existing-models",headingTag:"h2"}}),A=new Ie({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}}),H=new R({props:{title:"Sharing your models",local:"sharing-your-models",headingTag:"h2"}}),W=new Ie({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}}),Y=new Ie({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}}),S=new R({props:{title:"Additional resources",local:"additional-resources",headingTag:"h2"}}),E=new tt({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/stable-baselines3.md"}}),{c(){h=s("meta"),Q=i(),z=s("p"),V=i(),p(c.$$.fragment),N=i(),p(g.$$.fragment),O=i(),w=s("p"),w.innerHTML=Ue,D=i(),p(T.$$.fragment),K=i(),$=s("p"),$.innerHTML=Ae,ee=i(),y=s("p"),y.textContent=xe,te=i(),j=s("ol"),j.innerHTML=Le,le=i(),p(J.$$.fragment),ae=i(),v=s("p"),v.innerHTML=He,ie=i(),I=s("ul"),I.innerHTML=Be,ne=i(),p(C.$$.fragment),se=i(),p(_.$$.fragment),oe=i(),U=s("p"),U.innerHTML=ke,ue=i(),p(A.$$.fragment),pe=i(),x=s("p"),x.textContent=We,me=i(),L=s("ul"),L.innerHTML=Ze,re=i(),p(H.$$.fragment),de=i(),B=s("p"),B.textContent=Ge,fe=i(),k=s("ol"),k.innerHTML=Ye,Me=i(),p(W.$$.fragment),he=i(),Z=s("p"),Z.textContent=Fe,be=i(),G=s("ul"),G.innerHTML=Pe,ce=i(),b=s("ol"),b.innerHTML=Se,ge=i(),p(Y.$$.fragment),we=i(),F=s("p"),F.textContent=qe,Te=i(),P=s("ul"),P.innerHTML=Ee,$e=i(),p(S.$$.fragment),ye=i(),q=s("ul"),q.innerHTML=Re,je=i(),p(E.$$.fragment),Je=i(),X=s("p"),this.h()},l(e){const t=De("svelte-u9bgzb",document.head);h=o(t,"META",{name:!0,content:!0}),t.forEach(l),Q=n(e),z=o(e,"P",{}),ze(z).forEach(l),V=n(e),m(c.$$.fragment,e),N=n(e),m(g.$$.fragment,e),O=n(e),w=o(e,"P",{"data-svelte-h":!0}),u(w)!=="svelte-1qvbwux"&&(w.innerHTML=Ue),D=n(e),m(T.$$.fragment,e),K=n(e),$=o(e,"P",{"data-svelte-h":!0}),u($)!=="svelte-ybuo0r"&&($.innerHTML=Ae),ee=n(e),y=o(e,"P",{"data-svelte-h":!0}),u(y)!=="svelte-1krwbts"&&(y.textContent=xe),te=n(e),j=o(e,"OL",{"data-svelte-h":!0}),u(j)!=="svelte-117jq8g"&&(j.innerHTML=Le),le=n(e),m(J.$$.fragment,e),ae=n(e),v=o(e,"P",{"data-svelte-h":!0}),u(v)!=="svelte-1b2iahk"&&(v.innerHTML=He),ie=n(e),I=o(e,"UL",{"data-svelte-h":!0}),u(I)!=="svelte-rs53ls"&&(I.innerHTML=Be),ne=n(e),m(C.$$.fragment,e),se=n(e),m(_.$$.fragment,e),oe=n(e),U=o(e,"P",{"data-svelte-h":!0}),u(U)!=="svelte-15snlvs"&&(U.innerHTML=ke),ue=n(e),m(A.$$.fragment,e),pe=n(e),x=o(e,"P",{"data-svelte-h":!0}),u(x)!=="svelte-3zu0j3"&&(x.textContent=We),me=n(e),L=o(e,"UL",{"data-svelte-h":!0}),u(L)!=="svelte-btz9m6"&&(L.innerHTML=Ze),re=n(e),m(H.$$.fragment,e),de=n(e),B=o(e,"P",{"data-svelte-h":!0}),u(B)!=="svelte-cgi5ig"&&(B.textContent=Ge),fe=n(e),k=o(e,"OL",{"data-svelte-h":!0}),u(k)!=="svelte-124e0c9"&&(k.innerHTML=Ye),Me=n(e),m(W.$$.fragment,e),he=n(e),Z=o(e,"P",{"data-svelte-h":!0}),u(Z)!=="svelte-1j3q7ku"&&(Z.textContent=Fe),be=n(e),G=o(e,"UL",{"data-svelte-h":!0}),u(G)!=="svelte-1orohkz"&&(G.innerHTML=Pe),ce=n(e),b=o(e,"OL",{start:!0,"data-svelte-h":!0}),u(b)!=="svelte-ta2cke"&&(b.innerHTML=Se),ge=n(e),m(Y.$$.fragment,e),we=n(e),F=o(e,"P",{"data-svelte-h":!0}),u(F)!=="svelte-maovvp"&&(F.textContent=qe),Te=n(e),P=o(e,"UL",{"data-svelte-h":!0}),u(P)!=="svelte-2z5aiw"&&(P.innerHTML=Ee),$e=n(e),m(S.$$.fragment,e),ye=n(e),q=o(e,"UL",{"data-svelte-h":!0}),u(q)!=="svelte-1h97kql"&&(q.innerHTML=Re),je=n(e),m(E.$$.fragment,e),Je=n(e),X=o(e,"P",{}),ze(X).forEach(l),this.h()},h(){Ce(h,"name","hf:doc:metadata"),Ce(h,"content",at),Ce(b,"start","2")},m(e,t){Ke(document.head,h),a(e,Q,t),a(e,z,t),a(e,V,t),r(c,e,t),a(e,N,t),r(g,e,t),a(e,O,t),a(e,w,t),a(e,D,t),r(T,e,t),a(e,K,t),a(e,$,t),a(e,ee,t),a(e,y,t),a(e,te,t),a(e,j,t),a(e,le,t),r(J,e,t),a(e,ae,t),a(e,v,t),a(e,ie,t),a(e,I,t),a(e,ne,t),r(C,e,t),a(e,se,t),r(_,e,t),a(e,oe,t),a(e,U,t),a(e,ue,t),r(A,e,t),a(e,pe,t),a(e,x,t),a(e,me,t),a(e,L,t),a(e,re,t),r(H,e,t),a(e,de,t),a(e,B,t),a(e,fe,t),a(e,k,t),a(e,Me,t),r(W,e,t),a(e,he,t),a(e,Z,t),a(e,be,t),a(e,G,t),a(e,ce,t),a(e,b,t),a(e,ge,t),r(Y,e,t),a(e,we,t),a(e,F,t),a(e,Te,t),a(e,P,t),a(e,$e,t),r(S,e,t),a(e,ye,t),a(e,q,t),a(e,je,t),r(E,e,t),a(e,Je,t),a(e,X,t),ve=!0},p:Qe,i(e){ve||(d(c.$$.fragment,e),d(g.$$.fragment,e),d(T.$$.fragment,e),d(J.$$.fragment,e),d(C.$$.fragment,e),d(_.$$.fragment,e),d(A.$$.fragment,e),d(H.$$.fragment,e),d(W.$$.fragment,e),d(Y.$$.fragment,e),d(S.$$.fragment,e),d(E.$$.fragment,e),ve=!0)},o(e){f(c.$$.fragment,e),f(g.$$.fragment,e),f(T.$$.fragment,e),f(J.$$.fragment,e),f(C.$$.fragment,e),f(_.$$.fragment,e),f(A.$$.fragment,e),f(H.$$.fragment,e),f(W.$$.fragment,e),f(Y.$$.fragment,e),f(S.$$.fragment,e),f(E.$$.fragment,e),ve=!1},d(e){e&&(l(Q),l(z),l(V),l(N),l(O),l(w),l(D),l(K),l($),l(ee),l(y),l(te),l(j),l(le),l(ae),l(v),l(ie),l(I),l(ne),l(se),l(oe),l(U),l(ue),l(pe),l(x),l(me),l(L),l(re),l(de),l(B),l(fe),l(k),l(Me),l(he),l(Z),l(be),l(G),l(ce),l(b),l(ge),l(we),l(F),l(Te),l(P),l($e),l(ye),l(q),l(je),l(Je),l(X)),l(h),M(c,e),M(g,e),M(T,e),M(J,e),M(C,e),M(_,e),M(A,e),M(H,e),M(W,e),M(Y,e),M(S,e),M(E,e)}}}const at='{"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 it(_e){return Ve(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class mt extends Ne{constructor(h){super(),Oe(this,h,it,lt,Xe,{})}}export{mt as component};
