import{s as xe,n as He,o as Ue}from"../chunks/scheduler.9cda857a.js";import{S as je,i as ke,e as n,s,c as m,h as Ce,a as o,d as a,b as l,f as Te,g as f,j as r,k as fe,l as Je,m as i,n as p,t as h,o as u,p as c}from"../chunks/index.003612b0.js";import{C as Le}from"../chunks/CopyLLMTxtMenu.44d08a39.js";import{C as pe}from"../chunks/CodeBlock.a90632f1.js";import{H as X,E as Ee}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.e5cfda8c.js";function Ie(he){let d,Y,S,W,y,N,$,V,w,ue="<code>fastai</code> is an open-source Deep Learning library that leverages PyTorch and Python to provide high-level components to train fast and accurate neural networks with state-of-the-art outputs on text, vision, and tabular data.",Q,M,A,_,ce='You can find <code>fastai</code> models by filtering at the left of the <a href="https://huggingface.co/models?library=fastai&amp;sort=downloads" rel="nofollow">models page</a>.',F,v,de="All models on the Hub come up with the following features:",q,T,ge="<li>An automatically generated model card with a brief description and metadata tags that help for discoverability.</li> <li>An interactive widget you can use to play out with the model directly in the browser (for Image Classification)</li> <li>An Inference API that allows to make inference requests (for Image Classification).</li>",B,x,R,H,be="The <code>huggingface_hub</code> library is a lightweight Python client with utility functions to download models from the Hub.",z,U,D,j,ye="Once you have the library installed, you just need to use the <code>from_pretrained_fastai</code> method. This method not only loads the model, but also validates the <code>fastai</code> version when the model was saved, which is important for reproducibility.",O,k,K,C,$e="If you want to see how to load a specific model, you can click <code>Use in fastai</code> and you will be given a working snippet that you can load it!",ee,g,we='<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/libraries-fastai_snippet1.png"/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/libraries-fastai_snippet1-dark.png"/>',te,b,Me='<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/libraries-fastai_snippet2.png"/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/libraries-fastai_snippet2-dark.png"/>',ae,J,ie,L,_e="You can share your <code>fastai</code> models by using the <code>push_to_hub_fastai</code> method.",se,E,le,I,ne,Z,ve='<li>fastai <a href="https://course.fast.ai/" rel="nofollow">course</a>.</li> <li>fastai <a href="https://www.fast.ai/" rel="nofollow">website</a>.</li> <li>Integration with Hub <a href="https://docs.fast.ai/huggingface.html" rel="nofollow">docs</a>.</li> <li>Integration with Hub <a href="https://huggingface.co/blog/fastai" rel="nofollow">announcement</a>.</li>',oe,G,re,P,me;return y=new Le({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),$=new X({props:{title:"Using fastai at Hugging Face",local:"using-fastai-at-hugging-face",headingTag:"h1"}}),M=new X({props:{title:"Exploring fastai in the Hub",local:"exploring-fastai-in-the-hub",headingTag:"h2"}}),x=new X({props:{title:"Using existing models",local:"using-existing-models",headingTag:"h2"}}),U=new pe({props:{code:"cGlwJTIwaW5zdGFsbCUyMGh1Z2dpbmdmYWNlX2h1YiU1QiUyMmZhc3RhaSUyMiU1RA==",highlighted:'pip install huggingface_hub[<span class="hljs-string">&quot;fastai&quot;</span>]',wrap:!1}}),k=new pe({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMGZyb21fcHJldHJhaW5lZF9mYXN0YWklMEElMEFsZWFybmVyJTIwJTNEJTIwZnJvbV9wcmV0cmFpbmVkX2Zhc3RhaSglMjJlc3BlamVsb21hciUyRmlkZW50aWZ5LW15LWNhdCUyMiklMEElMEFfJTJDXyUyQ3Byb2JzJTIwJTNEJTIwbGVhcm5lci5wcmVkaWN0KGltZyklMEFwcmludChmJTIyUHJvYmFiaWxpdHklMjBpdCdzJTIwYSUyMGNhdCUzQSUyMCU3QjEwMCpwcm9icyU1QjElNUQuaXRlbSgpJTNBLjJmJTdEJTI1JTIyKSUwQSUwQSUyMyUyMFByb2JhYmlsaXR5JTIwaXQncyUyMGElMjBjYXQlM0ElMjAxMDAuMDAlMjU=",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> from_pretrained_fastai

