import{s as Se,n as Fe,o as He}from"../chunks/scheduler.12fdeddc.js";import{S as Ce,i as _e,g as a,s as n,r as f,A as Le,h as o,f as i,c as s,j as Te,u as m,x as r,k as xe,y as Ue,a as l,v as p,d as u,t as g,w as h}from"../chunks/index.88dae322.js";import{C as me}from"../chunks/CodeBlock.8e54a086.js";import{H as A,E as ke}from"../chunks/getInferenceSnippets.00466244.js";function Ze(pe){let c,W,B,E,d,I,$,ue='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,ge="Compared to other few-shot learning methods, SetFit has several unique features:",q,y,he='<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>',X,b,Y,v,ce='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>.',z,M,de="All models on the Hub come with these useful features:",R,T,$e="<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>",N,x,Q,S,we='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:',O,F,D,H,K,C,ye="All <code>setfit</code> models can easily be loaded from the Hub.",ee,_,te,L,be='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.',ie,U,le,k,ne,Z,ve="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!",se,J,ae,P,Me='<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>',oe,j,re,G,fe;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 me({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 me({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 me({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 me({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"}}),j=new ke({props:{source:"https://github.com/huggingface/hub-docs/blob/main/docs/hub/setfit.md"}}),{c(){c=a("meta"),W=n(),B=a("p"),E=n(),f(d.$$.fragment),I=n(),$=a("p"),$.innerHTML=ue,V=n(),w=a("p"),w.textContent=ge,q=n(),y=a("ul"),y.innerHTML=he,X=n(),f(b.$$.fragment),Y=n(),v=a("p"),v.innerHTML=ce,z=n(),M=a("p"),M.textContent=de,R=n(),T=a("ol"),T.innerHTML=$e,N=n(),f(x.$$.fragment),Q=n(),S=a("p"),S.innerHTML=we,O=n(),f(F.$$.fragment),D=n(),f(H.$$.fragment),K=n(),C=a("p"),C.innerHTML=ye,ee=n(),f(_.$$.fragment),te=n(),L=a("p"),L.innerHTML=be,ie=n(),f(U.$$.fragment),le=n(),f(k.$$.fragment),ne=n(),Z=a("p"),Z.innerHTML=ve,se=n(),f(J.$$.fragment),ae=n(),P=a("ul"),P.innerHTML=Me,oe=n(),f(j.$$.fragment),re=n(),G=a("p"),this.h()},l(e){const t=Le("svelte-u9bgzb",document.head);c=o(t,"META",{name:!0,content:!0}),t.forEach(i),W=s(e),B=o(e,"P",{}),Te(B).forEach(i),E=s(e),m(d.$$.fragment,e),I=s(e),$=o(e,"P",{"data-svelte-h":!0}),r($)!=="svelte-1mkza03"&&($.innerHTML=ue),V=s(e),w=o(e,"P",{"data-svelte-h":!0}),r(w)!=="svelte-shg4rg"&&(w.textContent=ge),q=s(e),y=o(e,"UL",{"data-svelte-h":!0}),r(y)!=="svelte-txtyih"&&(y.innerHTML=he),X=s(e),m(b.$$.fragment,e),Y=s(e),v=o(e,"P",{"data-svelte-h":!0}),r(v)!=="svelte-e3slj1"&&(v.innerHTML=ce),z=s(e),M=o(e,"P",{"data-svelte-h":!0}),r(M)!=="svelte-qgdcoc"&&(M.textContent=de),R=s(e),T=o(e,"OL",{"data-svelte-h":!0}),r(T)!=="svelte-15umf4s"&&(T.innerHTML=$e),N=s(e),m(x.$$.fragment,e),Q=s(e),S=o(e,"P",{"data-svelte-h":!0}),r(S)!=="svelte-rjmin4"&&(S.innerHTML=we),O=s(e),m(F.$$.fragment,e),D=s(e),m(H.$$.fragment,e),K=s(e),C=o(e,"P",{"data-svelte-h":!0}),r(C)!=="svelte-1txywkm"&&(C.innerHTML=ye),ee=s(e),m(_.$$.fragment,e),te=s(e),L=o(e,"P",{"data-svelte-h":!0}),r(L)!=="svelte-18vgghq"&&(L.innerHTML=be),ie=s(e),m(U.$$.fragment,e),le=s(e),m(k.$$.fragment,e),ne=s(e),Z=o(e,"P",{"data-svelte-h":!0}),r(Z)!=="svelte-1hzt40x"&&(Z.innerHTML=ve),se=s(e),m(J.$$.fragment,e),ae=s(e),P=o(e,"UL",{"data-svelte-h":!0}),r(P)!=="svelte-b2vxdn"&&(P.innerHTML=Me),oe=s(e),m(j.$$.fragment,e),re=s(e),G=o(e,"P",{}),Te(G).forEach(i),this.h()},h(){xe(c,"name","hf:doc:metadata"),xe(c,"content",Je)},m(e,t){Ue(document.head,c),l(e,W,t),l(e,B,t),l(e,E,t),p(d,e,t),l(e,I,t),l(e,$,t),l(e,V,t),l(e,w,t),l(e,q,t),l(e,y,t),l(e,X,t),p(b,e,t),l(e,Y,t),l(e,v,t),l(e,z,t),l(e,M,t),l(e,R,t),l(e,T,t),l(e,N,t),p(x,e,t),l(e,Q,t),l(e,S,t),l(e,O,t),p(F,e,t),l(e,D,t),p(H,e,t),l(e,K,t),l(e,C,t),l(e,ee,t),p(_,e,t),l(e,te,t),l(e,L,t),l(e,ie,t),p(U,e,t),l(e,le,t),p(k,e,t),l(e,ne,t),l(e,Z,t),l(e,se,t),p(J,e,t),l(e,ae,t),l(e,P,t),l(e,oe,t),p(j,e,t),l(e,re,t),l(e,G,t),fe=!0},p:Fe,i(e){fe||(u(d.$$.fragment,e),u(b.$$.fragment,e),u(x.$$.fragment,e),u(F.$$.fragment,e),u(H.$$.fragment,e),u(_.$$.fragment,e),u(U.$$.fragment,e),u(k.$$.fragment,e),u(J.$$.fragment,e),u(j.$$.fragment,e),fe=!0)},o(e){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),g(j.$$.fragment,e),fe=!1},d(e){e&&(i(W),i(B),i(E),i(I),i($),i(V),i(w),i(q),i(y),i(X),i(Y),i(v),i(z),i(M),i(R),i(T),i(N),i(Q),i(S),i(O),i(D),i(K),i(C),i(ee),i(te),i(L),i(ie),i(le),i(ne),i(Z),i(se),i(ae),i(P),i(oe),i(re),i(G)),i(c),h(d,e),h(b,e),h(x,e),h(F,e),h(H,e),h(_,e),h(U,e),h(k,e),h(J,e),h(j,e)}}}const Je='{"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 Pe(pe){return He(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class We extends Ce{constructor(c){super(),_e(this,c,Pe,Ze,Se,{})}}export{We as component};
