import{s as Te,n as xe,o as Se}from"../chunks/scheduler.d6170356.js";import{S as Fe,i as He,g as a,s as n,r as p,A as Ce,h as o,f as l,c as s,j as ve,u as m,x as r,k as Me,y as _e,a as i,v as u,d as g,t as h,w as c}from"../chunks/index.fcd4cc08.js";import{C as re}from"../chunks/CodeBlock.7b16bdef.js";import{H as A}from"../chunks/Heading.8660bd0e.js";function Le(fe){let f,G,j,W,d,I,$,pe='SetFit is an efficient and prompt-free framework for few-shot fine-tuning of <a href="https://sbert.net/" rel="nofollow">Sentence Transformers</a>. It achieves high accuracy with little labeled data - for instance, with only 8 labeled examples per class on the Customer Reviews sentiment dataset, SetFit is competitive with fine-tuning RoBERTa Large on the full training set of 3k examples 🤯!',V,w,me="Compared to other few-shot learning methods, SetFit has several unique features:",q,y,ue='<li>🗣 <strong>No prompts or verbalizers:</strong> Current techniques for few-shot fine-tuning require handcrafted prompts or verbalizers to convert examples into a format suitable for the underlying language model. SetFit dispenses with prompts altogether by generating rich embeddings directly from text examples.</li> <li>🏎 <strong>Fast to train:</strong> SetFit doesn’t require large-scale models like <a href="https://huggingface.co/bigscience/T0" rel="nofollow">T0</a> or GPT-3 to achieve high accuracy. As a result, it is typically an order of magnitude (or more) faster to train and run inference with.</li> <li>🌎 <strong>Multilingual support</strong>: SetFit can be used with any <a href="https://huggingface.co/models?library=sentence-transformers&amp;sort=downloads" rel="nofollow">Sentence Transformer</a> on the Hub, which means you can classify text in multiple languages by simply fine-tuning a multilingual checkpoint.</li>',E,b,X,v,ge='You can find SetFit models by filtering at the left of the <a href="https://huggingface.co/models?library=setfit" rel="nofollow">models page</a>.',Y,M,he="All models on the Hub come with these useful features:",z,T,ce="<li>An automatically generated model card with a brief description.</li> <li>An interactive widget you can use to play with the model directly in the browser.</li> <li>An Inference API that allows you to make inference requests.</li>",R,x,N,S,de='To get started, you can follow the <a href="https://huggingface.co/docs/setfit/installation" rel="nofollow">SetFit installation guide</a>. You can also use the following one-line install through pip:',Q,F,O,H,D,C,$e="All <code>setfit</code> models can easily be loaded from the Hub.",K,_,ee,L,we='Once loaded, you can use <a href="https://huggingface.co/docs/setfit/reference/main#setfit.SetFitModel.predict" rel="nofollow"><code>SetFitModel.predict</code></a> to perform inference.',te,U,le,k,ie,Z,ye="If you want to load a specific SetFit model, you can click <code>Use in SetFit</code> and you will be given a working snippet!",ne,J,se,P,be='<li><a href="https://huggingface.co/models?library=setfit" rel="nofollow">All SetFit models available on the Hub</a></li> <li>SetFit <a href="https://github.com/huggingface/setfit" rel="nofollow">repository</a></li> <li>SetFit <a href="https://huggingface.co/docs/setfit" rel="nofollow">docs</a></li> <li>SetFit <a href="https://arxiv.org/abs/2209.11055" rel="nofollow">paper</a></li>',ae,B,oe;return d=new A({props:{title:"Using SetFit with Hugging Face",local:"using-setfit-with-hugging-face",headingTag:"h1"}}),b=new A({props:{title:"Exploring SetFit on the Hub",local:"exploring-setfit-on-the-hub",headingTag:"h2"}}),x=new A({props:{title:"Installation",local:"installation",headingTag:"h2"}}),F=new re({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwc2V0Zml0",highlighted:'pip <span class="hljs-keyword">install</span> -U setfit',wrap:!1}}),H=new A({props:{title:"Using existing models",local:"using-existing-models",headingTag:"h2"}}),_=new re({props:{code:"ZnJvbSUyMHNldGZpdCUyMGltcG9ydCUyMFNldEZpdE1vZGVsJTBBJTBBbW9kZWwlMjAlM0QlMjBTZXRGaXRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIydG9tYWFyc2VuJTJGc2V0Zml0LXBhcmFwaHJhc2UtbXBuZXQtYmFzZS12Mi1zc3QyLTgtc2hvdCUyMik=",highlighted:`<span class="hljs-keyword">from</span> setfit <span class="hljs-keyword">import</span> SetFitModel

model = SetFitModel.from_pretrained(<span class="hljs-string">&quot;tomaarsen/setfit-paraphrase-mpnet-base-v2-sst2-8-shot&quot;</span>)`,wrap:!1}}),U=new re({props:{code:"bW9kZWwucHJlZGljdCglMjJBbWVsaWElMjBFYXJoYXJ0JTIwZmxldyUyMGhlciUyMHNpbmdsZSUyMGVuZ2luZSUyMExvY2toZWVkJTIwVmVnYSUyMDVCJTIwYWNyb3NzJTIwdGhlJTIwQXRsYW50aWMlMjB0byUyMFBhcmlzLiUyMik=",highlighted:'model.predict(<span class="hljs-string">&quot;Amelia Earhart flew her single engine Lockheed Vega 5B across the Atlantic to Paris.&quot;</span>)',wrap:!1}}),k=new re({props:{code:"JTVCJ3Bvc2l0aXZlJyUyQyUyMCduZWdhdGl2ZSclNUQ=",highlighted:'[<span class="hljs-string">&#x27;positive&#x27;</span>, <span class="hljs-string">&#x27;negative&#x27;</span>]',wrap:!1}}),J=new A({props:{title:"Additional resources",local:"additional-resources",headingTag:"h2"}}),{c(){f=a("meta"),G=n(),j=a("p"),W=n(),p(d.$$.fragment),I=n(),$=a("p"),$.innerHTML=pe,V=n(),w=a("p"),w.textContent=me,q=n(),y=a("ul"),y.innerHTML=ue,E=n(),p(b.$$.fragment),X=n(),v=a("p"),v.innerHTML=ge,Y=n(),M=a("p"),M.textContent=he,z=n(),T=a("ol"),T.innerHTML=ce,R=n(),p(x.$$.fragment),N=n(),S=a("p"),S.innerHTML=de,Q=n(),p(F.$$.fragment),O=n(),p(H.$$.fragment),D=n(),C=a("p"),C.innerHTML=$e,K=n(),p(_.$$.fragment),ee=n(),L=a("p"),L.innerHTML=we,te=n(),p(U.$$.fragment),le=n(),p(k.$$.fragment),ie=n(),Z=a("p"),Z.innerHTML=ye,ne=n(),p(J.$$.fragment),se=n(),P=a("ul"),P.innerHTML=be,ae=n(),B=a("p"),this.h()},l(e){const t=Ce("svelte-u9bgzb",document.head);f=o(t,"META",{name:!0,content:!0}),t.forEach(l),G=s(e),j=o(e,"P",{}),ve(j).forEach(l),W=s(e),m(d.$$.fragment,e),I=s(e),$=o(e,"P",{"data-svelte-h":!0}),r($)!=="svelte-1mkza03"&&($.innerHTML=pe),V=s(e),w=o(e,"P",{"data-svelte-h":!0}),r(w)!=="svelte-shg4rg"&&(w.textContent=me),q=s(e),y=o(e,"UL",{"data-svelte-h":!0}),r(y)!=="svelte-txtyih"&&(y.innerHTML=ue),E=s(e),m(b.$$.fragment,e),X=s(e),v=o(e,"P",{"data-svelte-h":!0}),r(v)!=="svelte-e3slj1"&&(v.innerHTML=ge),Y=s(e),M=o(e,"P",{"data-svelte-h":!0}),r(M)!=="svelte-qgdcoc"&&(M.textContent=he),z=s(e),T=o(e,"OL",{"data-svelte-h":!0}),r(T)!=="svelte-15umf4s"&&(T.innerHTML=ce),R=s(e),m(x.$$.fragment,e),N=s(e),S=o(e,"P",{"data-svelte-h":!0}),r(S)!=="svelte-rjmin4"&&(S.innerHTML=de),Q=s(e),m(F.$$.fragment,e),O=s(e),m(H.$$.fragment,e),D=s(e),C=o(e,"P",{"data-svelte-h":!0}),r(C)!=="svelte-1txywkm"&&(C.innerHTML=$e),K=s(e),m(_.$$.fragment,e),ee=s(e),L=o(e,"P",{"data-svelte-h":!0}),r(L)!=="svelte-18vgghq"&&(L.innerHTML=we),te=s(e),m(U.$$.fragment,e),le=s(e),m(k.$$.fragment,e),ie=s(e),Z=o(e,"P",{"data-svelte-h":!0}),r(Z)!=="svelte-1hzt40x"&&(Z.innerHTML=ye),ne=s(e),m(J.$$.fragment,e),se=s(e),P=o(e,"UL",{"data-svelte-h":!0}),r(P)!=="svelte-b2vxdn"&&(P.innerHTML=be),ae=s(e),B=o(e,"P",{}),ve(B).forEach(l),this.h()},h(){Me(f,"name","hf:doc:metadata"),Me(f,"content",Ue)},m(e,t){_e(document.head,f),i(e,G,t),i(e,j,t),i(e,W,t),u(d,e,t),i(e,I,t),i(e,$,t),i(e,V,t),i(e,w,t),i(e,q,t),i(e,y,t),i(e,E,t),u(b,e,t),i(e,X,t),i(e,v,t),i(e,Y,t),i(e,M,t),i(e,z,t),i(e,T,t),i(e,R,t),u(x,e,t),i(e,N,t),i(e,S,t),i(e,Q,t),u(F,e,t),i(e,O,t),u(H,e,t),i(e,D,t),i(e,C,t),i(e,K,t),u(_,e,t),i(e,ee,t),i(e,L,t),i(e,te,t),u(U,e,t),i(e,le,t),u(k,e,t),i(e,ie,t),i(e,Z,t),i(e,ne,t),u(J,e,t),i(e,se,t),i(e,P,t),i(e,ae,t),i(e,B,t),oe=!0},p:xe,i(e){oe||(g(d.$$.fragment,e),g(b.$$.fragment,e),g(x.$$.fragment,e),g(F.$$.fragment,e),g(H.$$.fragment,e),g(_.$$.fragment,e),g(U.$$.fragment,e),g(k.$$.fragment,e),g(J.$$.fragment,e),oe=!0)},o(e){h(d.$$.fragment,e),h(b.$$.fragment,e),h(x.$$.fragment,e),h(F.$$.fragment,e),h(H.$$.fragment,e),h(_.$$.fragment,e),h(U.$$.fragment,e),h(k.$$.fragment,e),h(J.$$.fragment,e),oe=!1},d(e){e&&(l(G),l(j),l(W),l(I),l($),l(V),l(w),l(q),l(y),l(E),l(X),l(v),l(Y),l(M),l(z),l(T),l(R),l(N),l(S),l(Q),l(O),l(D),l(C),l(K),l(ee),l(L),l(te),l(le),l(ie),l(Z),l(ne),l(se),l(P),l(ae),l(B)),l(f),c(d,e),c(b,e),c(x,e),c(F,e),c(H,e),c(_,e),c(U,e),c(k,e),c(J,e)}}}const Ue='{"title":"Using SetFit with Hugging Face","local":"using-setfit-with-hugging-face","sections":[{"title":"Exploring SetFit on the Hub","local":"exploring-setfit-on-the-hub","sections":[],"depth":2},{"title":"Installation","local":"installation","sections":[],"depth":2},{"title":"Using existing models","local":"using-existing-models","sections":[],"depth":2},{"title":"Additional resources","local":"additional-resources","sections":[],"depth":2}],"depth":1}';function ke(fe){return Se(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Be extends Fe{constructor(f){super(),He(this,f,ke,Le,Te,{})}}export{Be as component};
