import{s as ql,o as Pl,n as lM}from"../chunks/scheduler.c3dfb84c.js";import{S as MM,i as sM,e as w,s as a,c as T,h as UM,a as j,d as s,b as n,f as Ll,g as y,j as I,k as Kl,l as aM,m as U,n as e,t as C,o as J,p as t}from"../chunks/index.47c20be5.js";import{T as nM}from"../chunks/Tip.34d6f74f.js";import{C as TM,H as q,E as yM}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.423d8c15.js";import{C as r}from"../chunks/CodeBlock.6375aab7.js";function eM(Ml){let i,m="Note that this trainer uses pairs between sentences as the training samples, so the number of training steps grows exponentially to the number of unlabeled examples. To avoid overfitting, consider setting <code>max_steps</code> relatively low.";return{c(){i=w("p"),i.innerHTML=m},l(p){i=j(p,"P",{"data-svelte-h":!0}),I(i)!=="svelte-1v3685y"&&(i.innerHTML=m)},m(p,P){U(p,i,P)},p:lM,d(p){p&&s(i)}}}function CM(Ml){let i,m,p,P,A,sl,h,Ul,d,Gl="If you have access to unlabeled data, then you can use knowledge distillation to improve the performance of your small SetFit model. The approach involves training a larger model and using unlabeled data to distil its performance into your smaller SetFit model. As a result, your SetFit model will become stronger.",al,b,Dl="Additionally, you can also use knowledge distillation to replace your trained SetFit model with a more efficient model at less of a performance decrease.",nl,o,fl="This guide will show you how to proceed with knowledge distillation.",Tl,N,yl,O,Ql='Let’s consider a scenario with a little bit of labeled training data (e.g. 64 sentences). We will simulate this scenario using the <a href="https://huggingface.co/datasets/ag_news" rel="nofollow">ag_news</a> dataset for this guide.',el,u,Cl,g,Jl,V,Bl="We can use standard SetFit training approach to prepare a model.",tl,F,il,R,wl,Y,Xl="This model reaches 78.18% on our dataset. Certainly respectable given the tiny amount of training data, but we can use knowledge distillation to squeeze more performance out of our model.",jl,x,Il,Z,zl="Alongside our labeled training data, we may als have a lot of unlabeled training data (e.g. 500 sentences). Let’s prepare it:",pl,W,rl,G,cl,D,El='Then, we will prepare a larger trained SetFit model that will act as the teacher to our smaller student model. The strong <a href="https://huggingface.co/sentence-transformers/paraphrase-mpnet-base-v2" rel="nofollow"><code>sentence-transformers/paraphrase-mpnet-base-v2</code></a> Sentence Transformer model will be used to initialize the SetFit model.',ml,f,Al,Q,_l="We need to train this model on the labeled dataset first:",hl,B,dl,X,bl,z,Sl="This large teacher model reaches 83.79%, which is quite strong for this little data, and noticeably, stronger than the 78.18% from our smaller (but more efficient) model.",ol,E,Nl,_,kl='The performance from the stronger teacher_model can be distilled into the smaller model using the <a href="/docs/setfit/main/en/reference/trainer#setfit.DistillationTrainer">DistillationTrainer</a>. It accepts a teacher and a student model, as well as an unlabeled dataset.',Ol,c,ul,S,gl,k,Vl,$,$l="Using knowledge distillation, we were able to improve our model from 78.18% to 80.84% in a few minutes of training.",Fl,v,Rl,H,vl="This snippet shows the entire knowledge distillation strategy in an end-to-end example:",Yl,L,xl,K,Zl,ll,Wl;return A=new TM({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),h=new q({props:{title:"Knowledge Distillation",local:"knowledge-distillation",headingTag:"h1"}}),N=new q({props:{title:"Data preparation",local:"data-preparation",headingTag:"h2"}}),u=new r({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBZnJvbSUyMHNldGZpdCUyMGltcG9ydCUyMHNhbXBsZV9kYXRhc2V0JTBBJTBBJTIzJTIwTG9hZCUyMGElMjBkYXRhc2V0JTIwZnJvbSUyMHRoZSUyMEh1Z2dpbmclMjBGYWNlJTIwSHViJTBBZGF0YXNldCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJhZ19uZXdzJTIyKSUwQSUwQSUyMyUyMENyZWF0ZSUyMGElMjBzYW1wbGUlMjBmZXctc2hvdCUyMGRhdGFzZXQlMjB0byUyMHRyYWluJTIwd2l0aCUwQXRyYWluX2RhdGFzZXQlMjAlM0QlMjBzYW1wbGVfZGF0YXNldChkYXRhc2V0JTVCJTIydHJhaW4lMjIlNUQlMkMlMjBsYWJlbF9jb2x1bW4lM0QlMjJsYWJlbCUyMiUyQyUyMG51bV9zYW1wbGVzJTNEMTYpJTBBJTIzJTIwRGF0YXNldCglN0IlMEElMjMlMjAlMjAlMjAlMjAlMjBmZWF0dXJlcyUzQSUyMCU1Qid0ZXh0JyUyQyUyMCdsYWJlbCclNUQlMkMlMEElMjMlMjAlMjAlMjAlMjAlMjBudW1fcm93cyUzQSUyMDY0JTBBJTIzJTIwJTdEKSUwQSUwQSUyMyUyMERhdGFzZXQlMjBmb3IlMjBldmFsdWF0aW9uJTBBZXZhbF9kYXRhc2V0JTIwJTNEJTIwZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlMEElMjMlMjBEYXRhc2V0KCU3QiUwQSUyMyUyMCUyMCUyMCUyMCUyMGZlYXR1cmVzJTNBJTIwJTVCJ3RleHQnJTJDJTIwJ2xhYmVsJyU1RCUyQyUwQSUyMyUyMCUyMCUyMCUyMCUyMG51bV9yb3dzJTNBJTIwNzYwMCUwQSUyMyUyMCU3RCk=",highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-keyword">from</span> setfit <span class="hljs-keyword">import</span> sample_dataset

