import{s as ll,n as sl,o as nl}from"../chunks/scheduler.56730f09.js";import{S as al,i as il,g as i,s as n,r as p,A as ml,h as m,f as l,c as a,j as el,u as r,x as o,k as tl,y as ol,a as s,v as g,d as u,t as M,w as c}from"../chunks/index.1f144517.js";import{C as b}from"../chunks/CodeBlock.738eeccb.js";import{D as pl}from"../chunks/DocNotebookDropdown.243c3df7.js";import{H as f,E as rl}from"../chunks/EditOnGithub.854793f1.js";function gl(yt){let J,Te,fe,Ue,d,ye,T,he,U,ht=`🤗 Transformers에는 여러 종류의 다국어(multilingual) 모델이 있으며, 단일 언어(monolingual) 모델과 추론 시 사용법이 다릅니다.
그렇다고 해서 <em>모든</em> 다국어 모델의 사용법이 다른 것은 아닙니다.`,$e,y,$t=`<a href="https://huggingface.co/google-bert/bert-base-multilingual-uncased" rel="nofollow">google-bert/bert-base-multilingual-uncased</a>와 같은 몇몇 모델은 단일 언어 모델처럼 사용할 수 있습니다.
이번 가이드에서 다국어 모델의 추론 시 사용 방법을 알아볼 것입니다.`,ke,h,je,$,kt=`XLM에는 10가지 체크포인트(checkpoint)가 있는데, 이 중 하나만 단일 언어입니다.
나머지 체크포인트 9개는 언어 임베딩을 사용하는 체크포인트와 그렇지 않은 체크포인트의 두 가지 범주로 나눌 수 있습니다.`,we,k,xe,j,jt="다음 XLM 모델은 추론 시에 언어 임베딩을 사용합니다:",Ie,w,wt="<li><code>FacebookAI/xlm-mlm-ende-1024</code> (마스킹된 언어 모델링, 영어-독일어)</li> <li><code>FacebookAI/xlm-mlm-enfr-1024</code> (마스킹된 언어 모델링, 영어-프랑스어)</li> <li><code>FacebookAI/xlm-mlm-enro-1024</code> (마스킹된 언어 모델링, 영어-루마니아어)</li> <li><code>FacebookAI/xlm-mlm-xnli15-1024</code> (마스킹된 언어 모델링, XNLI 데이터 세트에서 제공하는 15개 국어)</li> <li><code>FacebookAI/xlm-mlm-tlm-xnli15-1024</code> (마스킹된 언어 모델링 + 번역, XNLI 데이터 세트에서 제공하는 15개 국어)</li> <li><code>FacebookAI/xlm-clm-enfr-1024</code> (Causal language modeling, 영어-프랑스어)</li> <li><code>FacebookAI/xlm-clm-ende-1024</code> (Causal language modeling, 영어-독일어)</li>",ve,x,xt=`언어 임베딩은 모델에 전달된 <code>input_ids</code>와 동일한 shape의 텐서로 표현됩니다.
이러한 텐서의 값은 사용된 언어에 따라 다르며 토크나이저의 <code>lang2id</code> 및 <code>id2lang</code> 속성에 의해 식별됩니다.`,Ce,I,It="다음 예제에서는 <code>FacebookAI/xlm-clm-enfr-1024</code> 체크포인트(코잘 언어 모델링(causal language modeling), 영어-프랑스어)를 가져옵니다:",Ze,v,_e,C,vt="토크나이저의 <code>lang2id</code> 속성은 모델의 언어와 해당 ID를 표시합니다:",Re,Z,Ve,_,Ct="다음으로, 예제 입력을 만듭니다:",Xe,R,Ge,V,Zt=`언어 ID를 <code>&quot;en&quot;</code>으로 설정해 언어 임베딩을 정의합니다.
언어 임베딩은 영어의 언어 ID인 <code>0</code>으로 채워진 텐서입니다.
이 텐서는 <code>input_ids</code>와 같은 크기여야 합니다.`,Qe,X,We,G,_t="이제 <code>input_ids</code>와 언어 임베딩을 모델로 전달합니다:",Le,Q,Ee,W,Rt='<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> 체크포인트를 사용해 텍스트와 언어 임베딩을 생성할 수 있습니다.',Fe,L,Be,E,Vt="다음 XLM 모델은 추론 시에 언어 임베딩이 필요하지 않습니다:",He,F,Xt="<li><code>FacebookAI/xlm-mlm-17-1280</code> (마스킹된 언어 모델링, 17개 국어)</li> <li><code>FacebookAI/xlm-mlm-100-1280</code> (마스킹된 언어 모델링, 100개 국어)</li>",qe,B,Gt="이전의 XLM 체크포인트와 달리 이 모델은 일반 문장 표현에 사용됩니다.",ze,H,Ae,q,Qt="다음 BERT 모델은 다국어 태스크에 사용할 수 있습니다:",Ye,z,Wt="<li><code>google-bert/bert-base-multilingual-uncased</code> (마스킹된 언어 모델링 + 다음 문장 예측, 102개 국어)</li> <li><code>google-bert/bert-base-multilingual-cased</code> (마스킹된 언어 모델링 + 다음 문장 예측, 104개 국어)</li>",Ne,A,Lt=`이러한 모델은 추론 시에 언어 임베딩이 필요하지 않습니다.
문맥에서 언어를 식별하고, 식별된 언어로 추론합니다.`,De,Y,Oe,N,Et="다음 XLM-RoBERTa 또한 다국어 다국어 태스크에 사용할 수 있습니다:",Pe,D,Ft="<li><code>FacebookAI/xlm-roberta-base</code> (마스킹된 언어 모델링, 100개 국어)</li> <li><code>FacebookAI/xlm-roberta-large</code> (마스킹된 언어 모델링, 100개 국어)</li>",Se,O,Bt=`XLM-RoBERTa는 100개 국어에 대해 새로 생성되고 정제된 2.5TB 규모의 CommonCrawl 데이터로 학습되었습니다.
이전에 공개된 mBERT나 XLM과 같은 다국어 모델에 비해 분류, 시퀀스 라벨링, 질의 응답과 같은 다운스트림(downstream) 작업에서 이점이 있습니다.`,Ke,P,et,S,Ht="다음 M2M100 모델 또한 다국어 다국어 태스크에 사용할 수 있습니다:",tt,K,qt="<li><code>facebook/m2m100_418M</code> (번역)</li> <li><code>facebook/m2m100_1.2B</code> (번역)</li>",lt,ee,zt=`이 예제에서는 <code>facebook/m2m100_418M</code> 체크포인트를 가져와서 중국어를 영어로 번역합니다.
토크나이저에서 번역 대상 언어(source language)를 설정할 수 있습니다:`,st,te,nt,le,At="문장을 토큰화합니다:",at,se,it,ne,Yt=`M2M100은 번역을 진행하기 위해 첫 번째로 생성되는 토큰은 번역할 언어(target language) ID로 강제 지정합니다.
영어로 번역하기 위해 <code>generate</code> 메소드에서 <code>forced_bos_token_id</code>를 <code>en</code>으로 설정합니다:`,mt,ae,ot,ie,pt,me,Nt="다음 MBart 모델 또한 다국어 태스크에 사용할 수 있습니다:",rt,oe,Dt="<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>",gt,pe,Ot=`이 예제에서는 핀란드어를 영어로 번역하기 위해 <code>facebook/mbart-large-50-many-to-many-mmt</code> 체크포인트를 가져옵니다.
토크나이저에서 번역 대상 언어(source language)를 설정할 수 있습니다:`,ut,re,Mt,ge,Pt="문장을 토큰화합니다:",ct,ue,bt,Me,St=`MBart는 번역을 진행하기 위해 첫 번째로 생성되는 토큰은 번역할 언어(target language) ID로 강제 지정합니다.
영어로 번역하기 위해 <code>generate</code> 메소드에서 <code>forced_bos_token_id</code>를 <code>en</code>으로 설정합니다:`,Jt,ce,ft,be,Kt="<code>facebook/mbart-large-50-many-to-one-mmt</code> 체크포인트를 사용하고 있다면, 첫 번째로 생성되는 토큰을 번역할 언어(target language) ID로 강제 지정할 필요는 없습니다.",dt,Je,Tt,de,Ut;return d=new f({props:{title:"다국어 모델 추론하기",local:"multilingual-models-for-inference",headingTag:"h1"}}),T=new pl({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"}]}}),h=new f({props:{title:"XLM",local:"xlm",headingTag:"h2"}}),k=new f({props:{title:"언어 임베딩을 사용하는 XLM",local:"xlm-with-language-embeddings",headingTag:"h3"}}),v=new b({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwWExNVG9rZW5pemVyJTJDJTIwWExNV2l0aExNSGVhZE1vZGVsJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwWExNVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJGYWNlYm9va0FJJTJGeGxtLWNsbS1lbmZyLTEwMjQlMjIpJTBBbW9kZWwlMjAlM0QlMjBYTE1XaXRoTE1IZWFkTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMkZhY2Vib29rQUklMkZ4bG0tY2xtLWVuZnItMTAyNCUyMik=",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;FacebookAI/xlm-clm-enfr-1024&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = XLMWithLMHeadModel.from_pretrained(<span class="hljs-string">&quot;FacebookAI/xlm-clm-enfr-1024&quot;</span>)`,wrap:!1}}),Z=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}}),R=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}}),X=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}}),Q=new b({props:{code:"b3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0X2lkcyUyQyUyMGxhbmdzJTNEbGFuZ3Mp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids, langs=langs)',wrap:!1}}),L=new f({props:{title:"언어 임베딩을 사용하지 않는 XLM",local:"xlm-without-language-embeddings",headingTag:"h3"}}),H=new f({props:{title:"BERT",local:"bert",headingTag:"h2"}}),Y=new f({props:{title:"XLM-RoBERTa",local:"xlmroberta",headingTag:"h2"}}),P=new f({props:{title:"M2M100",local:"m2m100",headingTag:"h2"}}),te=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}}),se=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}}),ae=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}}),ie=new f({props:{title:"MBart",local:"mbart",headingTag:"h2"}}),re=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}}),ue=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}}),ce=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}}),Je=new rl({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ko/multilingual.md"}}),{c(){J=i("meta"),Te=n(),fe=i("p"),Ue=n(),p(d.$$.fragment),ye=n(),p(T.$$.fragment),he=n(),U=i("p"),U.innerHTML=ht,$e=n(),y=i("p"),y.innerHTML=$t,ke=n(),p(h.$$.fragment),je=n(),$=i("p"),$.textContent=kt,we=n(),p(k.$$.fragment),xe=n(),j=i("p"),j.textContent=jt,Ie=n(),w=i("ul"),w.innerHTML=wt,ve=n(),x=i("p"),x.innerHTML=xt,Ce=n(),I=i("p"),I.innerHTML=It,Ze=n(),p(v.$$.fragment),_e=n(),C=i("p"),C.innerHTML=vt,Re=n(),p(Z.$$.fragment),Ve=n(),_=i("p"),_.textContent=Ct,Xe=n(),p(R.$$.fragment),Ge=n(),V=i("p"),V.innerHTML=Zt,Qe=n(),p(X.$$.fragment),We=n(),G=i("p"),G.innerHTML=_t,Le=n(),p(Q.$$.fragment),Ee=n(),W=i("p"),W.innerHTML=Rt,Fe=n(),p(L.$$.fragment),Be=n(),E=i("p"),E.textContent=Vt,He=n(),F=i("ul"),F.innerHTML=Xt,qe=n(),B=i("p"),B.textContent=Gt,ze=n(),p(H.$$.fragment),Ae=n(),q=i("p"),q.textContent=Qt,Ye=n(),z=i("ul"),z.innerHTML=Wt,Ne=n(),A=i("p"),A.textContent=Lt,De=n(),p(Y.$$.fragment),Oe=n(),N=i("p"),N.textContent=Et,Pe=n(),D=i("ul"),D.innerHTML=Ft,Se=n(),O=i("p"),O.textContent=Bt,Ke=n(),p(P.$$.fragment),et=n(),S=i("p"),S.textContent=Ht,tt=n(),K=i("ul"),K.innerHTML=qt,lt=n(),ee=i("p"),ee.innerHTML=zt,st=n(),p(te.$$.fragment),nt=n(),le=i("p"),le.textContent=At,at=n(),p(se.$$.fragment),it=n(),ne=i("p"),ne.innerHTML=Yt,mt=n(),p(ae.$$.fragment),ot=n(),p(ie.$$.fragment),pt=n(),me=i("p"),me.textContent=Nt,rt=n(),oe=i("ul"),oe.innerHTML=Dt,gt=n(),pe=i("p"),pe.innerHTML=Ot,ut=n(),p(re.$$.fragment),Mt=n(),ge=i("p"),ge.textContent=Pt,ct=n(),p(ue.$$.fragment),bt=n(),Me=i("p"),Me.innerHTML=St,Jt=n(),p(ce.$$.fragment),ft=n(),be=i("p"),be.innerHTML=Kt,dt=n(),p(Je.$$.fragment),Tt=n(),de=i("p"),this.h()},l(e){const t=ml("svelte-u9bgzb",document.head);J=m(t,"META",{name:!0,content:!0}),t.forEach(l),Te=a(e),fe=m(e,"P",{}),el(fe).forEach(l),Ue=a(e),r(d.$$.fragment,e),ye=a(e),r(T.$$.fragment,e),he=a(e),U=m(e,"P",{"data-svelte-h":!0}),o(U)!=="svelte-1qyjud1"&&(U.innerHTML=ht),$e=a(e),y=m(e,"P",{"data-svelte-h":!0}),o(y)!=="svelte-1dm3zii"&&(y.innerHTML=$t),ke=a(e),r(h.$$.fragment,e),je=a(e),$=m(e,"P",{"data-svelte-h":!0}),o($)!=="svelte-d0lwem"&&($.textContent=kt),we=a(e),r(k.$$.fragment,e),xe=a(e),j=m(e,"P",{"data-svelte-h":!0}),o(j)!=="svelte-1mrvoju"&&(j.textContent=jt),Ie=a(e),w=m(e,"UL",{"data-svelte-h":!0}),o(w)!=="svelte-xty113"&&(w.innerHTML=wt),ve=a(e),x=m(e,"P",{"data-svelte-h":!0}),o(x)!=="svelte-jhaqr8"&&(x.innerHTML=xt),Ce=a(e),I=m(e,"P",{"data-svelte-h":!0}),o(I)!=="svelte-8i1x81"&&(I.innerHTML=It),Ze=a(e),r(v.$$.fragment,e),_e=a(e),C=m(e,"P",{"data-svelte-h":!0}),o(C)!=="svelte-m3urb"&&(C.innerHTML=vt),Re=a(e),r(Z.$$.fragment,e),Ve=a(e),_=m(e,"P",{"data-svelte-h":!0}),o(_)!=="svelte-xaqytr"&&(_.textContent=Ct),Xe=a(e),r(R.$$.fragment,e),Ge=a(e),V=m(e,"P",{"data-svelte-h":!0}),o(V)!=="svelte-15t64om"&&(V.innerHTML=Zt),Qe=a(e),r(X.$$.fragment,e),We=a(e),G=m(e,"P",{"data-svelte-h":!0}),o(G)!=="svelte-13hhwrg"&&(G.innerHTML=_t),Le=a(e),r(Q.$$.fragment,e),Ee=a(e),W=m(e,"P",{"data-svelte-h":!0}),o(W)!=="svelte-11on0v7"&&(W.innerHTML=Rt),Fe=a(e),r(L.$$.fragment,e),Be=a(e),E=m(e,"P",{"data-svelte-h":!0}),o(E)!=="svelte-ugy4tb"&&(E.textContent=Vt),He=a(e),F=m(e,"UL",{"data-svelte-h":!0}),o(F)!=="svelte-14eckio"&&(F.innerHTML=Xt),qe=a(e),B=m(e,"P",{"data-svelte-h":!0}),o(B)!=="svelte-10uilok"&&(B.textContent=Gt),ze=a(e),r(H.$$.fragment,e),Ae=a(e),q=m(e,"P",{"data-svelte-h":!0}),o(q)!=="svelte-17m07ks"&&(q.textContent=Qt),Ye=a(e),z=m(e,"UL",{"data-svelte-h":!0}),o(z)!=="svelte-7ugqvx"&&(z.innerHTML=Wt),Ne=a(e),A=m(e,"P",{"data-svelte-h":!0}),o(A)!=="svelte-1g2xdg6"&&(A.textContent=Lt),De=a(e),r(Y.$$.fragment,e),Oe=a(e),N=m(e,"P",{"data-svelte-h":!0}),o(N)!=="svelte-1qq64rp"&&(N.textContent=Et),Pe=a(e),D=m(e,"UL",{"data-svelte-h":!0}),o(D)!=="svelte-18hzxmq"&&(D.innerHTML=Ft),Se=a(e),O=m(e,"P",{"data-svelte-h":!0}),o(O)!=="svelte-1k6xl52"&&(O.textContent=Bt),Ke=a(e),r(P.$$.fragment,e),et=a(e),S=m(e,"P",{"data-svelte-h":!0}),o(S)!=="svelte-170tekz"&&(S.textContent=Ht),tt=a(e),K=m(e,"UL",{"data-svelte-h":!0}),o(K)!=="svelte-nhn2xp"&&(K.innerHTML=qt),lt=a(e),ee=m(e,"P",{"data-svelte-h":!0}),o(ee)!=="svelte-1v6yjg7"&&(ee.innerHTML=zt),st=a(e),r(te.$$.fragment,e),nt=a(e),le=m(e,"P",{"data-svelte-h":!0}),o(le)!=="svelte-1sem8ou"&&(le.textContent=At),at=a(e),r(se.$$.fragment,e),it=a(e),ne=m(e,"P",{"data-svelte-h":!0}),o(ne)!=="svelte-bfy9qc"&&(ne.innerHTML=Yt),mt=a(e),r(ae.$$.fragment,e),ot=a(e),r(ie.$$.fragment,e),pt=a(e),me=m(e,"P",{"data-svelte-h":!0}),o(me)!=="svelte-1qf6ghx"&&(me.textContent=Nt),rt=a(e),oe=m(e,"UL",{"data-svelte-h":!0}),o(oe)!=="svelte-q5sfdy"&&(oe.innerHTML=Dt),gt=a(e),pe=m(e,"P",{"data-svelte-h":!0}),o(pe)!=="svelte-1xo0fvw"&&(pe.innerHTML=Ot),ut=a(e),r(re.$$.fragment,e),Mt=a(e),ge=m(e,"P",{"data-svelte-h":!0}),o(ge)!=="svelte-1sem8ou"&&(ge.textContent=Pt),ct=a(e),r(ue.$$.fragment,e),bt=a(e),Me=m(e,"P",{"data-svelte-h":!0}),o(Me)!=="svelte-19syhrh"&&(Me.innerHTML=St),Jt=a(e),r(ce.$$.fragment,e),ft=a(e),be=m(e,"P",{"data-svelte-h":!0}),o(be)!=="svelte-jdtdeh"&&(be.innerHTML=Kt),dt=a(e),r(Je.$$.fragment,e),Tt=a(e),de=m(e,"P",{}),el(de).forEach(l),this.h()},h(){tl(J,"name","hf:doc:metadata"),tl(J,"content",ul)},m(e,t){ol(document.head,J),s(e,Te,t),s(e,fe,t),s(e,Ue,t),g(d,e,t),s(e,ye,t),g(T,e,t),s(e,he,t),s(e,U,t),s(e,$e,t),s(e,y,t),s(e,ke,t),g(h,e,t),s(e,je,t),s(e,$,t),s(e,we,t),g(k,e,t),s(e,xe,t),s(e,j,t),s(e,Ie,t),s(e,w,t),s(e,ve,t),s(e,x,t),s(e,Ce,t),s(e,I,t),s(e,Ze,t),g(v,e,t),s(e,_e,t),s(e,C,t),s(e,Re,t),g(Z,e,t),s(e,Ve,t),s(e,_,t),s(e,Xe,t),g(R,e,t),s(e,Ge,t),s(e,V,t),s(e,Qe,t),g(X,e,t),s(e,We,t),s(e,G,t),s(e,Le,t),g(Q,e,t),s(e,Ee,t),s(e,W,t),s(e,Fe,t),g(L,e,t),s(e,Be,t),s(e,E,t),s(e,He,t),s(e,F,t),s(e,qe,t),s(e,B,t),s(e,ze,t),g(H,e,t),s(e,Ae,t),s(e,q,t),s(e,Ye,t),s(e,z,t),s(e,Ne,t),s(e,A,t),s(e,De,t),g(Y,e,t),s(e,Oe,t),s(e,N,t),s(e,Pe,t),s(e,D,t),s(e,Se,t),s(e,O,t),s(e,Ke,t),g(P,e,t),s(e,et,t),s(e,S,t),s(e,tt,t),s(e,K,t),s(e,lt,t),s(e,ee,t),s(e,st,t),g(te,e,t),s(e,nt,t),s(e,le,t),s(e,at,t),g(se,e,t),s(e,it,t),s(e,ne,t),s(e,mt,t),g(ae,e,t),s(e,ot,t),g(ie,e,t),s(e,pt,t),s(e,me,t),s(e,rt,t),s(e,oe,t),s(e,gt,t),s(e,pe,t),s(e,ut,t),g(re,e,t),s(e,Mt,t),s(e,ge,t),s(e,ct,t),g(ue,e,t),s(e,bt,t),s(e,Me,t),s(e,Jt,t),g(ce,e,t),s(e,ft,t),s(e,be,t),s(e,dt,t),g(Je,e,t),s(e,Tt,t),s(e,de,t),Ut=!0},p:sl,i(e){Ut||(u(d.$$.fragment,e),u(T.$$.fragment,e),u(h.$$.fragment,e),u(k.$$.fragment,e),u(v.$$.fragment,e),u(Z.$$.fragment,e),u(R.$$.fragment,e),u(X.$$.fragment,e),u(Q.$$.fragment,e),u(L.$$.fragment,e),u(H.$$.fragment,e),u(Y.$$.fragment,e),u(P.$$.fragment,e),u(te.$$.fragment,e),u(se.$$.fragment,e),u(ae.$$.fragment,e),u(ie.$$.fragment,e),u(re.$$.fragment,e),u(ue.$$.fragment,e),u(ce.$$.fragment,e),u(Je.$$.fragment,e),Ut=!0)},o(e){M(d.$$.fragment,e),M(T.$$.fragment,e),M(h.$$.fragment,e),M(k.$$.fragment,e),M(v.$$.fragment,e),M(Z.$$.fragment,e),M(R.$$.fragment,e),M(X.$$.fragment,e),M(Q.$$.fragment,e),M(L.$$.fragment,e),M(H.$$.fragment,e),M(Y.$$.fragment,e),M(P.$$.fragment,e),M(te.$$.fragment,e),M(se.$$.fragment,e),M(ae.$$.fragment,e),M(ie.$$.fragment,e),M(re.$$.fragment,e),M(ue.$$.fragment,e),M(ce.$$.fragment,e),M(Je.$$.fragment,e),Ut=!1},d(e){e&&(l(Te),l(fe),l(Ue),l(ye),l(he),l(U),l($e),l(y),l(ke),l(je),l($),l(we),l(xe),l(j),l(Ie),l(w),l(ve),l(x),l(Ce),l(I),l(Ze),l(_e),l(C),l(Re),l(Ve),l(_),l(Xe),l(Ge),l(V),l(Qe),l(We),l(G),l(Le),l(Ee),l(W),l(Fe),l(Be),l(E),l(He),l(F),l(qe),l(B),l(ze),l(Ae),l(q),l(Ye),l(z),l(Ne),l(A),l(De),l(Oe),l(N),l(Pe),l(D),l(Se),l(O),l(Ke),l(et),l(S),l(tt),l(K),l(lt),l(ee),l(st),l(nt),l(le),l(at),l(it),l(ne),l(mt),l(ot),l(pt),l(me),l(rt),l(oe),l(gt),l(pe),l(ut),l(Mt),l(ge),l(ct),l(bt),l(Me),l(Jt),l(ft),l(be),l(dt),l(Tt),l(de)),l(J),c(d,e),c(T,e),c(h,e),c(k,e),c(v,e),c(Z,e),c(R,e),c(X,e),c(Q,e),c(L,e),c(H,e),c(Y,e),c(P,e),c(te,e),c(se,e),c(ae,e),c(ie,e),c(re,e),c(ue,e),c(ce,e),c(Je,e)}}}const ul='{"title":"다국어 모델 추론하기","local":"multilingual-models-for-inference","sections":[{"title":"XLM","local":"xlm","sections":[{"title":"언어 임베딩을 사용하는 XLM","local":"xlm-with-language-embeddings","sections":[],"depth":3},{"title":"언어 임베딩을 사용하지 않는 XLM","local":"xlm-without-language-embeddings","sections":[],"depth":3}],"depth":2},{"title":"BERT","local":"bert","sections":[],"depth":2},{"title":"XLM-RoBERTa","local":"xlmroberta","sections":[],"depth":2},{"title":"M2M100","local":"m2m100","sections":[],"depth":2},{"title":"MBart","local":"mbart","sections":[],"depth":2}],"depth":1}';function Ml(yt){return nl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Tl extends al{constructor(J){super(),il(this,J,Ml,gl,ll,{})}}export{Tl as component};
