import{s as Me,n as _e,o as ve}from"../chunks/scheduler.d6170356.js";import{S as Te,i as He,g as n,s,r as h,A as xe,h as o,f as a,c as l,j as $e,u as c,x as r,k as ne,y as Ue,a as i,v as u,d,t as g,w as y}from"../chunks/index.fcd4cc08.js";import{C as oe}from"../chunks/CodeBlock.7b16bdef.js";import{H as S}from"../chunks/Heading.8660bd0e.js";function je(re){let f,P,Z,X,b,Y,w,fe="<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.",W,$,N,M,me='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>.',V,_,pe="All models on the Hub come up with the following features:",A,v,he="<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>",Q,T,F,H,ce="The <code>huggingface_hub</code> library is a lightweight Python client with utlity functions to download models from the Hub.",q,x,B,U,ue="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.",R,j,z,k,de="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!",D,m,ge='<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"/>',K,p,ye='<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"/>',O,J,ee,C,be="You can share your <code>fastai</code> models by using the <code>push_to_hub_fastai</code> method.",te,L,ae,E,ie,I,we='<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>',se,G,le;return b=new S({props:{title:"Using fastai at Hugging Face",local:"using-fastai-at-hugging-face",headingTag:"h1"}}),$=new S({props:{title:"Exploring fastai in the Hub",local:"exploring-fastai-in-the-hub",headingTag:"h2"}}),T=new S({props:{title:"Using existing models",local:"using-existing-models",headingTag:"h2"}}),x=new oe({props:{code:"cGlwJTIwaW5zdGFsbCUyMGh1Z2dpbmdmYWNlX2h1YiU1QiUyMmZhc3RhaSUyMiU1RA==",highlighted:'pip install huggingface_hub[<span class="hljs-string">&quot;fastai&quot;</span>]',wrap:!1}}),j=new oe({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 S({props:{title:"Sharing your models",local:"sharing-your-models",headingTag:"h2"}}),L=new oe({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}}),E=new S({props:{title:"Additional resources",local:"additional-resources",headingTag:"h2"}}),{c(){f=n("meta"),P=s(),Z=n("p"),X=s(),h(b.$$.fragment),Y=s(),w=n("p"),w.innerHTML=fe,W=s(),h($.$$.fragment),N=s(),M=n("p"),M.innerHTML=me,V=s(),_=n("p"),_.textContent=pe,A=s(),v=n("ol"),v.innerHTML=he,Q=s(),h(T.$$.fragment),F=s(),H=n("p"),H.innerHTML=ce,q=s(),h(x.$$.fragment),B=s(),U=n("p"),U.innerHTML=ue,R=s(),h(j.$$.fragment),z=s(),k=n("p"),k.innerHTML=de,D=s(),m=n("div"),m.innerHTML=ge,K=s(),p=n("div"),p.innerHTML=ye,O=s(),h(J.$$.fragment),ee=s(),C=n("p"),C.innerHTML=be,te=s(),h(L.$$.fragment),ae=s(),h(E.$$.fragment),ie=s(),I=n("ul"),I.innerHTML=we,se=s(),G=n("p"),this.h()},l(e){const t=xe("svelte-u9bgzb",document.head);f=o(t,"META",{name:!0,content:!0}),t.forEach(a),P=l(e),Z=o(e,"P",{}),$e(Z).forEach(a),X=l(e),c(b.$$.fragment,e),Y=l(e),w=o(e,"P",{"data-svelte-h":!0}),r(w)!=="svelte-1rea5ra"&&(w.innerHTML=fe),W=l(e),c($.$$.fragment,e),N=l(e),M=o(e,"P",{"data-svelte-h":!0}),r(M)!=="svelte-38bw3m"&&(M.innerHTML=me),V=l(e),_=o(e,"P",{"data-svelte-h":!0}),r(_)!=="svelte-t2majo"&&(_.textContent=pe),A=l(e),v=o(e,"OL",{"data-svelte-h":!0}),r(v)!=="svelte-ay7wwo"&&(v.innerHTML=he),Q=l(e),c(T.$$.fragment,e),F=l(e),H=o(e,"P",{"data-svelte-h":!0}),r(H)!=="svelte-cr1x44"&&(H.innerHTML=ce),q=l(e),c(x.$$.fragment,e),B=l(e),U=o(e,"P",{"data-svelte-h":!0}),r(U)!=="svelte-z2hjhy"&&(U.innerHTML=ue),R=l(e),c(j.$$.fragment,e),z=l(e),k=o(e,"P",{"data-svelte-h":!0}),r(k)!=="svelte-6jxo3y"&&(k.innerHTML=de),D=l(e),m=o(e,"DIV",{class:!0,"data-svelte-h":!0}),r(m)!=="svelte-1c4onc7"&&(m.innerHTML=ge),K=l(e),p=o(e,"DIV",{class:!0,"data-svelte-h":!0}),r(p)!=="svelte-13w5uxr"&&(p.innerHTML=ye),O=l(e),c(J.$$.fragment,e),ee=l(e),C=o(e,"P",{"data-svelte-h":!0}),r(C)!=="svelte-1bqitop"&&(C.innerHTML=be),te=l(e),c(L.$$.fragment,e),ae=l(e),c(E.$$.fragment,e),ie=l(e),I=o(e,"UL",{"data-svelte-h":!0}),r(I)!=="svelte-1x3ci0b"&&(I.innerHTML=we),se=l(e),G=o(e,"P",{}),$e(G).forEach(a),this.h()},h(){ne(f,"name","hf:doc:metadata"),ne(f,"content",ke),ne(m,"class","flex justify-center"),ne(p,"class","flex justify-center")},m(e,t){Ue(document.head,f),i(e,P,t),i(e,Z,t),i(e,X,t),u(b,e,t),i(e,Y,t),i(e,w,t),i(e,W,t),u($,e,t),i(e,N,t),i(e,M,t),i(e,V,t),i(e,_,t),i(e,A,t),i(e,v,t),i(e,Q,t),u(T,e,t),i(e,F,t),i(e,H,t),i(e,q,t),u(x,e,t),i(e,B,t),i(e,U,t),i(e,R,t),u(j,e,t),i(e,z,t),i(e,k,t),i(e,D,t),i(e,m,t),i(e,K,t),i(e,p,t),i(e,O,t),u(J,e,t),i(e,ee,t),i(e,C,t),i(e,te,t),u(L,e,t),i(e,ae,t),u(E,e,t),i(e,ie,t),i(e,I,t),i(e,se,t),i(e,G,t),le=!0},p:_e,i(e){le||(d(b.$$.fragment,e),d($.$$.fragment,e),d(T.$$.fragment,e),d(x.$$.fragment,e),d(j.$$.fragment,e),d(J.$$.fragment,e),d(L.$$.fragment,e),d(E.$$.fragment,e),le=!0)},o(e){g(b.$$.fragment,e),g($.$$.fragment,e),g(T.$$.fragment,e),g(x.$$.fragment,e),g(j.$$.fragment,e),g(J.$$.fragment,e),g(L.$$.fragment,e),g(E.$$.fragment,e),le=!1},d(e){e&&(a(P),a(Z),a(X),a(Y),a(w),a(W),a(N),a(M),a(V),a(_),a(A),a(v),a(Q),a(F),a(H),a(q),a(B),a(U),a(R),a(z),a(k),a(D),a(m),a(K),a(p),a(O),a(ee),a(C),a(te),a(ae),a(ie),a(I),a(se),a(G)),a(f),y(b,e),y($,e),y(T,e),y(x,e),y(j,e),y(J,e),y(L,e),y(E,e)}}}const ke='{"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 Je(re){return ve(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ze extends Te{constructor(f){super(),He(this,f,Je,je,Me,{})}}export{Ze as component};