learner = from_pretrained_fastai(<span class="hljs-string">&quot;espejelomar/identify-my-cat&quot;</span>)

_,_,probs = learner.predict(img)
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Probability it&#x27;s a cat: <span class="hljs-subst">{<span class="hljs-number">100</span>*probs[<span class="hljs-number">1</span>].item():<span class="hljs-number">.2</span>f}</span>%&quot;</span>)

<span class="hljs-comment"># Probability it&#x27;s a cat: 100.00%</span>`,wrap:!1}}),J=new X({props:{title:"Sharing your models",local:"sharing-your-models",headingTag:"h2"}}),E=new pe({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMHB1c2hfdG9faHViX2Zhc3RhaSUwQSUwQXB1c2hfdG9faHViX2Zhc3RhaShsZWFybmVyJTNEbGVhcm4lMkMlMjByZXBvX2lkJTNEJTIyZXNwZWplbG9tYXIlMkZpZGVudGlmeS1teS1jYXQlMjIp",highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> push_to_hub_fastai

push_to_hub_fastai(learner=learn, repo_id=<span class="hljs-string">&quot;espejelomar/identify-my-cat&quot;</span>)`,wrap:!1}}),I=new X({props:{title:"Additional resources",local:"additional-resources",headingTag:"h2"}}),G=new Ee({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/fastai.md"}}),{c(){d=n("meta"),Y=s(),S=n("p"),W=s(),m(y.$$.fragment),N=s(),m($.$$.fragment),V=s(),w=n("p"),w.innerHTML=ue,Q=s(),m(M.$$.fragment),A=s(),_=n("p"),_.innerHTML=ce,F=s(),v=n("p"),v.textContent=de,q=s(),T=n("ol"),T.innerHTML=ge,B=s(),m(x.$$.fragment),R=s(),H=n("p"),H.innerHTML=be,z=s(),m(U.$$.fragment),D=s(),j=n("p"),j.innerHTML=ye,O=s(),m(k.$$.fragment),K=s(),C=n("p"),C.innerHTML=$e,ee=s(),g=n("div"),g.innerHTML=we,te=s(),b=n("div"),b.innerHTML=Me,ae=s(),m(J.$$.fragment),ie=s(),L=n("p"),L.innerHTML=_e,se=s(),m(E.$$.fragment),le=s(),m(I.$$.fragment),ne=s(),Z=n("ul"),Z.innerHTML=ve,oe=s(),m(G.$$.fragment),re=s(),P=n("p"),this.h()},l(e){const t=Ce("svelte-u9bgzb",document.head);d=o(t,"META",{name:!0,content:!0}),t.forEach(a),Y=l(e),S=o(e,"P",{}),Te(S).forEach(a),W=l(e),f(y.$$.fragment,e),N=l(e),f($.$$.fragment,e),V=l(e),w=o(e,"P",{"data-svelte-h":!0}),r(w)!=="svelte-1rea5ra"&&(w.innerHTML=ue),Q=l(e),f(M.$$.fragment,e),A=l(e),_=o(e,"P",{"data-svelte-h":!0}),r(_)!=="svelte-38bw3m"&&(_.innerHTML=ce),F=l(e),v=o(e,"P",{"data-svelte-h":!0}),r(v)!=="svelte-t2majo"&&(v.textContent=de),q=l(e),T=o(e,"OL",{"data-svelte-h":!0}),r(T)!=="svelte-ay7wwo"&&(T.innerHTML=ge),B=l(e),f(x.$$.fragment,e),R=l(e),H=o(e,"P",{"data-svelte-h":!0}),r(H)!=="svelte-vmweuh"&&(H.innerHTML=be),z=l(e),f(U.$$.fragment,e),D=l(e),j=o(e,"P",{"data-svelte-h":!0}),r(j)!=="svelte-z2hjhy"&&(j.innerHTML=ye),O=l(e),f(k.$$.fragment,e),K=l(e),C=o(e,"P",{"data-svelte-h":!0}),r(C)!=="svelte-6jxo3y"&&(C.innerHTML=$e),ee=l(e),g=o(e,"DIV",{class:!0,"data-svelte-h":!0}),r(g)!=="svelte-1c4onc7"&&(g.innerHTML=we),te=l(e),b=o(e,"DIV",{class:!0,"data-svelte-h":!0}),r(b)!=="svelte-13w5uxr"&&(b.innerHTML=Me),ae=l(e),f(J.$$.fragment,e),ie=l(e),L=o(e,"P",{"data-svelte-h":!0}),r(L)!=="svelte-1bqitop"&&(L.innerHTML=_e),se=l(e),f(E.$$.fragment,e),le=l(e),f(I.$$.fragment,e),ne=l(e),Z=o(e,"UL",{"data-svelte-h":!0}),r(Z)!=="svelte-1x3ci0b"&&(Z.innerHTML=ve),oe=l(e),f(G.$$.fragment,e),re=l(e),P=o(e,"P",{}),Te(P).forEach(a),this.h()},h(){fe(d,"name","hf:doc:metadata"),fe(d,"content",Ze),fe(g,"class","flex justify-center"),fe(b,"class","flex justify-center")},m(e,t){Je(document.head,d),i(e,Y,t),i(e,S,t),i(e,W,t),p(y,e,t),i(e,N,t),p($,e,t),i(e,V,t),i(e,w,t),i(e,Q,t),p(M,e,t),i(e,A,t),i(e,_,t),i(e,F,t),i(e,v,t),i(e,q,t),i(e,T,t),i(e,B,t),p(x,e,t),i(e,R,t),i(e,H,t),i(e,z,t),p(U,e,t),i(e,D,t),i(e,j,t),i(e,O,t),p(k,e,t),i(e,K,t),i(e,C,t),i(e,ee,t),i(e,g,t),i(e,te,t),i(e,b,t),i(e,ae,t),p(J,e,t),i(e,ie,t),i(e,L,t),i(e,se,t),p(E,e,t),i(e,le,t),p(I,e,t),i(e,ne,t),i(e,Z,t),i(e,oe,t),p(G,e,t),i(e,re,t),i(e,P,t),me=!0},p:He,i(e){me||(h(y.$$.fragment,e),h($.$$.fragment,e),h(M.$$.fragment,e),h(x.$$.fragment,e),h(U.$$.fragment,e),h(k.$$.fragment,e),h(J.$$.fragment,e),h(E.$$.fragment,e),h(I.$$.fragment,e),h(G.$$.fragment,e),me=!0)},o(e){u(y.$$.fragment,e),u($.$$.fragment,e),u(M.$$.fragment,e),u(x.$$.fragment,e),u(U.$$.fragment,e),u(k.$$.fragment,e),u(J.$$.fragment,e),u(E.$$.fragment,e),u(I.$$.fragment,e),u(G.$$.fragment,e),me=!1},d(e){e&&(a(Y),a(S),a(W),a(N),a(V),a(w),a(Q),a(A),a(_),a(F),a(v),a(q),a(T),a(B),a(R),a(H),a(z),a(D),a(j),a(O),a(K),a(C),a(ee),a(g),a(te),a(b),a(ae),a(ie),a(L),a(se),a(le),a(ne),a(Z),a(oe),a(re),a(P)),a(d),c(y,e),c($,e),c(M,e),c(x,e),c(U,e),c(k,e),c(J,e),c(E,e),c(I,e),c(G,e)}}}const Ze='{"title":"Using fastai at Hugging Face","local":"using-fastai-at-hugging-face","sections":[{"title":"Exploring fastai in the Hub","local":"exploring-fastai-in-the-hub","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 Ge(he){return Ue(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ne extends je{constructor(d){super(),ke(this,d,Ge,Ie,xe,{})}}export{Ne as component};