<span class="hljs-comment"># Load a dataset from the Hugging Face Hub</span>
dataset = load_dataset(<span class="hljs-string">&quot;ag_news&quot;</span>)

<span class="hljs-comment"># Create a sample few-shot dataset to train with</span>
train_dataset = sample_dataset(dataset[<span class="hljs-string">&quot;train&quot;</span>], label_column=<span class="hljs-string">&quot;label&quot;</span>, num_samples=<span class="hljs-number">16</span>)
<span class="hljs-comment"># Dataset({</span>
<span class="hljs-comment">#     features: [&#x27;text&#x27;, &#x27;label&#x27;],</span>
<span class="hljs-comment">#     num_rows: 64</span>
<span class="hljs-comment"># })</span>

<span class="hljs-comment"># Dataset for evaluation</span>
eval_dataset = dataset[<span class="hljs-string">&quot;test&quot;</span>]
<span class="hljs-comment"># Dataset({</span>
<span class="hljs-comment">#     features: [&#x27;text&#x27;, &#x27;label&#x27;],</span>
<span class="hljs-comment">#     num_rows: 7600</span>
<span class="hljs-comment"># })</span>`,wrap:!1}}),g=new q({props:{title:"Baseline model",local:"baseline-model",headingTag:"h2"}}),F=new r({props:{code:"ZnJvbSUyMHNldGZpdCUyMGltcG9ydCUyMFNldEZpdE1vZGVsJTJDJTIwVHJhaW5pbmdBcmd1bWVudHMlMkMlMjBUcmFpbmVyJTBBJTBBbW9kZWwlMjAlM0QlMjBTZXRGaXRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyc2VudGVuY2UtdHJhbnNmb3JtZXJzJTJGcGFyYXBocmFzZS1NaW5pTE0tTDMtdjIlMjIpJTBBJTBBYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMGJhdGNoX3NpemUlM0Q2NCUyQyUwQSUyMCUyMCUyMCUyMG51bV9lcG9jaHMlM0Q1JTJDJTBBKSUwQSUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0R0cmFpbl9kYXRhc2V0JTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9kYXRhc2V0JTNEZXZhbF9kYXRhc2V0JTJDJTBBKSUwQXRyYWluZXIudHJhaW4oKSUwQSUwQW1ldHJpY3MlMjAlM0QlMjB0cmFpbmVyLmV2YWx1YXRlKCklMEFwcmludChtZXRyaWNzKQ==",highlighted:`<span class="hljs-keyword">from</span> setfit <span class="hljs-keyword">import</span> SetFitModel, TrainingArguments, Trainer

model = SetFitModel.from_pretrained(<span class="hljs-string">&quot;sentence-transformers/paraphrase-MiniLM-L3-v2&quot;</span>)

args = TrainingArguments(
    batch_size=<span class="hljs-number">64</span>,
    num_epochs=<span class="hljs-number">5</span>,
)

trainer = Trainer(
    model=model,
    args=args,
    train_dataset=train_dataset,
    eval_dataset=eval_dataset,
)
trainer.train()

