import{s as yn,n as vn,o as Un}from"../chunks/scheduler.56730f09.js";import{S as Tn,i as wn,g as a,s as o,u,A as xn,h as s,f as t,c as i,j as h,v as c,y as r,k as p,o as m,a as n,w as d,d as g,t as f,x as M}from"../chunks/index.ba464511.js";import{I as V}from"../chunks/IconCopyLink.89bde88e.js";import{C as b}from"../chunks/CodeBlock.2302fd0d.js";import{D as kn}from"../chunks/DocNotebookDropdown.68fd8653.js";function $n(fl){let J,Ke,Ae,et,y,j,Ne,G,rl,Xe,Ml="다국어 모델 추론하기",tt,Q,lt,L,bl=`🤗 Transformers에는 여러 종류의 다국어(multilingual) 모델이 있으며, 단일 언어(monolingual) 모델과 추론 시 사용법이 다릅니다.
그렇다고 해서 <em>모든</em> 다국어 모델의 사용법이 다른 것은 아닙니다.`,nt,W,Jl=`<a href="https://huggingface.co/bert-base-multilingual-uncased" rel="nofollow">bert-base-multilingual-uncased</a>와 같은 몇몇 모델은 단일 언어 모델처럼 사용할 수 있습니다.
이번 가이드에서 다국어 모델의 추론 시 사용 방법을 알아볼 것입니다.`,at,v,C,qe,B,pl,Ve,yl="XLM",st,H,vl=`XLM에는 10가지 체크포인트(checkpoint)가 있는데, 이 중 하나만 단일 언어입니다.
나머지 체크포인트 9개는 언어 임베딩을 사용하는 체크포인트와 그렇지 않은 체크포인트의 두 가지 범주로 나눌 수 있습니다.`,ot,U,_,ze,A,ml,Ge,Ul="언어 임베딩을 사용하는 XLM",it,N,Tl="다음 XLM 모델은 추론 시에 언어 임베딩을 사용합니다:",rt,q,wl="<li><code>xlm-mlm-ende-1024</code> (마스킹된 언어 모델링, 영어-독일어)</li> <li><code>xlm-mlm-enfr-1024</code> (마스킹된 언어 모델링, 영어-프랑스어)</li> <li><code>xlm-mlm-enro-1024</code> (마스킹된 언어 모델링, 영어-루마니아어)</li> <li><code>xlm-mlm-xnli15-1024</code> (마스킹된 언어 모델링, XNLI 데이터 세트에서 제공하는 15개 국어)</li> <li><code>xlm-mlm-tlm-xnli15-1024</code> (마스킹된 언어 모델링 + 번역, XNLI 데이터 세트에서 제공하는 15개 국어)</li> <li><code>xlm-clm-enfr-1024</code> (Causal language modeling, 영어-프랑스어)</li> <li><code>xlm-clm-ende-1024</code> (Causal language modeling, 영어-독일어)</li>",pt,z,xl=`언어 임베딩은 모델에 전달된 <code>input_ids</code>와 동일한 shape의 텐서로 표현됩니다.
이러한 텐서의 값은 사용된 언어에 따라 다르며 토크나이저의 <code>lang2id</code> 및 <code>id2lang</code> 속성에 의해 식별됩니다.`,mt,F,kl="다음 예제에서는 <code>xlm-clm-enfr-1024</code> 체크포인트(코잘 언어 모델링(causal language modeling), 영어-프랑스어)를 가져옵니다:",ht,P,ut,S,$l="토크나이저의 <code>lang2id</code> 속성은 모델의 언어와 해당 ID를 표시합니다:",ct,Y,dt,D,jl="다음으로, 예제 입력을 만듭니다:",gt,O,ft,K,Cl=`언어 ID를 <code>&quot;en&quot;</code>으로 설정해 언어 임베딩을 정의합니다.
언어 임베딩은 영어의 언어 ID인 <code>0</code>으로 채워진 텐서입니다.
이 텐서는 <code>input_ids</code>와 같은 크기여야 합니다.`,Mt,ee,bt,te,_l="이제 <code>input_ids</code>와 언어 임베딩을 모델로 전달합니다:",Jt,le,yt,ne,Il='<a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-generation/run_generation.py" rel="nofollow">run_generation.py</a> 스크립트로 <code>xlm-clm</code> 체크포인트를 사용해 텍스트와 언어 임베딩을 생성할 수 있습니다.',vt,T,I,Fe,ae,hl,Qe,Zl="언어 임베딩을 사용하지 않는 XLM",Ut,se,Rl="다음 XLM 모델은 추론 시에 언어 임베딩이 필요하지 않습니다:",Tt,oe,El="<li><code>xlm-mlm-17-1280</code> (마스킹된 언어 모델링, 17개 국어)</li> <li><code>xlm-mlm-100-1280</code> (마스킹된 언어 모델링, 100개 국어)</li>",wt,ie,Xl="이전의 XLM 체크포인트와 달리 이 모델은 일반 문장 표현에 사용됩니다.",xt,w,Z,Pe,re,ul,Le,Vl="BERT",kt,pe,Gl="다음 BERT 모델은 다국어 태스크에 사용할 수 있습니다:",$t,me,Ql="<li><code>bert-base-multilingual-uncased</code> (마스킹된 언어 모델링 + 다음 문장 예측, 102개 국어)</li> <li><code>bert-base-multilingual-cased</code> (마스킹된 언어 모델링 + 다음 문장 예측, 104개 국어)</li>",jt,he,Ll=`이러한 모델은 추론 시에 언어 임베딩이 필요하지 않습니다.
문맥에서 언어를 식별하고, 식별된 언어로 추론합니다.`,Ct,x,R,Se,ue,cl,We,Wl="XLM-RoBERTa",_t,ce,Bl="다음 XLM-RoBERTa 또한 다국어 다국어 태스크에 사용할 수 있습니다:",It,de,Hl="<li><code>xlm-roberta-base</code> (마스킹된 언어 모델링, 100개 국어)</li> <li><code>xlm-roberta-large</code> (마스킹된 언어 모델링, 100개 국어)</li>",Zt,ge,Al=`XLM-RoBERTa는 100개 국어에 대해 새로 생성되고 정제된 2.5TB 규모의 CommonCrawl 데이터로 학습되었습니다.
이전에 공개된 mBERT나 XLM과 같은 다국어 모델에 비해 분류, 시퀀스 라벨링, 질의 응답과 같은 다운스트림(downstream) 작업에서 이점이 있습니다.`,Rt,k,E,Ye,fe,dl,Be,Nl="M2M100",Et,Me,ql="다음 M2M100 모델 또한 다국어 다국어 태스크에 사용할 수 있습니다:",Xt,be,zl="<li><code>facebook/m2m100_418M</code> (번역)</li> <li><code>facebook/m2m100_1.2B</code> (번역)</li>",Vt,Je,Fl=`이 예제에서는 <code>facebook/m2m100_418M</code> 체크포인트를 가져와서 중국어를 영어로 번역합니다.
토크나이저에서 번역 대상 언어(source language)를 설정할 수 있습니다:`,Gt,ye,Qt,ve,Pl="문장을 토큰화합니다:",Lt,Ue,Wt,Te,Sl=`M2M100은 번역을 진행하기 위해 첫 번째로 생성되는 토큰은 번역할 언어(target language) ID로 강제 지정합니다.
영어로 번역하기 위해 <code>generate</code> 메소드에서 <code>forced_bos_token_id</code>를 <code>en</code>으로 설정합니다:`,Bt,we,Ht,$,X,De,xe,gl,He,Yl="MBart",At,ke,Dl="다음 MBart 모델 또한 다국어 태스크에 사용할 수 있습니다:",Nt,$e,Ol="<li><code>facebook/mbart-large-50-one-to-many-mmt</code> (일대다 다국어 번역, 50개 국어)</li> <li><code>facebook/mbart-large-50-many-to-many-mmt</code> (다대다 다국어 번역, 50개 국어)</li> <li><code>facebook/mbart-large-50-many-to-one-mmt</code> (다대일 다국어 번역, 50개 국어)</li> <li><code>facebook/mbart-large-50</code> (다국어 번역, 50개 국어)</li> <li><code>facebook/mbart-large-cc25</code></li>",qt,je,Kl=`이 예제에서는 핀란드어를 영어로 번역하기 위해 <code>facebook/mbart-large-50-many-to-many-mmt</code> 체크포인트를 가져옵니다.
토크나이저에서 번역 대상 언어(source language)를 설정할 수 있습니다:`,zt,Ce,Ft,_e,en="문장을 토큰화합니다:",Pt,Ie,St,Ze,tn=`MBart는 번역을 진행하기 위해 첫 번째로 생성되는 토큰은 번역할 언어(target language) ID로 강제 지정합니다.
영어로 번역하기 위해 <code>generate</code> 메소드에서 <code>forced_bos_token_id</code>를 <code>en</code>으로 설정합니다:`,Yt,Re,Dt,Ee,ln="<code>facebook/mbart-large-50-many-to-one-mmt</code> 체크포인트를 사용하고 있다면, 첫 번째로 생성되는 토큰을 번역할 언어(target language) ID로 강제 지정할 필요는 없습니다.",Ot,Oe,Kt;return G=new V({}),Q=new kn({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/multilingual.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/multilingual.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/multilingual.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/multilingual.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/multilingual.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/multilingual.ipynb"}]}}),B=new V({}),A=new V({}),P=new b({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwWExNVG9rZW5pemVyJTJDJTIwWExNV2l0aExNSGVhZE1vZGVsJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwWExNVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJ4bG0tY2xtLWVuZnItMTAyNCUyMiklMEFtb2RlbCUyMCUzRCUyMFhMTVdpdGhMTUhlYWRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyeGxtLWNsbS1lbmZyLTEwMjQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> XLMTokenizer, XLMWithLMHeadModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = XLMTokenizer.from_pretrained(<span class="hljs-string">&quot;xlm-clm-enfr-1024&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = XLMWithLMHeadModel.from_pretrained(<span class="hljs-string">&quot;xlm-clm-enfr-1024&quot;</span>)`,wrap:!1}}),Y=new b({props:{code:"cHJpbnQodG9rZW5pemVyLmxhbmcyaWQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.lang2id)
{<span class="hljs-string">&#x27;en&#x27;</span>: <span class="hljs-number">0</span>, <span class="hljs-string">&#x27;fr&#x27;</span>: <span class="hljs-number">1</span>}`,wrap:!1}}),O=new b({props:{code:"aW5wdXRfaWRzJTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QnRva2VuaXplci5lbmNvZGUoJTIyV2lraXBlZGlhJTIwd2FzJTIwdXNlZCUyMHRvJTIyKSU1RCklMjAlMjAlMjMlMjAlRUIlQjAlQjAlRUMlQjklOTglMjAlRUQlODElQUMlRUElQjglQjAlRUIlOEElOTQlMjAxJUVDJTlFJTg1JUVCJThCJTg4JUVCJThCJUE0",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = torch.tensor([tokenizer.encode(<span class="hljs-string">&quot;Wikipedia was used to&quot;</span>)])  <span class="hljs-comment"># 배치 크기는 1입니다</span>',wrap:!1}}),ee=new b({props:{code:"bGFuZ3VhZ2VfaWQlMjAlM0QlMjB0b2tlbml6ZXIubGFuZzJpZCU1QiUyMmVuJTIyJTVEJTIwJTIwJTIzJTIwMCUwQWxhbmdzJTIwJTNEJTIwdG9yY2gudGVuc29yKCU1Qmxhbmd1YWdlX2lkJTVEJTIwKiUyMGlucHV0X2lkcy5zaGFwZSU1QjElNUQpJTIwJTIwJTIzJTIwdG9yY2gudGVuc29yKCU1QjAlMkMlMjAwJTJDJTIwMCUyQyUyMC4uLiUyQyUyMDAlNUQpJTBBJTBBJTIzJTIwKGJhdGNoX3NpemUlMkMlMjBzZXF1ZW5jZV9sZW5ndGgpJTIwc2hhcGUlRUMlOUQlOTglMjAlRUQlODUlOTAlRUMlODQlOUMlRUElQjAlODAlMjAlRUIlOTAlOTglRUIlOEYlODQlRUIlQTElOUQlMjAlRUIlQTclOEMlRUIlOTMlQUQlRUIlOEIlODglRUIlOEIlQTQuJTBBbGFuZ3MlMjAlM0QlMjBsYW5ncy52aWV3KDElMkMlMjAtMSklMjAlMjAlMjMlMjAlRUMlOUQlQjQlRUMlQTAlOUMlMjAlNUIxJTJDJTIwc2VxdWVuY2VfbGVuZ3RoJTVEJTIwc2hhcGUlRUMlOUQlQjQlMjAlRUIlOTAlOTglRUMlOTclODglRUMlOEElQjUlRUIlOEIlODglRUIlOEIlQTQoJUVCJUIwJUIwJUVDJUI5JTk4JTIwJUVEJTgxJUFDJUVBJUI4JUIwJUVCJThBJTk0JTIwMSVFQyU5RSU4NSVFQiU4QiU4OCVFQiU4QiVBNCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>language_id = tokenizer.lang2id[<span class="hljs-string">&quot;en&quot;</span>]  <span class="hljs-comment"># 0</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>langs = torch.tensor([language_id] * input_ids.shape[<span class="hljs-number">1</span>])  <span class="hljs-comment"># torch.tensor([0, 0, 0, ..., 0])</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># (batch_size, sequence_length) shape의 텐서가 되도록 만듭니다.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>langs = langs.view(<span class="hljs-number">1</span>, -<span class="hljs-number">1</span>)  <span class="hljs-comment"># 이제 [1, sequence_length] shape이 되었습니다(배치 크기는 1입니다)</span>`,wrap:!1}}),le=new b({props:{code:"b3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0X2lkcyUyQyUyMGxhbmdzJTNEbGFuZ3Mp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids, langs=langs)',wrap:!1}}),ae=new V({}),re=new V({}),ue=new V({}),fe=new V({}),ye=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME0yTTEwMEZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUyQyUyME0yTTEwMFRva2VuaXplciUwQSUwQWVuX3RleHQlMjAlM0QlMjAlMjJEbyUyMG5vdCUyMG1lZGRsZSUyMGluJTIwdGhlJTIwYWZmYWlycyUyMG9mJTIwd2l6YXJkcyUyQyUyMGZvciUyMHRoZXklMjBhcmUlMjBzdWJ0bGUlMjBhbmQlMjBxdWljayUyMHRvJTIwYW5nZXIuJTIyJTBBY2hpbmVzZV90ZXh0JTIwJTNEJTIwJTIyJUU0JUI4JThEJUU4JUE2JTgxJUU2JThGJTkyJUU2JTg5JThCJUU1JUI3JUFCJUU1JUI4JUFCJUU3JTlBJTg0JUU0JUJBJThCJUU1JThCJTk5JTJDJTIwJUU1JTlCJUEwJUU3JTgyJUJBJUU0JUJCJTk2JUU1JTgwJTkxJUU2JTk4JUFGJUU1JUJFJUFFJUU1JUE2JTk5JUU3JTlBJTg0JTJDJTIwJUU1JUJFJTg4JUU1JUJGJUFCJUU1JUIwJUIxJUU2JTlDJTgzJUU3JTk5JUJDJUU2JTgwJTkyLiUyMiUwQSUwQXRva2VuaXplciUyMCUzRCUyME0yTTEwMFRva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZtMm0xMDBfNDE4TSUyMiUyQyUyMHNyY19sYW5nJTNEJTIyemglMjIpJTBBbW9kZWwlMjAlM0QlMjBNMk0xMDBGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGbTJtMTAwXzQxOE0lMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> M2M100ForConditionalGeneration, M2M100Tokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>en_text = <span class="hljs-string">&quot;Do not meddle in the affairs of wizards, for they are subtle and quick to anger.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>chinese_text = <span class="hljs-string">&quot;不要插手巫師的事務, 因為他們是微妙的, 很快就會發怒.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = M2M100Tokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/m2m100_418M&quot;</span>, src_lang=<span class="hljs-string">&quot;zh&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = M2M100ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;facebook/m2m100_418M&quot;</span>)`,wrap:!1}}),Ue=new b({props:{code:"ZW5jb2RlZF96aCUyMCUzRCUyMHRva2VuaXplcihjaGluZXNlX3RleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_zh = tokenizer(chinese_text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)',wrap:!1}}),we=new b({props:{code:"Z2VuZXJhdGVkX3Rva2VucyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqZW5jb2RlZF96aCUyQyUyMGZvcmNlZF9ib3NfdG9rZW5faWQlM0R0b2tlbml6ZXIuZ2V0X2xhbmdfaWQoJTIyZW4lMjIpKSUwQXRva2VuaXplci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVkX3Rva2VucyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>generated_tokens = model.generate(**encoded_zh, forced_bos_token_id=tokenizer.get_lang_id(<span class="hljs-string">&quot;en&quot;</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generated_tokens, skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&#x27;Do not interfere with the matters of the witches, because they are delicate and will soon be angry.&#x27;</span>`,wrap:!1}}),xe=new V({}),Ce=new b({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JTZXEyU2VxTE0lMEElMEFlbl90ZXh0JTIwJTNEJTIwJTIyRG8lMjBub3QlMjBtZWRkbGUlMjBpbiUyMHRoZSUyMGFmZmFpcnMlMjBvZiUyMHdpemFyZHMlMkMlMjBmb3IlMjB0aGV5JTIwYXJlJTIwc3VidGxlJTIwYW5kJTIwcXVpY2slMjB0byUyMGFuZ2VyLiUyMiUwQWZpX3RleHQlMjAlM0QlMjAlMjIlQzMlODRsJUMzJUE0JTIwc2VrYWFubnUlMjB2ZWxob2plbiUyMGFzaW9paGluJTJDJTIwc2lsbCVDMyVBNCUyMG5lJTIwb3ZhdCUyMGhpZW5vdmFyYWlzaWElMjBqYSUyMG5vcGVhc3RpJTIwdmloYWlzaWEuJTIyJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZtYmFydC1sYXJnZS01MC1tYW55LXRvLW1hbnktbW10JTIyJTJDJTIwc3JjX2xhbmclM0QlMjJmaV9GSSUyMiklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTS5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZtYmFydC1sYXJnZS01MC1tYW55LXRvLW1hbnktbW10JTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForSeq2SeqLM

<span class="hljs-meta">&gt;&gt;&gt; </span>en_text = <span class="hljs-string">&quot;Do not meddle in the affairs of wizards, for they are subtle and quick to anger.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>fi_text = <span class="hljs-string">&quot;Älä sekaannu velhojen asioihin, sillä ne ovat hienovaraisia ja nopeasti vihaisia.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/mbart-large-50-many-to-many-mmt&quot;</span>, src_lang=<span class="hljs-string">&quot;fi_FI&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;facebook/mbart-large-50-many-to-many-mmt&quot;</span>)`,wrap:!1}}),Ie=new b({props:{code:"ZW5jb2RlZF9lbiUyMCUzRCUyMHRva2VuaXplcihlbl90ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMik=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_en = tokenizer(en_text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)',wrap:!1}}),Re=new b({props:{code:"Z2VuZXJhdGVkX3Rva2VucyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqZW5jb2RlZF9lbiUyQyUyMGZvcmNlZF9ib3NfdG9rZW5faWQlM0R0b2tlbml6ZXIubGFuZ19jb2RlX3RvX2lkKCUyMmVuX1hYJTIyKSklMEF0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlZF90b2tlbnMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>generated_tokens = model.generate(**encoded_en, forced_bos_token_id=tokenizer.lang_code_to_id(<span class="hljs-string">&quot;en_XX&quot;</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generated_tokens, skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&quot;Don&#x27;t interfere with the wizard&#x27;s affairs, because they are subtle, will soon get angry.&quot;</span>`,wrap:!1}}),{c(){J=a("meta"),Ke=o(),Ae=a("p"),et=o(),y=a("h1"),j=a("a"),Ne=a("span"),u(G.$$.fragment),rl=o(),Xe=a("span"),Xe.textContent=Ml,tt=o(),u(Q.$$.fragment),lt=o(),L=a("p"),L.innerHTML=bl,nt=o(),W=a("p"),W.innerHTML=Jl,at=o(),v=a("h2"),C=a("a"),qe=a("span"),u(B.$$.fragment),pl=o(),Ve=a("span"),Ve.textContent=yl,st=o(),H=a("p"),H.textContent=vl,ot=o(),U=a("h3"),_=a("a"),ze=a("span"),u(A.$$.fragment),ml=o(),Ge=a("span"),Ge.textContent=Ul,it=o(),N=a("p"),N.textContent=Tl,rt=o(),q=a("ul"),q.innerHTML=wl,pt=o(),z=a("p"),z.innerHTML=xl,mt=o(),F=a("p"),F.innerHTML=kl,ht=o(),u(P.$$.fragment),ut=o(),S=a("p"),S.innerHTML=$l,ct=o(),u(Y.$$.fragment),dt=o(),D=a("p"),D.textContent=jl,gt=o(),u(O.$$.fragment),ft=o(),K=a("p"),K.innerHTML=Cl,Mt=o(),u(ee.$$.fragment),bt=o(),te=a("p"),te.innerHTML=_l,Jt=o(),u(le.$$.fragment),yt=o(),ne=a("p"),ne.innerHTML=Il,vt=o(),T=a("h3"),I=a("a"),Fe=a("span"),u(ae.$$.fragment),hl=o(),Qe=a("span"),Qe.textContent=Zl,Ut=o(),se=a("p"),se.textContent=Rl,Tt=o(),oe=a("ul"),oe.innerHTML=El,wt=o(),ie=a("p"),ie.textContent=Xl,xt=o(),w=a("h2"),Z=a("a"),Pe=a("span"),u(re.$$.fragment),ul=o(),Le=a("span"),Le.textContent=Vl,kt=o(),pe=a("p"),pe.textContent=Gl,$t=o(),me=a("ul"),me.innerHTML=Ql,jt=o(),he=a("p"),he.textContent=Ll,Ct=o(),x=a("h2"),R=a("a"),Se=a("span"),u(ue.$$.fragment),cl=o(),We=a("span"),We.textContent=Wl,_t=o(),ce=a("p"),ce.textContent=Bl,It=o(),de=a("ul"),de.innerHTML=Hl,Zt=o(),ge=a("p"),ge.textContent=Al,Rt=o(),k=a("h2"),E=a("a"),Ye=a("span"),u(fe.$$.fragment),dl=o(),Be=a("span"),Be.textContent=Nl,Et=o(),Me=a("p"),Me.textContent=ql,Xt=o(),be=a("ul"),be.innerHTML=zl,Vt=o(),Je=a("p"),Je.innerHTML=Fl,Gt=o(),u(ye.$$.fragment),Qt=o(),ve=a("p"),ve.textContent=Pl,Lt=o(),u(Ue.$$.fragment),Wt=o(),Te=a("p"),Te.innerHTML=Sl,Bt=o(),u(we.$$.fragment),Ht=o(),$=a("h2"),X=a("a"),De=a("span"),u(xe.$$.fragment),gl=o(),He=a("span"),He.textContent=Yl,At=o(),ke=a("p"),ke.textContent=Dl,Nt=o(),$e=a("ul"),$e.innerHTML=Ol,qt=o(),je=a("p"),je.innerHTML=Kl,zt=o(),u(Ce.$$.fragment),Ft=o(),_e=a("p"),_e.textContent=en,Pt=o(),u(Ie.$$.fragment),St=o(),Ze=a("p"),Ze.innerHTML=tn,Yt=o(),u(Re.$$.fragment),Dt=o(),Ee=a("p"),Ee.innerHTML=ln,Ot=o(),Oe=a("p"),this.h()},l(e){const l=xn("svelte-1phssyn",document.head);J=s(l,"META",{name:!0,content:!0}),l.forEach(t),Ke=i(e),Ae=s(e,"P",{}),h(Ae).forEach(t),et=i(e),y=s(e,"H1",{class:!0});var el=h(y);j=s(el,"A",{id:!0,class:!0,href:!0});var nn=h(j);Ne=s(nn,"SPAN",{});var an=h(Ne);c(G.$$.fragment,an),an.forEach(t),nn.forEach(t),rl=i(el),Xe=s(el,"SPAN",{"data-svelte-h":!0}),r(Xe)!=="svelte-1xb0pzq"&&(Xe.textContent=Ml),el.forEach(t),tt=i(e),c(Q.$$.fragment,e),lt=i(e),L=s(e,"P",{"data-svelte-h":!0}),r(L)!=="svelte-1qyjud1"&&(L.innerHTML=bl),nt=i(e),W=s(e,"P",{"data-svelte-h":!0}),r(W)!=="svelte-v17s0a"&&(W.innerHTML=Jl),at=i(e),v=s(e,"H2",{class:!0});var tl=h(v);C=s(tl,"A",{id:!0,class:!0,href:!0});var sn=h(C);qe=s(sn,"SPAN",{});var on=h(qe);c(B.$$.fragment,on),on.forEach(t),sn.forEach(t),pl=i(tl),Ve=s(tl,"SPAN",{"data-svelte-h":!0}),r(Ve)!=="svelte-zmv7xk"&&(Ve.textContent=yl),tl.forEach(t),st=i(e),H=s(e,"P",{"data-svelte-h":!0}),r(H)!=="svelte-d0lwem"&&(H.textContent=vl),ot=i(e),U=s(e,"H3",{class:!0});var ll=h(U);_=s(ll,"A",{id:!0,class:!0,href:!0});var rn=h(_);ze=s(rn,"SPAN",{});var pn=h(ze);c(A.$$.fragment,pn),pn.forEach(t),rn.forEach(t),ml=i(ll),Ge=s(ll,"SPAN",{"data-svelte-h":!0}),r(Ge)!=="svelte-1sylpdk"&&(Ge.textContent=Ul),ll.forEach(t),it=i(e),N=s(e,"P",{"data-svelte-h":!0}),r(N)!=="svelte-1mrvoju"&&(N.textContent=Tl),rt=i(e),q=s(e,"UL",{"data-svelte-h":!0}),r(q)!=="svelte-sili9k"&&(q.innerHTML=wl),pt=i(e),z=s(e,"P",{"data-svelte-h":!0}),r(z)!=="svelte-jhaqr8"&&(z.innerHTML=xl),mt=i(e),F=s(e,"P",{"data-svelte-h":!0}),r(F)!=="svelte-1othhyi"&&(F.innerHTML=kl),ht=i(e),c(P.$$.fragment,e),ut=i(e),S=s(e,"P",{"data-svelte-h":!0}),r(S)!=="svelte-m3urb"&&(S.innerHTML=$l),ct=i(e),c(Y.$$.fragment,e),dt=i(e),D=s(e,"P",{"data-svelte-h":!0}),r(D)!=="svelte-xaqytr"&&(D.textContent=jl),gt=i(e),c(O.$$.fragment,e),ft=i(e),K=s(e,"P",{"data-svelte-h":!0}),r(K)!=="svelte-15t64om"&&(K.innerHTML=Cl),Mt=i(e),c(ee.$$.fragment,e),bt=i(e),te=s(e,"P",{"data-svelte-h":!0}),r(te)!=="svelte-13hhwrg"&&(te.innerHTML=_l),Jt=i(e),c(le.$$.fragment,e),yt=i(e),ne=s(e,"P",{"data-svelte-h":!0}),r(ne)!=="svelte-11on0v7"&&(ne.innerHTML=Il),vt=i(e),T=s(e,"H3",{class:!0});var nl=h(T);I=s(nl,"A",{id:!0,class:!0,href:!0});var mn=h(I);Fe=s(mn,"SPAN",{});var hn=h(Fe);c(ae.$$.fragment,hn),hn.forEach(t),mn.forEach(t),hl=i(nl),Qe=s(nl,"SPAN",{"data-svelte-h":!0}),r(Qe)!=="svelte-1j7hfxu"&&(Qe.textContent=Zl),nl.forEach(t),Ut=i(e),se=s(e,"P",{"data-svelte-h":!0}),r(se)!=="svelte-ugy4tb"&&(se.textContent=Rl),Tt=i(e),oe=s(e,"UL",{"data-svelte-h":!0}),r(oe)!=="svelte-1byfgvw"&&(oe.innerHTML=El),wt=i(e),ie=s(e,"P",{"data-svelte-h":!0}),r(ie)!=="svelte-10uilok"&&(ie.textContent=Xl),xt=i(e),w=s(e,"H2",{class:!0});var al=h(w);Z=s(al,"A",{id:!0,class:!0,href:!0});var un=h(Z);Pe=s(un,"SPAN",{});var cn=h(Pe);c(re.$$.fragment,cn),cn.forEach(t),un.forEach(t),ul=i(al),Le=s(al,"SPAN",{"data-svelte-h":!0}),r(Le)!=="svelte-d1aweg"&&(Le.textContent=Vl),al.forEach(t),kt=i(e),pe=s(e,"P",{"data-svelte-h":!0}),r(pe)!=="svelte-17m07ks"&&(pe.textContent=Gl),$t=i(e),me=s(e,"UL",{"data-svelte-h":!0}),r(me)!=="svelte-f3wf5p"&&(me.innerHTML=Ql),jt=i(e),he=s(e,"P",{"data-svelte-h":!0}),r(he)!=="svelte-1g2xdg6"&&(he.textContent=Ll),Ct=i(e),x=s(e,"H2",{class:!0});var sl=h(x);R=s(sl,"A",{id:!0,class:!0,href:!0});var dn=h(R);Se=s(dn,"SPAN",{});var gn=h(Se);c(ue.$$.fragment,gn),gn.forEach(t),dn.forEach(t),cl=i(sl),We=s(sl,"SPAN",{"data-svelte-h":!0}),r(We)!=="svelte-on8il6"&&(We.textContent=Wl),sl.forEach(t),_t=i(e),ce=s(e,"P",{"data-svelte-h":!0}),r(ce)!=="svelte-1qq64rp"&&(ce.textContent=Bl),It=i(e),de=s(e,"UL",{"data-svelte-h":!0}),r(de)!=="svelte-1j1vip0"&&(de.innerHTML=Hl),Zt=i(e),ge=s(e,"P",{"data-svelte-h":!0}),r(ge)!=="svelte-1k6xl52"&&(ge.textContent=Al),Rt=i(e),k=s(e,"H2",{class:!0});var ol=h(k);E=s(ol,"A",{id:!0,class:!0,href:!0});var fn=h(E);Ye=s(fn,"SPAN",{});var Mn=h(Ye);c(fe.$$.fragment,Mn),Mn.forEach(t),fn.forEach(t),dl=i(ol),Be=s(ol,"SPAN",{"data-svelte-h":!0}),r(Be)!=="svelte-1qywztq"&&(Be.textContent=Nl),ol.forEach(t),Et=i(e),Me=s(e,"P",{"data-svelte-h":!0}),r(Me)!=="svelte-170tekz"&&(Me.textContent=ql),Xt=i(e),be=s(e,"UL",{"data-svelte-h":!0}),r(be)!=="svelte-nhn2xp"&&(be.innerHTML=zl),Vt=i(e),Je=s(e,"P",{"data-svelte-h":!0}),r(Je)!=="svelte-1v6yjg7"&&(Je.innerHTML=Fl),Gt=i(e),c(ye.$$.fragment,e),Qt=i(e),ve=s(e,"P",{"data-svelte-h":!0}),r(ve)!=="svelte-1sem8ou"&&(ve.textContent=Pl),Lt=i(e),c(Ue.$$.fragment,e),Wt=i(e),Te=s(e,"P",{"data-svelte-h":!0}),r(Te)!=="svelte-bfy9qc"&&(Te.innerHTML=Sl),Bt=i(e),c(we.$$.fragment,e),Ht=i(e),$=s(e,"H2",{class:!0});var il=h($);X=s(il,"A",{id:!0,class:!0,href:!0});var bn=h(X);De=s(bn,"SPAN",{});var Jn=h(De);c(xe.$$.fragment,Jn),Jn.forEach(t),bn.forEach(t),gl=i(il),He=s(il,"SPAN",{"data-svelte-h":!0}),r(He)!=="svelte-1ncd2v"&&(He.textContent=Yl),il.forEach(t),At=i(e),ke=s(e,"P",{"data-svelte-h":!0}),r(ke)!=="svelte-1qf6ghx"&&(ke.textContent=Dl),Nt=i(e),$e=s(e,"UL",{"data-svelte-h":!0}),r($e)!=="svelte-q5sfdy"&&($e.innerHTML=Ol),qt=i(e),je=s(e,"P",{"data-svelte-h":!0}),r(je)!=="svelte-1xo0fvw"&&(je.innerHTML=Kl),zt=i(e),c(Ce.$$.fragment,e),Ft=i(e),_e=s(e,"P",{"data-svelte-h":!0}),r(_e)!=="svelte-1sem8ou"&&(_e.textContent=en),Pt=i(e),c(Ie.$$.fragment,e),St=i(e),Ze=s(e,"P",{"data-svelte-h":!0}),r(Ze)!=="svelte-19syhrh"&&(Ze.innerHTML=tn),Yt=i(e),c(Re.$$.fragment,e),Dt=i(e),Ee=s(e,"P",{"data-svelte-h":!0}),r(Ee)!=="svelte-jdtdeh"&&(Ee.innerHTML=ln),Ot=i(e),Oe=s(e,"P",{}),h(Oe).forEach(t),this.h()},h(){p(J,"name","hf:doc:metadata"),p(J,"content",JSON.stringify(jn)),p(j,"id","multilingual-models-for-inference"),p(j,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(j,"href","#multilingual-models-for-inference"),p(y,"class","relative group"),p(C,"id","xlm"),p(C,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(C,"href","#xlm"),p(v,"class","relative group"),p(_,"id","xlm-with-language-embeddings"),p(_,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(_,"href","#xlm-with-language-embeddings"),p(U,"class","relative group"),p(I,"id","xlm-without-language-embeddings"),p(I,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(I,"href","#xlm-without-language-embeddings"),p(T,"class","relative group"),p(Z,"id","bert"),p(Z,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Z,"href","#bert"),p(w,"class","relative group"),p(R,"id","xlmroberta"),p(R,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(R,"href","#xlmroberta"),p(x,"class","relative group"),p(E,"id","m2m100"),p(E,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(E,"href","#m2m100"),p(k,"class","relative group"),p(X,"id","mbart"),p(X,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(X,"href","#mbart"),p($,"class","relative group")},m(e,l){m(document.head,J),n(e,Ke,l),n(e,Ae,l),n(e,et,l),n(e,y,l),m(y,j),m(j,Ne),d(G,Ne,null),m(y,rl),m(y,Xe),n(e,tt,l),d(Q,e,l),n(e,lt,l),n(e,L,l),n(e,nt,l),n(e,W,l),n(e,at,l),n(e,v,l),m(v,C),m(C,qe),d(B,qe,null),m(v,pl),m(v,Ve),n(e,st,l),n(e,H,l),n(e,ot,l),n(e,U,l),m(U,_),m(_,ze),d(A,ze,null),m(U,ml),m(U,Ge),n(e,it,l),n(e,N,l),n(e,rt,l),n(e,q,l),n(e,pt,l),n(e,z,l),n(e,mt,l),n(e,F,l),n(e,ht,l),d(P,e,l),n(e,ut,l),n(e,S,l),n(e,ct,l),d(Y,e,l),n(e,dt,l),n(e,D,l),n(e,gt,l),d(O,e,l),n(e,ft,l),n(e,K,l),n(e,Mt,l),d(ee,e,l),n(e,bt,l),n(e,te,l),n(e,Jt,l),d(le,e,l),n(e,yt,l),n(e,ne,l),n(e,vt,l),n(e,T,l),m(T,I),m(I,Fe),d(ae,Fe,null),m(T,hl),m(T,Qe),n(e,Ut,l),n(e,se,l),n(e,Tt,l),n(e,oe,l),n(e,wt,l),n(e,ie,l),n(e,xt,l),n(e,w,l),m(w,Z),m(Z,Pe),d(re,Pe,null),m(w,ul),m(w,Le),n(e,kt,l),n(e,pe,l),n(e,$t,l),n(e,me,l),n(e,jt,l),n(e,he,l),n(e,Ct,l),n(e,x,l),m(x,R),m(R,Se),d(ue,Se,null),m(x,cl),m(x,We),n(e,_t,l),n(e,ce,l),n(e,It,l),n(e,de,l),n(e,Zt,l),n(e,ge,l),n(e,Rt,l),n(e,k,l),m(k,E),m(E,Ye),d(fe,Ye,null),m(k,dl),m(k,Be),n(e,Et,l),n(e,Me,l),n(e,Xt,l),n(e,be,l),n(e,Vt,l),n(e,Je,l),n(e,Gt,l),d(ye,e,l),n(e,Qt,l),n(e,ve,l),n(e,Lt,l),d(Ue,e,l),n(e,Wt,l),n(e,Te,l),n(e,Bt,l),d(we,e,l),n(e,Ht,l),n(e,$,l),m($,X),m(X,De),d(xe,De,null),m($,gl),m($,He),n(e,At,l),n(e,ke,l),n(e,Nt,l),n(e,$e,l),n(e,qt,l),n(e,je,l),n(e,zt,l),d(Ce,e,l),n(e,Ft,l),n(e,_e,l),n(e,Pt,l),d(Ie,e,l),n(e,St,l),n(e,Ze,l),n(e,Yt,l),d(Re,e,l),n(e,Dt,l),n(e,Ee,l),n(e,Ot,l),n(e,Oe,l),Kt=!0},p:vn,i(e){Kt||(g(G.$$.fragment,e),g(Q.$$.fragment,e),g(B.$$.fragment,e),g(A.$$.fragment,e),g(P.$$.fragment,e),g(Y.$$.fragment,e),g(O.$$.fragment,e),g(ee.$$.fragment,e),g(le.$$.fragment,e),g(ae.$$.fragment,e),g(re.$$.fragment,e),g(ue.$$.fragment,e),g(fe.$$.fragment,e),g(ye.$$.fragment,e),g(Ue.$$.fragment,e),g(we.$$.fragment,e),g(xe.$$.fragment,e),g(Ce.$$.fragment,e),g(Ie.$$.fragment,e),g(Re.$$.fragment,e),Kt=!0)},o(e){f(G.$$.fragment,e),f(Q.$$.fragment,e),f(B.$$.fragment,e),f(A.$$.fragment,e),f(P.$$.fragment,e),f(Y.$$.fragment,e),f(O.$$.fragment,e),f(ee.$$.fragment,e),f(le.$$.fragment,e),f(ae.$$.fragment,e),f(re.$$.fragment,e),f(ue.$$.fragment,e),f(fe.$$.fragment,e),f(ye.$$.fragment,e),f(Ue.$$.fragment,e),f(we.$$.fragment,e),f(xe.$$.fragment,e),f(Ce.$$.fragment,e),f(Ie.$$.fragment,e),f(Re.$$.fragment,e),Kt=!1},d(e){e&&(t(Ke),t(Ae),t(et),t(y),t(tt),t(lt),t(L),t(nt),t(W),t(at),t(v),t(st),t(H),t(ot),t(U),t(it),t(N),t(rt),t(q),t(pt),t(z),t(mt),t(F),t(ht),t(ut),t(S),t(ct),t(dt),t(D),t(gt),t(ft),t(K),t(Mt),t(bt),t(te),t(Jt),t(yt),t(ne),t(vt),t(T),t(Ut),t(se),t(Tt),t(oe),t(wt),t(ie),t(xt),t(w),t(kt),t(pe),t($t),t(me),t(jt),t(he),t(Ct),t(x),t(_t),t(ce),t(It),t(de),t(Zt),t(ge),t(Rt),t(k),t(Et),t(Me),t(Xt),t(be),t(Vt),t(Je),t(Gt),t(Qt),t(ve),t(Lt),t(Wt),t(Te),t(Bt),t(Ht),t($),t(At),t(ke),t(Nt),t($e),t(qt),t(je),t(zt),t(Ft),t(_e),t(Pt),t(St),t(Ze),t(Yt),t(Dt),t(Ee),t(Ot),t(Oe)),t(J),M(G),M(Q,e),M(B),M(A),M(P,e),M(Y,e),M(O,e),M(ee,e),M(le,e),M(ae),M(re),M(ue),M(fe),M(ye,e),M(Ue,e),M(we,e),M(xe),M(Ce,e),M(Ie,e),M(Re,e)}}}const jn={local:"multilingual-models-for-inference",sections:[{local:"xlm",sections:[{local:"xlm-with-language-embeddings",title:"언어 임베딩을 사용하는 XLM"},{local:"xlm-without-language-embeddings",title:"언어 임베딩을 사용하지 않는 XLM"}],title:"XLM"},{local:"bert",title:"BERT"},{local:"xlmroberta",title:"XLM-RoBERTa"},{local:"m2m100",title:"M2M100"},{local:"mbart",title:"MBart"}],title:"다국어 모델 추론하기"};function Cn(fl){return Un(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Xn extends Tn{constructor(J){super(),wn(this,J,Cn,$n,yn,{})}}export{Xn as component};