metrics = trainer.evaluate()
<span class="hljs-built_in">print</span>(metrics)`,wrap:!1}}),R=new r({props:{code:" ",highlighted:`***** Running training *****
  <span class="hljs-type">Num</span> <span class="hljs-variable">examples</span> <span class="hljs-operator">=</span> <span class="hljs-number">48</span>
  <span class="hljs-type">Num</span> <span class="hljs-variable">epochs</span> <span class="hljs-operator">=</span> <span class="hljs-number">5</span>
  Total <span class="hljs-type">optimization</span> <span class="hljs-variable">steps</span> <span class="hljs-operator">=</span> <span class="hljs-number">240</span>
  Total train <span class="hljs-type">batch</span> <span class="hljs-variable">size</span> <span class="hljs-operator">=</span> <span class="hljs-number">64</span>
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.4173</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">8.333333333333333e-07</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.02</span>}                                                                                  
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.1756</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">1.7592592592592595e-05</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">1.04</span>}                                                                                 
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.119</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">1.2962962962962964e-05</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">2.08</span>}                                                                                  
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.0872</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">8.333333333333334e-06</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">3.12</span>}                                                                                  
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.0542</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">3.7037037037037037e-06</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">4.17</span>}                                                                                 
{<span class="hljs-string">&#x27;train_runtime&#x27;</span>: <span class="hljs-number">26.0837</span>, <span class="hljs-string">&#x27;train_samples_per_second&#x27;</span>: <span class="hljs-number">588.873</span>, <span class="hljs-string">&#x27;train_steps_per_second&#x27;</span>: <span class="hljs-number">9.201</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">5.0</span>}                                                     
<span class="hljs-number">100</span>%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| <span class="hljs-number">240</span>/<span class="hljs-number">240</span> [<span class="hljs-number">00</span>:<span class="hljs-number">20</span>&lt;<span class="hljs-number">00</span>:<span class="hljs-number">00</span>, <span class="hljs-number">11.</span>97it/s] 
***** Running evaluation *****
{<span class="hljs-string">&#x27;accuracy&#x27;</span>: <span class="hljs-number">0.7818421052631579</span>}`,wrap:!1}}),x=new q({props:{title:"Unlabeled Data Preparation",local:"unlabeled-data-preparation",headingTag:"h2"}}),W=new r({props:{code:"JTIzJTIwQ3JlYXRlJTIwYSUyMGRhdGFzZXQlMjBvZiUyMHVubGFiZWxlZCUyMGV4YW1wbGVzJTIwdG8lMjBwZXJmb3JtJTIwa25vd2xlZGdlJTIwZGlzdGlsbGF0aW9uJTBBdW5sYWJlbGVkX3RyYWluX2RhdGFzZXQlMjAlM0QlMjBkYXRhc2V0JTVCJTIydHJhaW4lMjIlNUQuc2h1ZmZsZShzZWVkJTNEMCkuc2VsZWN0KHJhbmdlKDUwMCkpJTBBdW5sYWJlbGVkX3RyYWluX2RhdGFzZXQlMjAlM0QlMjB1bmxhYmVsZWRfdHJhaW5fZGF0YXNldC5yZW1vdmVfY29sdW1ucyglMjJsYWJlbCUyMiklMEElMjMlMjBEYXRhc2V0KCU3QiUwQSUyMyUyMCUyMCUyMCUyMCUyMGZlYXR1cmVzJTNBJTIwJTVCJ3RleHQnJTVEJTJDJTBBJTIzJTIwJTIwJTIwJTIwJTIwbnVtX3Jvd3MlM0ElMjA1MDAlMEElMjMlMjAlN0Qp",highlighted:`<span class="hljs-comment"># Create a dataset of unlabeled examples to perform knowledge distillation</span>
unlabeled_train_dataset = dataset[<span class="hljs-string">&quot;train&quot;</span>].shuffle(seed=<span class="hljs-number">0</span>).select(<span class="hljs-built_in">range</span>(<span class="hljs-number">500</span>))
unlabeled_train_dataset = unlabeled_train_dataset.remove_columns(<span class="hljs-string">&quot;label&quot;</span>)
<span class="hljs-comment"># Dataset({</span>
<span class="hljs-comment">#     features: [&#x27;text&#x27;],</span>
<span class="hljs-comment">#     num_rows: 500</span>
<span class="hljs-comment"># })</span>`,wrap:!1}}),G=new q({props:{title:"Teacher model",local:"teacher-model",headingTag:"h2"}}),f=new r({props:{code:"ZnJvbSUyMHNldGZpdCUyMGltcG9ydCUyMFNldEZpdE1vZGVsJTBBJTBBdGVhY2hlcl9tb2RlbCUyMCUzRCUyMFNldEZpdE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJzZW50ZW5jZS10cmFuc2Zvcm1lcnMlMkZwYXJhcGhyYXNlLW1wbmV0LWJhc2UtdjIlMjIp",highlighted:`<span class="hljs-keyword">from</span> setfit <span class="hljs-keyword">import</span> SetFitModel

teacher_model = SetFitModel.from_pretrained(<span class="hljs-string">&quot;sentence-transformers/paraphrase-mpnet-base-v2&quot;</span>)`,wrap:!1}}),B=new r({props:{code:"ZnJvbSUyMHNldGZpdCUyMGltcG9ydCUyMFRyYWluaW5nQXJndW1lbnRzJTJDJTIwVHJhaW5lciUwQSUwQXRlYWNoZXJfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMGJhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMG51bV9lcG9jaHMlM0QyJTJDJTBBKSUwQSUwQXRlYWNoZXJfdHJhaW5lciUyMCUzRCUyMFRyYWluZXIoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0R0ZWFjaGVyX21vZGVsJTJDJTBBJTIwJTIwJTIwJTIwYXJncyUzRHRlYWNoZXJfYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0R0cmFpbl9kYXRhc2V0JTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9kYXRhc2V0JTNEZXZhbF9kYXRhc2V0JTJDJTBBKSUwQSUwQSUyMyUyMFRyYWluJTIwdGVhY2hlciUyMG1vZGVsJTBBdGVhY2hlcl90cmFpbmVyLnRyYWluKCklMEF0ZWFjaGVyX21ldHJpY3MlMjAlM0QlMjB0ZWFjaGVyX3RyYWluZXIuZXZhbHVhdGUoKSUwQXByaW50KHRlYWNoZXJfbWV0cmljcyk=",highlighted:`<span class="hljs-keyword">from</span> setfit <span class="hljs-keyword">import</span> TrainingArguments, Trainer

teacher_args = TrainingArguments(
    batch_size=<span class="hljs-number">16</span>,
    num_epochs=<span class="hljs-number">2</span>,
)

teacher_trainer = Trainer(
    model=teacher_model,
    args=teacher_args,
    train_dataset=train_dataset,
    eval_dataset=eval_dataset,
)

<span class="hljs-comment"># Train teacher model</span>
teacher_trainer.train()
teacher_metrics = teacher_trainer.evaluate()
<span class="hljs-built_in">print</span>(teacher_metrics)`,wrap:!1}}),X=new r({props:{code:" ",highlighted:`***** Running training *****
  <span class="hljs-type">Num</span> <span class="hljs-variable">examples</span> <span class="hljs-operator">=</span> <span class="hljs-number">192</span>
  <span class="hljs-type">Num</span> <span class="hljs-variable">epochs</span> <span class="hljs-operator">=</span> <span class="hljs-number">2</span>
  Total <span class="hljs-type">optimization</span> <span class="hljs-variable">steps</span> <span class="hljs-operator">=</span> <span class="hljs-number">384</span>
  Total train <span class="hljs-type">batch</span> <span class="hljs-variable">size</span> <span class="hljs-operator">=</span> <span class="hljs-number">16</span>
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.4093</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">5.128205128205128e-07</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.01</span>}                                                                                  
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.1087</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">1.9362318840579713e-05</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.26</span>}                                                                                 
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.001</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">1.6463768115942028e-05</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.52</span>}                                                                                  
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.0006</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">1.3565217391304348e-05</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.78</span>}                                                                                 
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.0003</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">1.0666666666666667e-05</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">1.04</span>}                                                                                 
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.0004</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">7.768115942028987e-06</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">1.3</span>}                                                                                   
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.0002</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">4.869565217391305e-06</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">1.56</span>}                                                                                  
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.0003</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">1.9710144927536233e-06</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">1.82</span>}                                                                                 
{<span class="hljs-string">&#x27;train_runtime&#x27;</span>: <span class="hljs-number">84.3703</span>, <span class="hljs-string">&#x27;train_samples_per_second&#x27;</span>: <span class="hljs-number">72.822</span>, <span class="hljs-string">&#x27;train_steps_per_second&#x27;</span>: <span class="hljs-number">4.551</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">2.0</span>}                                                      
<span class="hljs-number">100</span>%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| <span class="hljs-number">384</span>/<span class="hljs-number">384</span> [<span class="hljs-number">01</span>:<span class="hljs-number">24</span>&lt;<span class="hljs-number">00</span>:<span class="hljs-number">00</span>,  <span class="hljs-number">4.</span>55it/s] 
***** Running evaluation *****
{<span class="hljs-string">&#x27;accuracy&#x27;</span>: <span class="hljs-number">0.8378947368421052</span>}`,wrap:!1}}),E=new q({props:{title:"Knowledge Distillation",local:"knowledge-distillation",headingTag:"h2"}}),c=new nM({props:{warning:!0,$$slots:{default:[eM]},$$scope:{ctx:Ml}}}),S=new r({props:{code:"ZnJvbSUyMHNldGZpdCUyMGltcG9ydCUyMERpc3RpbGxhdGlvblRyYWluZXIlMEElMEFkaXN0aWxsYXRpb25fYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMGJhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMG1heF9zdGVwcyUzRDUwMCUyQyUwQSklMEElMEFkaXN0aWxsYXRpb25fdHJhaW5lciUyMCUzRCUyMERpc3RpbGxhdGlvblRyYWluZXIoJTBBJTIwJTIwJTIwJTIwdGVhY2hlcl9tb2RlbCUzRHRlYWNoZXJfbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBzdHVkZW50X21vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEZGlzdGlsbGF0aW9uX2FyZ3MlMkMlMEElMjAlMjAlMjAlMjB0cmFpbl9kYXRhc2V0JTNEdW5sYWJlbGVkX3RyYWluX2RhdGFzZXQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0RldmFsX2RhdGFzZXQlMkMlMEEpJTBBJTIzJTIwVHJhaW4lMjBzdHVkZW50JTIwd2l0aCUyMGtub3dsZWRnZSUyMGRpc3RpbGxhdGlvbiUwQWRpc3RpbGxhdGlvbl90cmFpbmVyLnRyYWluKCklMEFkaXN0aWxsYXRpb25fbWV0cmljcyUyMCUzRCUyMGRpc3RpbGxhdGlvbl90cmFpbmVyLmV2YWx1YXRlKCklMEFwcmludChkaXN0aWxsYXRpb25fbWV0cmljcyk=",highlighted:`<span class="hljs-keyword">from</span> setfit <span class="hljs-keyword">import</span> DistillationTrainer

distillation_args = TrainingArguments(
    batch_size=<span class="hljs-number">16</span>,
    max_steps=<span class="hljs-number">500</span>,
)

distillation_trainer = DistillationTrainer(
    teacher_model=teacher_model,
    student_model=model,
    args=distillation_args,
    train_dataset=unlabeled_train_dataset,
    eval_dataset=eval_dataset,
)
<span class="hljs-comment"># Train student with knowledge distillation</span>
distillation_trainer.train()
distillation_metrics = distillation_trainer.evaluate()
<span class="hljs-built_in">print</span>(distillation_metrics)`,wrap:!1}}),k=new r({props:{code:" ",highlighted:`***** Running training *****
  Num examples = <span class="hljs-number">7829</span>
  Num epochs = <span class="hljs-number">1</span>
  Total optimization steps = <span class="hljs-number">7829</span>
  Total train batch size = <span class="hljs-number">16</span>
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.5048</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">2.554278416347382e-08</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.0</span>}                                                                                   
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.4514</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">1.277139208173691e-06</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.01</span>}                                                                                  
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.33</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">2.554278416347382e-06</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.01</span>}                                                                                    
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.1218</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">3.831417624521073e-06</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.02</span>}                                                                                  
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.0213</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">5.108556832694764e-06</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.03</span>}                                                                                  
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.016</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">6.385696040868455e-06</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.03</span>}                                                                                   
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.0054</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">7.662835249042147e-06</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.04</span>}                                                                                  
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.0049</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">8.939974457215838e-06</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.04</span>}                                                                                  
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.002</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">1.0217113665389528e-05</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.05</span>}                                                                                  
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.0019</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">1.1494252873563218e-05</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.06</span>}                                                                                 
{<span class="hljs-string">&#x27;embedding_loss&#x27;</span>: <span class="hljs-number">0.0012</span>, <span class="hljs-string">&#x27;learning_rate&#x27;</span>: <span class="hljs-number">1.277139208173691e-05</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.06</span>}                                                                                  
{<span class="hljs-string">&#x27;train_runtime&#x27;</span>: <span class="hljs-number">22.2725</span>, <span class="hljs-string">&#x27;train_samples_per_second&#x27;</span>: <span class="hljs-number">359.188</span>, <span class="hljs-string">&#x27;train_steps_per_second&#x27;</span>: <span class="hljs-number">22.449</span>, <span class="hljs-string">&#x27;epoch&#x27;</span>: <span class="hljs-number">0.06</span>}                                                   
<span class="hljs-number">100</span>%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| <span class="hljs-number">500</span>/<span class="hljs-number">500</span> [<span class="hljs-number">00</span>:<span class="hljs-number">22</span>&lt;<span class="hljs-number">00</span>:<span class="hljs-number">00</span>, <span class="hljs-number">22.45</span>it/s] 
***** Running evaluation *****
{<span class="hljs-string">&#x27;accuracy&#x27;</span>: <span class="hljs-number">0.8084210526315789</span>}`,wrap:!1}}),v=new q({props:{title:"End-to-end",local:"end-to-end",headingTag:"h2"}}),L=new r({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0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TIwRGlzdGlsbGF0aW9uVHJhaW5lciUwQSUwQWRpc3RpbGxhdGlvbl9hcmdzJTIwJTNEJTIwVHJhaW5pbmdBcmd1bWVudHMoJTBBJTIwJTIwJTIwJTIwYmF0Y2hfc2l6ZSUzRDE2JTJDJTBBJTIwJTIwJTIwJTIwbWF4X3N0ZXBzJTNENTAwJTJDJTBBKSUwQSUwQWRpc3RpbGxhdGlvbl90cmFpbmVyJTIwJTNEJTIwRGlzdGlsbGF0aW9uVHJhaW5lciglMEElMjAlMjAlMjAlMjB0ZWFjaGVyX21vZGVsJTNEdGVhY2hlcl9tb2RlbCUyQyUwQSUyMCUyMCUyMCUyMHN0dWRlbnRfbW9kZWwlM0Rtb2RlbCUyQyUwQSUyMCUyMCUyMCUyMGFyZ3MlM0RkaXN0aWxsYXRpb25fYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0R1bmxhYmVsZWRfdHJhaW5fZGF0YXNldCUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfZGF0YXNldCUzRGV2YWxfZGF0YXNldCUyQyUwQSklMEElMjMlMjBUcmFpbiUyMHN0dWRlbnQlMjB3aXRoJTIwa25vd2xlZGdlJTIwZGlzdGlsbGF0aW9uJTBBZGlzdGlsbGF0aW9uX3RyYWluZXIudHJhaW4oKSUwQWRpc3RpbGxhdGlvbl9tZXRyaWNzJTIwJTNEJTIwZGlzdGlsbGF0aW9uX3RyYWluZXIuZXZhbHVhdGUoKSUwQXByaW50KGRpc3RpbGxhdGlvbl9tZXRyaWNzKQ==",highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-keyword">from</span> setfit <span class="hljs-keyword">import</span> sample_dataset

<span class="hljs-comment"># Load a dataset from the Hugging Face Hub</span>
dataset = load_dataset(<span class="hljs-string">&quot;ag_news&quot;</span>)

<span class="hljs-comment"># Create a sample few-shot dataset to train with</span>
train_dataset = sample_dataset(dataset[<span class="hljs-string">&quot;train&quot;</span>], label_column=<span class="hljs-string">&quot;label&quot;</span>, num_samples=<span class="hljs-number">16</span>)
<span class="hljs-comment"># Dataset({</span>
<span class="hljs-comment">#     features: [&#x27;text&#x27;, &#x27;label&#x27;],</span>
<span class="hljs-comment">#     num_rows: 64</span>
<span class="hljs-comment"># })</span>

<span class="hljs-comment"># Dataset for evaluation</span>
eval_dataset = dataset[<span class="hljs-string">&quot;test&quot;</span>]
<span class="hljs-comment"># Dataset({</span>
<span class="hljs-comment">#     features: [&#x27;text&#x27;, &#x27;label&#x27;],</span>
<span class="hljs-comment">#     num_rows: 7600</span>
<span class="hljs-comment"># })</span>

<span class="hljs-keyword">from</span> setfit <span class="hljs-keyword">import</span> SetFitModel, TrainingArguments, Trainer

model = SetFitModel.from_pretrained(<span class="hljs-string">&quot;sentence-transformers/paraphrase-MiniLM-L3-v2&quot;</span>)

args = TrainingArguments(
    batch_size=<span class="hljs-number">64</span>,
    num_epochs=<span class="hljs-number">5</span>,
)

trainer = Trainer(
    model=model,
    args=args,
    train_dataset=train_dataset,
    eval_dataset=eval_dataset,
)
trainer.train()

metrics = trainer.evaluate()
<span class="hljs-built_in">print</span>(metrics)

<span class="hljs-comment"># Create a dataset of unlabeled examples to perform knowledge distillation</span>
unlabeled_train_dataset = dataset[<span class="hljs-string">&quot;train&quot;</span>].shuffle(seed=<span class="hljs-number">0</span>).select(<span class="hljs-built_in">range</span>(<span class="hljs-number">500</span>))
unlabeled_train_dataset = unlabeled_train_dataset.remove_columns(<span class="hljs-string">&quot;label&quot;</span>)
<span class="hljs-comment"># Dataset({</span>
<span class="hljs-comment">#     features: [&#x27;text&#x27;],</span>
<span class="hljs-comment">#     num_rows: 500</span>
<span class="hljs-comment"># })</span>

<span class="hljs-keyword">from</span> setfit <span class="hljs-keyword">import</span> SetFitModel

teacher_model = SetFitModel.from_pretrained(<span class="hljs-string">&quot;sentence-transformers/paraphrase-mpnet-base-v2&quot;</span>)

<span class="hljs-keyword">from</span> setfit <span class="hljs-keyword">import</span> TrainingArguments, Trainer

teacher_args = TrainingArguments(
    batch_size=<span class="hljs-number">16</span>,
    num_epochs=<span class="hljs-number">2</span>,
)

teacher_trainer = Trainer(
    model=teacher_model,
    args=teacher_args,
    train_dataset=train_dataset,
    eval_dataset=eval_dataset,
)

<span class="hljs-comment"># Train teacher model</span>
teacher_trainer.train()
teacher_metrics = teacher_trainer.evaluate()
<span class="hljs-built_in">print</span>(teacher_metrics)

<span class="hljs-keyword">from</span> setfit <span class="hljs-keyword">import</span> DistillationTrainer

distillation_args = TrainingArguments(
    batch_size=<span class="hljs-number">16</span>,
    max_steps=<span class="hljs-number">500</span>,
)

distillation_trainer = DistillationTrainer(
    teacher_model=teacher_model,
    student_model=model,
    args=distillation_args,
    train_dataset=unlabeled_train_dataset,
    eval_dataset=eval_dataset,
)
<span class="hljs-comment"># Train student with knowledge distillation</span>
distillation_trainer.train()
distillation_metrics = distillation_trainer.evaluate()
<span class="hljs-built_in">print</span>(distillation_metrics)`,wrap:!1}}),K=new yM({props:{source:"https://github.com/huggingface/setfit/blob/main/docs/source/en/how_to/knowledge_distillation.mdx"}}),{c(){i=w("meta"),m=a(),p=w("p"),P=a(),T(A.$$.fragment),sl=a(),T(h.$$.fragment),Ul=a(),d=w("p"),d.textContent=Gl,al=a(),b=w("p"),b.textContent=Dl,nl=a(),o=w("p"),o.textContent=fl,Tl=a(),T(N.$$.fragment),yl=a(),O=w("p"),O.innerHTML=Ql,el=a(),T(u.$$.fragment),Cl=a(),T(g.$$.fragment),Jl=a(),V=w("p"),V.textContent=Bl,tl=a(),T(F.$$.fragment),il=a(),T(R.$$.fragment),wl=a(),Y=w("p"),Y.textContent=Xl,jl=a(),T(x.$$.fragment),Il=a(),Z=w("p"),Z.textContent=zl,pl=a(),T(W.$$.fragment),rl=a(),T(G.$$.fragment),cl=a(),D=w("p"),D.innerHTML=El,ml=a(),T(f.$$.fragment),Al=a(),Q=w("p"),Q.textContent=_l,hl=a(),T(B.$$.fragment),dl=a(),T(X.$$.fragment),bl=a(),z=w("p"),z.textContent=Sl,ol=a(),T(E.$$.fragment),Nl=a(),_=w("p"),_.innerHTML=kl,Ol=a(),T(c.$$.fragment),ul=a(),T(S.$$.fragment),gl=a(),T(k.$$.fragment),Vl=a(),$=w("p"),$.textContent=$l,Fl=a(),T(v.$$.fragment),Rl=a(),H=w("p"),H.textContent=vl,Yl=a(),T(L.$$.fragment),xl=a(),T(K.$$.fragment),Zl=a(),ll=w("p"),this.h()},l(l){const M=UM("svelte-u9bgzb",document.head);i=j(M,"META",{name:!0,content:!0}),M.forEach(s),m=n(l),p=j(l,"P",{}),Ll(p).forEach(s),P=n(l),y(A.$$.fragment,l),sl=n(l),y(h.$$.fragment,l),Ul=n(l),d=j(l,"P",{"data-svelte-h":!0}),I(d)!=="svelte-1iaeqif"&&(d.textContent=Gl),al=n(l),b=j(l,"P",{"data-svelte-h":!0}),I(b)!=="svelte-19socj4"&&(b.textContent=Dl),nl=n(l),o=j(l,"P",{"data-svelte-h":!0}),I(o)!=="svelte-1dkdhtd"&&(o.textContent=fl),Tl=n(l),y(N.$$.fragment,l),yl=n(l),O=j(l,"P",{"data-svelte-h":!0}),I(O)!=="svelte-1ggqf13"&&(O.innerHTML=Ql),el=n(l),y(u.$$.fragment,l),Cl=n(l),y(g.$$.fragment,l),Jl=n(l),V=j(l,"P",{"data-svelte-h":!0}),I(V)!=="svelte-1avn12v"&&(V.textContent=Bl),tl=n(l),y(F.$$.fragment,l),il=n(l),y(R.$$.fragment,l),wl=n(l),Y=j(l,"P",{"data-svelte-h":!0}),I(Y)!=="svelte-ewavsy"&&(Y.textContent=Xl),jl=n(l),y(x.$$.fragment,l),Il=n(l),Z=j(l,"P",{"data-svelte-h":!0}),I(Z)!=="svelte-lgbx2q"&&(Z.textContent=zl),pl=n(l),y(W.$$.fragment,l),rl=n(l),y(G.$$.fragment,l),cl=n(l),D=j(l,"P",{"data-svelte-h":!0}),I(D)!=="svelte-1yw0yn"&&(D.innerHTML=El),ml=n(l),y(f.$$.fragment,l),Al=n(l),Q=j(l,"P",{"data-svelte-h":!0}),I(Q)!=="svelte-1t1w4v"&&(Q.textContent=_l),hl=n(l),y(B.$$.fragment,l),dl=n(l),y(X.$$.fragment,l),bl=n(l),z=j(l,"P",{"data-svelte-h":!0}),I(z)!=="svelte-1tfc559"&&(z.textContent=Sl),ol=n(l),y(E.$$.fragment,l),Nl=n(l),_=j(l,"P",{"data-svelte-h":!0}),I(_)!=="svelte-1wo7ga1"&&(_.innerHTML=kl),Ol=n(l),y(c.$$.fragment,l),ul=n(l),y(S.$$.fragment,l),gl=n(l),y(k.$$.fragment,l),Vl=n(l),$=j(l,"P",{"data-svelte-h":!0}),I($)!=="svelte-1mlr23c"&&($.textContent=$l),Fl=n(l),y(v.$$.fragment,l),Rl=n(l),H=j(l,"P",{"data-svelte-h":!0}),I(H)!=="svelte-jbt54l"&&(H.textContent=vl),Yl=n(l),y(L.$$.fragment,l),xl=n(l),y(K.$$.fragment,l),Zl=n(l),ll=j(l,"P",{}),Ll(ll).forEach(s),this.h()},h(){Kl(i,"name","hf:doc:metadata"),Kl(i,"content",JM)},m(l,M){aM(document.head,i),U(l,m,M),U(l,p,M),U(l,P,M),e(A,l,M),U(l,sl,M),e(h,l,M),U(l,Ul,M),U(l,d,M),U(l,al,M),U(l,b,M),U(l,nl,M),U(l,o,M),U(l,Tl,M),e(N,l,M),U(l,yl,M),U(l,O,M),U(l,el,M),e(u,l,M),U(l,Cl,M),e(g,l,M),U(l,Jl,M),U(l,V,M),U(l,tl,M),e(F,l,M),U(l,il,M),e(R,l,M),U(l,wl,M),U(l,Y,M),U(l,jl,M),e(x,l,M),U(l,Il,M),U(l,Z,M),U(l,pl,M),e(W,l,M),U(l,rl,M),e(G,l,M),U(l,cl,M),U(l,D,M),U(l,ml,M),e(f,l,M),U(l,Al,M),U(l,Q,M),U(l,hl,M),e(B,l,M),U(l,dl,M),e(X,l,M),U(l,bl,M),U(l,z,M),U(l,ol,M),e(E,l,M),U(l,Nl,M),U(l,_,M),U(l,Ol,M),e(c,l,M),U(l,ul,M),e(S,l,M),U(l,gl,M),e(k,l,M),U(l,Vl,M),U(l,$,M),U(l,Fl,M),e(v,l,M),U(l,Rl,M),U(l,H,M),U(l,Yl,M),e(L,l,M),U(l,xl,M),e(K,l,M),U(l,Zl,M),U(l,ll,M),Wl=!0},p(l,[M]){const Hl={};M&2&&(Hl.$$scope={dirty:M,ctx:l}),c.$set(Hl)},i(l){Wl||(C(A.$$.fragment,l),C(h.$$.fragment,l),C(N.$$.fragment,l),C(u.$$.fragment,l),C(g.$$.fragment,l),C(F.$$.fragment,l),C(R.$$.fragment,l),C(x.$$.fragment,l),C(W.$$.fragment,l),C(G.$$.fragment,l),C(f.$$.fragment,l),C(B.$$.fragment,l),C(X.$$.fragment,l),C(E.$$.fragment,l),C(c.$$.fragment,l),C(S.$$.fragment,l),C(k.$$.fragment,l),C(v.$$.fragment,l),C(L.$$.fragment,l),C(K.$$.fragment,l),Wl=!0)},o(l){J(A.$$.fragment,l),J(h.$$.fragment,l),J(N.$$.fragment,l),J(u.$$.fragment,l),J(g.$$.fragment,l),J(F.$$.fragment,l),J(R.$$.fragment,l),J(x.$$.fragment,l),J(W.$$.fragment,l),J(G.$$.fragment,l),J(f.$$.fragment,l),J(B.$$.fragment,l),J(X.$$.fragment,l),J(E.$$.fragment,l),J(c.$$.fragment,l),J(S.$$.fragment,l),J(k.$$.fragment,l),J(v.$$.fragment,l),J(L.$$.fragment,l),J(K.$$.fragment,l),Wl=!1},d(l){l&&(s(m),s(p),s(P),s(sl),s(Ul),s(d),s(al),s(b),s(nl),s(o),s(Tl),s(yl),s(O),s(el),s(Cl),s(Jl),s(V),s(tl),s(il),s(wl),s(Y),s(jl),s(Il),s(Z),s(pl),s(rl),s(cl),s(D),s(ml),s(Al),s(Q),s(hl),s(dl),s(bl),s(z),s(ol),s(Nl),s(_),s(Ol),s(ul),s(gl),s(Vl),s($),s(Fl),s(Rl),s(H),s(Yl),s(xl),s(Zl),s(ll)),s(i),t(A,l),t(h,l),t(N,l),t(u,l),t(g,l),t(F,l),t(R,l),t(x,l),t(W,l),t(G,l),t(f,l),t(B,l),t(X,l),t(E,l),t(c,l),t(S,l),t(k,l),t(v,l),t(L,l),t(K,l)}}}const JM='{"title":"Knowledge Distillation","local":"knowledge-distillation","sections":[{"title":"Data preparation","local":"data-preparation","sections":[],"depth":2},{"title":"Baseline model","local":"baseline-model","sections":[],"depth":2},{"title":"Unlabeled Data Preparation","local":"unlabeled-data-preparation","sections":[],"depth":2},{"title":"Teacher model","local":"teacher-model","sections":[],"depth":2},{"title":"Knowledge Distillation","local":"knowledge-distillation","sections":[],"depth":2},{"title":"End-to-end","local":"end-to-end","sections":[],"depth":2}],"depth":1}';function tM(Ml){return Pl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class rM extends MM{constructor(i){super(),sM(this,i,tM,CM,ql,{})}}export{rM as component};
