import{s as ra,o as sa,n as E}from"../chunks/scheduler.9bc65507.js";import{S as aa,i as ia,g as r,s as i,u as g,A as la,h as s,f as n,c as l,j as u,v as _,y as f,k as h,o as t,a as p,w as b,d as v,t as k,x as y}from"../chunks/index.78c82d43.js";import{T as Pn}from"../chunks/Tip.87d55b76.js";import{D as x}from"../chunks/Docstring.4e7352e2.js";import{C as Ne}from"../chunks/CodeBlock.73e038be.js";import{I as B}from"../chunks/IconCopyLink.bedaa44d.js";import{E as We}from"../chunks/ExampleCodeBlock.872b014d.js";function da(R){let a,T="Example:",m,c,w;return c=new Ne({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFJlYWxtQ29uZmlnJTJDJTIwUmVhbG1FbWJlZGRlciUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBSRUFMTSUyMHJlYWxtLWNjLW5ld3MtcHJldHJhaW5lZC0qJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMFJlYWxtQ29uZmlnKCklMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwbW9kZWwlMjAod2l0aCUyMHJhbmRvbSUyMHdlaWdodHMpJTIwZnJvbSUyMHRoZSUyMGdvb2dsZSUyRnJlYWxtLWNjLW5ld3MtcHJldHJhaW5lZC1lbWJlZGRlciUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwUmVhbG1FbWJlZGRlcihjb25maWd1cmF0aW9uKSUwQSUwQSUyMyUyMEFjY2Vzc2luZyUyMHRoZSUyMG1vZGVsJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZ3VyYXRpb24lMjAlM0QlMjBtb2RlbC5jb25maWc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> RealmConfig, RealmEmbedder

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a REALM realm-cc-news-pretrained-* style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = RealmConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the google/realm-cc-news-pretrained-embedder style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = RealmEmbedder(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`,wrap:!1}}),{c(){a=r("p"),a.textContent=T,m=i(),g(c.$$.fragment)},l(o){a=s(o,"P",{"data-svelte-h":!0}),f(a)!=="svelte-11lpom8"&&(a.textContent=T),m=l(o),_(c.$$.fragment,o)},m(o,M){p(o,a,M),p(o,m,M),b(c,o,M),w=!0},p:E,i(o){w||(v(c.$$.fragment,o),w=!0)},o(o){k(c.$$.fragment,o),w=!1},d(o){o&&(n(a),n(m)),y(c,o)}}}function ca(R){let a,T="pair mask has the following format:",m,c,w;return c=new Ne({props:{code:"MCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMEElN0MlMjBmaXJzdCUyMHNlcXVlbmNlJTIwJTIwJTIwJTIwJTdDJTIwc2Vjb25kJTIwc2VxdWVuY2UlMjAlN0M=",highlighted:`0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1 1
| first sequence    | second sequence |`,wrap:!1}}),{c(){a=r("p"),a.textContent=T,m=i(),g(c.$$.fragment)},l(o){a=s(o,"P",{"data-svelte-h":!0}),f(a)!=="svelte-qjgeij"&&(a.textContent=T),m=l(o),_(c.$$.fragment,o)},m(o,M){p(o,a,M),p(o,m,M),b(c,o,M),w=!0},p:E,i(o){w||(v(c.$$.fragment,o),w=!0)},o(o){k(c.$$.fragment,o),w=!1},d(o){o&&(n(a),n(m)),y(c,o)}}}function ma(R){let a,T="Example:",m,c,w;return c=new Ne({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFJlYWxtVG9rZW5pemVyJTBBJTBBJTIzJTIwYmF0Y2hfc2l6ZSUyMCUzRCUyMDIlMkMlMjBudW1fY2FuZGlkYXRlcyUyMCUzRCUyMDIlMEF0ZXh0JTIwJTNEJTIwJTVCJTVCJTIySGVsbG8lMjB3b3JsZCElMjIlMkMlMjAlMjJOaWNlJTIwdG8lMjBtZWV0JTIweW91ISUyMiU1RCUyQyUyMCU1QiUyMlRoZSUyMGN1dGUlMjBjYXQuJTIyJTJDJTIwJTIyVGhlJTIwYWRvcmFibGUlMjBkb2cuJTIyJTVEJTVEJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwUmVhbG1Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnJlYWxtLWNjLW5ld3MtcHJldHJhaW5lZC1lbmNvZGVyJTIyKSUwQXRva2VuaXplZF90ZXh0JTIwJTNEJTIwdG9rZW5pemVyLmJhdGNoX2VuY29kZV9jYW5kaWRhdGVzKHRleHQlMkMlMjBtYXhfbGVuZ3RoJTNEMTAlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> RealmTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># batch_size = 2, num_candidates = 2</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text = [[<span class="hljs-string">&quot;Hello world!&quot;</span>, <span class="hljs-string">&quot;Nice to meet you!&quot;</span>], [<span class="hljs-string">&quot;The cute cat.&quot;</span>, <span class="hljs-string">&quot;The adorable dog.&quot;</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = RealmTokenizer.from_pretrained(<span class="hljs-string">&quot;google/realm-cc-news-pretrained-encoder&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenized_text = tokenizer.batch_encode_candidates(text, max_length=<span class="hljs-number">10</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)`,wrap:!1}}),{c(){a=r("p"),a.textContent=T,m=i(),g(c.$$.fragment)},l(o){a=s(o,"P",{"data-svelte-h":!0}),f(a)!=="svelte-11lpom8"&&(a.textContent=T),m=l(o),_(c.$$.fragment,o)},m(o,M){p(o,a,M),p(o,m,M),b(c,o,M),w=!0},p:E,i(o){w||(v(c.$$.fragment,o),w=!0)},o(o){k(c.$$.fragment,o),w=!1},d(o){o&&(n(a),n(m)),y(c,o)}}}function pa(R){let a,T="Example:",m,c,w;return c=new Ne({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFJlYWxtVG9rZW5pemVyRmFzdCUwQSUwQSUyMyUyMGJhdGNoX3NpemUlMjAlM0QlMjAyJTJDJTIwbnVtX2NhbmRpZGF0ZXMlMjAlM0QlMjAyJTBBdGV4dCUyMCUzRCUyMCU1QiU1QiUyMkhlbGxvJTIwd29ybGQhJTIyJTJDJTIwJTIyTmljZSUyMHRvJTIwbWVldCUyMHlvdSElMjIlNUQlMkMlMjAlNUIlMjJUaGUlMjBjdXRlJTIwY2F0LiUyMiUyQyUyMCUyMlRoZSUyMGFkb3JhYmxlJTIwZG9nLiUyMiU1RCU1RCUwQSUwQXRva2VuaXplciUyMCUzRCUyMFJlYWxtVG9rZW5pemVyRmFzdC5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGcmVhbG0tY2MtbmV3cy1wcmV0cmFpbmVkLWVuY29kZXIlMjIpJTBBdG9rZW5pemVkX3RleHQlMjAlM0QlMjB0b2tlbml6ZXIuYmF0Y2hfZW5jb2RlX2NhbmRpZGF0ZXModGV4dCUyQyUyMG1heF9sZW5ndGglM0QxMCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> RealmTokenizerFast

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># batch_size = 2, num_candidates = 2</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text = [[<span class="hljs-string">&quot;Hello world!&quot;</span>, <span class="hljs-string">&quot;Nice to meet you!&quot;</span>], [<span class="hljs-string">&quot;The cute cat.&quot;</span>, <span class="hljs-string">&quot;The adorable dog.&quot;</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = RealmTokenizerFast.from_pretrained(<span class="hljs-string">&quot;google/realm-cc-news-pretrained-encoder&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenized_text = tokenizer.batch_encode_candidates(text, max_length=<span class="hljs-number">10</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)`,wrap:!1}}),{c(){a=r("p"),a.textContent=T,m=i(),g(c.$$.fragment)},l(o){a=s(o,"P",{"data-svelte-h":!0}),f(a)!=="svelte-11lpom8"&&(a.textContent=T),m=l(o),_(c.$$.fragment,o)},m(o,M){p(o,a,M),p(o,m,M),b(c,o,M),w=!0},p:E,i(o){w||(v(c.$$.fragment,o),w=!0)},o(o){k(c.$$.fragment,o),w=!1},d(o){o&&(n(a),n(m)),y(c,o)}}}function ha(R){let a,T=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){a=r("p"),a.innerHTML=T},l(m){a=s(m,"P",{"data-svelte-h":!0}),f(a)!=="svelte-fincs2"&&(a.innerHTML=T)},m(m,c){p(m,a,c)},p:E,d(m){m&&n(a)}}}function fa(R){let a,T="Example:",m,c,w;return c=new Ne({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBSZWFsbUVtYmVkZGVyJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZyZWFsbS1jYy1uZXdzLXByZXRyYWluZWQtZW1iZWRkZXIlMjIpJTBBbW9kZWwlMjAlM0QlMjBSZWFsbUVtYmVkZGVyLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZyZWFsbS1jYy1uZXdzLXByZXRyYWluZWQtZW1iZWRkZXIlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFwcm9qZWN0ZWRfc2NvcmUlMjAlM0QlMjBvdXRwdXRzLnByb2plY3RlZF9zY29yZQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, RealmEmbedder
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/realm-cc-news-pretrained-embedder&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = RealmEmbedder.from_pretrained(<span class="hljs-string">&quot;google/realm-cc-news-pretrained-embedder&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>projected_score = outputs.projected_score`,wrap:!1}}),{c(){a=r("p"),a.textContent=T,m=i(),g(c.$$.fragment)},l(o){a=s(o,"P",{"data-svelte-h":!0}),f(a)!=="svelte-11lpom8"&&(a.textContent=T),m=l(o),_(c.$$.fragment,o)},m(o,M){p(o,a,M),p(o,m,M),b(c,o,M),w=!0},p:E,i(o){w||(v(c.$$.fragment,o),w=!0)},o(o){k(c.$$.fragment,o),w=!1},d(o){o&&(n(a),n(m)),y(c,o)}}}function ua(R){let a,T=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){a=r("p"),a.innerHTML=T},l(m){a=s(m,"P",{"data-svelte-h":!0}),f(a)!=="svelte-fincs2"&&(a.innerHTML=T)},m(m,c){p(m,a,c)},p:E,d(m){m&&n(a)}}}function ga(R){let a,T="Example:",m,c,w;return c=new Ne({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMFJlYWxtU2NvcmVyJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGcmVhbG0tY2MtbmV3cy1wcmV0cmFpbmVkLXNjb3JlciUyMiklMEFtb2RlbCUyMCUzRCUyMFJlYWxtU2NvcmVyLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZyZWFsbS1jYy1uZXdzLXByZXRyYWluZWQtc2NvcmVyJTIyJTJDJTIwbnVtX2NhbmRpZGF0ZXMlM0QyKSUwQSUwQSUyMyUyMGJhdGNoX3NpemUlMjAlM0QlMjAyJTJDJTIwbnVtX2NhbmRpZGF0ZXMlMjAlM0QlMjAyJTBBaW5wdXRfdGV4dHMlMjAlM0QlMjAlNUIlMjJIb3clMjBhcmUlMjB5b3UlM0YlMjIlMkMlMjAlMjJXaGF0JTIwaXMlMjB0aGUlMjBpdGVtJTIwaW4lMjB0aGUlMjBwaWN0dXJlJTNGJTIyJTVEJTBBY2FuZGlkYXRlc190ZXh0cyUyMCUzRCUyMCU1QiU1QiUyMkhlbGxvJTIwd29ybGQhJTIyJTJDJTIwJTIyTmljZSUyMHRvJTIwbWVldCUyMHlvdSElMjIlNUQlMkMlMjAlNUIlMjJBJTIwY3V0ZSUyMGNhdC4lMjIlMkMlMjAlMjJBbiUyMGFkb3JhYmxlJTIwZG9nLiUyMiU1RCU1RCUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihpbnB1dF90ZXh0cyUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBY2FuZGlkYXRlc19pbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIuYmF0Y2hfZW5jb2RlX2NhbmRpZGF0ZXMoY2FuZGlkYXRlc190ZXh0cyUyQyUyMG1heF9sZW5ndGglM0QxMCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCUwQSUyMCUyMCUyMCUyMCoqaW5wdXRzJTJDJTBBJTIwJTIwJTIwJTIwY2FuZGlkYXRlX2lucHV0X2lkcyUzRGNhbmRpZGF0ZXNfaW5wdXRzLmlucHV0X2lkcyUyQyUwQSUyMCUyMCUyMCUyMGNhbmRpZGF0ZV9hdHRlbnRpb25fbWFzayUzRGNhbmRpZGF0ZXNfaW5wdXRzLmF0dGVudGlvbl9tYXNrJTJDJTBBJTIwJTIwJTIwJTIwY2FuZGlkYXRlX3Rva2VuX3R5cGVfaWRzJTNEY2FuZGlkYXRlc19pbnB1dHMudG9rZW5fdHlwZV9pZHMlMkMlMEEpJTBBcmVsZXZhbmNlX3Njb3JlJTIwJTNEJTIwb3V0cHV0cy5yZWxldmFuY2Vfc2NvcmU=",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> AutoTokenizer, RealmScorer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/realm-cc-news-pretrained-scorer&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = RealmScorer.from_pretrained(<span class="hljs-string">&quot;google/realm-cc-news-pretrained-scorer&quot;</span>, num_candidates=<span class="hljs-number">2</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># batch_size = 2, num_candidates = 2</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>input_texts = [<span class="hljs-string">&quot;How are you?&quot;</span>, <span class="hljs-string">&quot;What is the item in the picture?&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>candidates_texts = [[<span class="hljs-string">&quot;Hello world!&quot;</span>, <span class="hljs-string">&quot;Nice to meet you!&quot;</span>], [<span class="hljs-string">&quot;A cute cat.&quot;</span>, <span class="hljs-string">&quot;An adorable dog.&quot;</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(input_texts, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>candidates_inputs = tokenizer.batch_encode_candidates(candidates_texts, max_length=<span class="hljs-number">10</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(
<span class="hljs-meta">... </span>    **inputs,
<span class="hljs-meta">... </span>    candidate_input_ids=candidates_inputs.input_ids,
<span class="hljs-meta">... </span>    candidate_attention_mask=candidates_inputs.attention_mask,
<span class="hljs-meta">... </span>    candidate_token_type_ids=candidates_inputs.token_type_ids,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>relevance_score = outputs.relevance_score`,wrap:!1}}),{c(){a=r("p"),a.textContent=T,m=i(),g(c.$$.fragment)},l(o){a=s(o,"P",{"data-svelte-h":!0}),f(a)!=="svelte-11lpom8"&&(a.textContent=T),m=l(o),_(c.$$.fragment,o)},m(o,M){p(o,a,M),p(o,m,M),b(c,o,M),w=!0},p:E,i(o){w||(v(c.$$.fragment,o),w=!0)},o(o){k(c.$$.fragment,o),w=!1},d(o){o&&(n(a),n(m)),y(c,o)}}}function _a(R){let a,T=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){a=r("p"),a.innerHTML=T},l(m){a=s(m,"P",{"data-svelte-h":!0}),f(a)!=="svelte-fincs2"&&(a.innerHTML=T)},m(m,c){p(m,a,c)},p:E,d(m){m&&n(a)}}}function ba(R){let a,T="Example:",m,c,w;return c=new Ne({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMFJlYWxtS25vd2xlZGdlQXVnRW5jb2RlciUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnJlYWxtLWNjLW5ld3MtcHJldHJhaW5lZC1lbmNvZGVyJTIyKSUwQW1vZGVsJTIwJTNEJTIwUmVhbG1Lbm93bGVkZ2VBdWdFbmNvZGVyLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJnb29nbGUlMkZyZWFsbS1jYy1uZXdzLXByZXRyYWluZWQtZW5jb2RlciUyMiUyQyUyMG51bV9jYW5kaWRhdGVzJTNEMiUwQSklMEElMEElMjMlMjBiYXRjaF9zaXplJTIwJTNEJTIwMiUyQyUyMG51bV9jYW5kaWRhdGVzJTIwJTNEJTIwMiUwQXRleHQlMjAlM0QlMjAlNUIlNUIlMjJIZWxsbyUyMHdvcmxkISUyMiUyQyUyMCUyMk5pY2UlMjB0byUyMG1lZXQlMjB5b3UhJTIyJTVEJTJDJTIwJTVCJTIyVGhlJTIwY3V0ZSUyMGNhdC4lMjIlMkMlMjAlMjJUaGUlMjBhZG9yYWJsZSUyMGRvZy4lMjIlNUQlNUQlMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIuYmF0Y2hfZW5jb2RlX2NhbmRpZGF0ZXModGV4dCUyQyUyMG1heF9sZW5ndGglM0QxMCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",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> AutoTokenizer, RealmKnowledgeAugEncoder

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/realm-cc-news-pretrained-encoder&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = RealmKnowledgeAugEncoder.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;google/realm-cc-news-pretrained-encoder&quot;</span>, num_candidates=<span class="hljs-number">2</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># batch_size = 2, num_candidates = 2</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>text = [[<span class="hljs-string">&quot;Hello world!&quot;</span>, <span class="hljs-string">&quot;Nice to meet you!&quot;</span>], [<span class="hljs-string">&quot;The cute cat.&quot;</span>, <span class="hljs-string">&quot;The adorable dog.&quot;</span>]]

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer.batch_encode_candidates(text, max_length=<span class="hljs-number">10</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`,wrap:!1}}),{c(){a=r("p"),a.textContent=T,m=i(),g(c.$$.fragment)},l(o){a=s(o,"P",{"data-svelte-h":!0}),f(a)!=="svelte-11lpom8"&&(a.textContent=T),m=l(o),_(c.$$.fragment,o)},m(o,M){p(o,a,M),p(o,m,M),b(c,o,M),w=!0},p:E,i(o){w||(v(c.$$.fragment,o),w=!0)},o(o){k(c.$$.fragment,o),w=!1},d(o){o&&(n(a),n(m)),y(c,o)}}}function va(R){let a,T=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){a=r("p"),a.innerHTML=T},l(m){a=s(m,"P",{"data-svelte-h":!0}),f(a)!=="svelte-fincs2"&&(a.innerHTML=T)},m(m,c){p(m,a,c)},p:E,d(m){m&&n(a)}}}function ka(R){let a,T=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){a=r("p"),a.innerHTML=T},l(m){a=s(m,"P",{"data-svelte-h":!0}),f(a)!=="svelte-fincs2"&&(a.innerHTML=T)},m(m,c){p(m,a,c)},p:E,d(m){m&&n(a)}}}function ya(R){let a,T="Example:",m,c,w;return c=new Ne({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwUmVhbG1Gb3JPcGVuUUElMkMlMjBSZWFsbVJldHJpZXZlciUyQyUyMEF1dG9Ub2tlbml6ZXIlMEElMEFyZXRyaWV2ZXIlMjAlM0QlMjBSZWFsbVJldHJpZXZlci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGcmVhbG0tb3JxYS1ucS1vcGVucWElMjIpJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGcmVhbG0tb3JxYS1ucS1vcGVucWElMjIpJTBBbW9kZWwlMjAlM0QlMjBSZWFsbUZvck9wZW5RQS5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGcmVhbG0tb3JxYS1ucS1vcGVucWElMjIlMkMlMjByZXRyaWV2ZXIlM0RyZXRyaWV2ZXIpJTBBJTBBcXVlc3Rpb24lMjAlM0QlMjAlMjJXaG8lMjBpcyUyMHRoZSUyMHBpb25lZXIlMjBpbiUyMG1vZGVybiUyMGNvbXB1dGVyJTIwc2NpZW5jZSUzRiUyMiUwQXF1ZXN0aW9uX2lkcyUyMCUzRCUyMHRva2VuaXplciglNUJxdWVzdGlvbiU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBYW5zd2VyX2lkcyUyMCUzRCUyMHRva2VuaXplciglMEElMjAlMjAlMjAlMjAlNUIlMjJhbGFuJTIwbWF0aGlzb24lMjB0dXJpbmclMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBhZGRfc3BlY2lhbF90b2tlbnMlM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMHJldHVybl90b2tlbl90eXBlX2lkcyUzREZhbHNlJTJDJTBBJTIwJTIwJTIwJTIwcmV0dXJuX2F0dGVudGlvbl9tYXNrJTNERmFsc2UlMkMlMEEpLmlucHV0X2lkcyUwQSUwQXJlYWRlcl9vdXRwdXQlMkMlMjBwcmVkaWN0ZWRfYW5zd2VyX2lkcyUyMCUzRCUyMG1vZGVsKCoqcXVlc3Rpb25faWRzJTJDJTIwYW5zd2VyX2lkcyUzRGFuc3dlcl9pZHMlMkMlMjByZXR1cm5fZGljdCUzREZhbHNlKSUwQXByZWRpY3RlZF9hbnN3ZXIlMjAlM0QlMjB0b2tlbml6ZXIuZGVjb2RlKHByZWRpY3RlZF9hbnN3ZXJfaWRzKSUwQWxvc3MlMjAlM0QlMjByZWFkZXJfb3V0cHV0Lmxvc3M=",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> RealmForOpenQA, RealmRetriever, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>retriever = RealmRetriever.from_pretrained(<span class="hljs-string">&quot;google/realm-orqa-nq-openqa&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/realm-orqa-nq-openqa&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = RealmForOpenQA.from_pretrained(<span class="hljs-string">&quot;google/realm-orqa-nq-openqa&quot;</span>, retriever=retriever)

<span class="hljs-meta">&gt;&gt;&gt; </span>question = <span class="hljs-string">&quot;Who is the pioneer in modern computer science?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>question_ids = tokenizer([question], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_ids = tokenizer(
<span class="hljs-meta">... </span>    [<span class="hljs-string">&quot;alan mathison turing&quot;</span>],
<span class="hljs-meta">... </span>    add_special_tokens=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>    return_token_type_ids=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>    return_attention_mask=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>).input_ids

<span class="hljs-meta">&gt;&gt;&gt; </span>reader_output, predicted_answer_ids = model(**question_ids, answer_ids=answer_ids, return_dict=<span class="hljs-literal">False</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_answer = tokenizer.decode(predicted_answer_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = reader_output.loss`,wrap:!1}}),{c(){a=r("p"),a.textContent=T,m=i(),g(c.$$.fragment)},l(o){a=s(o,"P",{"data-svelte-h":!0}),f(a)!=="svelte-11lpom8"&&(a.textContent=T),m=l(o),_(c.$$.fragment,o)},m(o,M){p(o,a,M),p(o,m,M),b(c,o,M),w=!0},p:E,i(o){w||(v(c.$$.fragment,o),w=!0)},o(o){k(c.$$.fragment,o),w=!1},d(o){o&&(n(a),n(m)),y(c,o)}}}function wa(R){let a,T,m,c,w,o,M,Ve,Co,jt,Pr="REALM",Qn,Y,le,jn,Se,Uo,Jt,Qr="Overview",On,He,Or=`The REALM model was proposed in <a href="https://arxiv.org/abs/2002.08909" rel="nofollow">REALM: Retrieval-Augmented Language Model Pre-Training</a> by Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat and Ming-Wei Chang. It’s a
retrieval-augmented language model that firstly retrieves documents from a textual knowledge corpus and then
utilizes retrieved documents to process question answering tasks.`,Dn,Ge,Dr="The abstract from the paper is the following:",Yn,Be,Yr=`<em>Language model pre-training has been shown to capture a surprising amount of world knowledge, crucial for NLP tasks
such as question answering. However, this knowledge is stored implicitly in the parameters of a neural network,
requiring ever-larger networks to cover more facts. To capture knowledge in a more modular and interpretable way, we
augment language model pre-training with a latent knowledge retriever, which allows the model to retrieve and attend
over documents from a large corpus such as Wikipedia, used during pre-training, fine-tuning and inference. For the
first time, we show how to pre-train such a knowledge retriever in an unsupervised manner, using masked language
modeling as the learning signal and backpropagating through a retrieval step that considers millions of documents. We
demonstrate the effectiveness of Retrieval-Augmented Language Model pre-training (REALM) by fine-tuning on the
challenging task of Open-domain Question Answering (Open-QA). We compare against state-of-the-art models for both
explicit and implicit knowledge storage on three popular Open-QA benchmarks, and find that we outperform all previous
methods by a significant margin (4-16% absolute accuracy), while also providing qualitative benefits such as
interpretability and modularity.</em>`,Kn,Xe,Kr=`This model was contributed by <a href="https://huggingface.co/qqaatw" rel="nofollow">qqaatw</a>. The original code can be found
<a href="https://github.com/google-research/language/tree/master/language/realm" rel="nofollow">here</a>.`,eo,K,de,Jn,Pe,qo,Ct,es="RealmConfig",to,j,Qe,Io,Ut,ts="This is the configuration class to store the configuration of",Eo,qt,ns='<li><a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmEmbedder">RealmEmbedder</a></li> <li><a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmScorer">RealmScorer</a></li> <li><a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmKnowledgeAugEncoder">RealmKnowledgeAugEncoder</a></li> <li><a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmRetriever">RealmRetriever</a></li> <li><a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmReader">RealmReader</a></li> <li><a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmForOpenQA">RealmForOpenQA</a></li>',Lo,It,os=`It is used to instantiate an REALM model according to the specified arguments, defining the model architecture.
Instantiating a configuration with the defaults will yield a similar configuration to that of the REALM
<a href="https://huggingface.co/google/realm-cc-news-pretrained-embedder" rel="nofollow">google/realm-cc-news-pretrained-embedder</a>
architecture.`,Zo,Et,rs=`Configuration objects inherit from <a href="/docs/transformers/v4.34.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/v4.34.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Ao,ce,no,ee,me,Cn,Oe,Fo,Lt,ss="RealmTokenizer",oo,$,De,Wo,Zt,as="Construct a REALM tokenizer.",No,At,is=`<a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmTokenizer">RealmTokenizer</a> is identical to <a href="/docs/transformers/v4.34.0/en/model_doc/bert#transformers.BertTokenizer">BertTokenizer</a> and runs end-to-end tokenization: punctuation splitting and
wordpiece.`,Vo,Ft,ls=`This tokenizer inherits from <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a> which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`,So,X,Ye,Ho,Wt,ds=`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A REALM sequence has the following format:`,Go,Nt,cs="<li>single sequence: <code>[CLS] X [SEP]</code></li> <li>pair of sequences: <code>[CLS] A [SEP] B [SEP]</code></li>",Bo,pe,Ke,Xo,Vt,ms=`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer <code>prepare_for_model</code> method.`,Po,L,et,Qo,St,ps="Create a mask from the two sequences passed to be used in a sequence-pair classification task. A REALM sequence",Oo,he,Do,Ht,hs="If <code>token_ids_1</code> is <code>None</code>, this method only returns the first portion of the mask (0s).",Yo,Gt,tt,Ko,U,nt,er,Bt,fs=`Encode a batch of text or text pair. This method is similar to regular <strong>call</strong> method but has the following
differences:`,tr,Xt,us="<li>Handle additional num_candidate axis. (batch_size, num_candidates, text)</li> <li>Always pad the sequences to <em>max_length</em>.</li> <li>Must specify <em>max_length</em> in order to stack packs of candidates into a batch.</li>",nr,Pt,gs="<li>single sequence: <code>[CLS] X [SEP]</code></li> <li>pair of sequences: <code>[CLS] A [SEP] B [SEP]</code></li>",or,fe,ro,te,ue,Un,ot,rr,Qt,_s="RealmTokenizerFast",so,J,rt,sr,Ot,bs="Construct a “fast” REALM tokenizer (backed by HuggingFace’s <em>tokenizers</em> library). Based on WordPiece.",ar,Dt,vs=`<a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmTokenizerFast">RealmTokenizerFast</a> is identical to <a href="/docs/transformers/v4.34.0/en/model_doc/bert#transformers.BertTokenizerFast">BertTokenizerFast</a> and runs end-to-end tokenization: punctuation
splitting and wordpiece.`,ir,Yt,ks=`This tokenizer inherits from <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a> which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`,lr,q,st,dr,Kt,ys=`Encode a batch of text or text pair. This method is similar to regular <strong>call</strong> method but has the following
differences:`,cr,en,ws="<li>Handle additional num_candidate axis. (batch_size, num_candidates, text)</li> <li>Always pad the sequences to <em>max_length</em>.</li> <li>Must specify <em>max_length</em> in order to stack packs of candidates into a batch.</li>",mr,tn,Ts="<li>single sequence: <code>[CLS] X [SEP]</code></li> <li>pair of sequences: <code>[CLS] A [SEP] B [SEP]</code></li>",pr,ge,ao,ne,_e,qn,at,hr,nn,Ms="RealmRetriever",io,N,it,fr,on,Rs=`The retriever of REALM outputting the retrieved evidence block and whether the block has answers as well as answer
positions.”`,ur,be,lt,gr,rn,$s="check if retrieved_blocks has answers.",lo,oe,ve,In,dt,_r,sn,xs="RealmEmbedder",co,V,ct,br,an,zs=`The embedder of REALM outputting projected score that will be used to calculate relevance score.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,vr,Z,mt,kr,ln,js='The <a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmEmbedder">RealmEmbedder</a> forward method, overrides the <code>__call__</code> special method.',yr,ke,wr,ye,mo,re,we,En,pt,Tr,dn,Js="RealmScorer",po,S,ht,Mr,cn,Cs=`The scorer of REALM outputting relevance scores representing the score of document candidates (before softmax).
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,Rr,A,ft,$r,mn,Us='The <a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmScorer">RealmScorer</a> forward method, overrides the <code>__call__</code> special method.',xr,Te,zr,Me,ho,se,Re,Ln,ut,jr,pn,qs="RealmKnowledgeAugEncoder",fo,H,gt,Jr,hn,Is=`The knowledge-augmented encoder of REALM outputting masked language model logits and marginal log-likelihood loss.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,Cr,F,_t,Ur,fn,Es='The <a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmKnowledgeAugEncoder">RealmKnowledgeAugEncoder</a> forward method, overrides the <code>__call__</code> special method.',qr,$e,Ir,xe,uo,ae,ze,Zn,bt,Er,un,Ls="RealmReader",go,G,vt,Lr,gn,Zs=`The reader of REALM.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,Zr,P,kt,Ar,_n,As='The <a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmReader">RealmReader</a> forward method, overrides the <code>__call__</code> special method.',Fr,je,_o,ie,Je,An,yt,Wr,bn,Fs="RealmForOpenQA",bo,I,wt,Nr,vn,Ws=`<code>RealmForOpenQA</code> for end-to-end open domain question answering.
This model is a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`,Vr,Ce,Tt,Sr,kn,Ns="Send <code>self.block_emb</code> to a specific device.",Hr,W,Mt,Gr,yn,Vs='The <a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmForOpenQA">RealmForOpenQA</a> forward method, overrides the <code>__call__</code> special method.',Br,Ue,Xr,qe,vo,Fn,ko;return Ve=new B({}),Se=new B({}),Pe=new B({}),Qe=new x({props:{name:"class transformers.RealmConfig",anchor:"transformers.RealmConfig",parameters:[{name:"vocab_size",val:" = 30522"},{name:"hidden_size",val:" = 768"},{name:"retriever_proj_size",val:" = 128"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"num_candidates",val:" = 8"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu_new'"},{name:"hidden_dropout_prob",val:" = 0.1"},{name:"attention_probs_dropout_prob",val:" = 0.1"},{name:"max_position_embeddings",val:" = 512"},{name:"type_vocab_size",val:" = 2"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"span_hidden_size",val:" = 256"},{name:"max_span_width",val:" = 10"},{name:"reader_layer_norm_eps",val:" = 0.001"},{name:"reader_beam_size",val:" = 5"},{name:"reader_seq_len",val:" = 320"},{name:"num_block_records",val:" = 13353718"},{name:"searcher_beam_size",val:" = 5000"},{name:"pad_token_id",val:" = 1"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 2"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.RealmConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
Vocabulary size of the REALM model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmEmbedder">RealmEmbedder</a>, <a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmScorer">RealmScorer</a>, <a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmKnowledgeAugEncoder">RealmKnowledgeAugEncoder</a>, or
<a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmReader">RealmReader</a>.`,name:"vocab_size"},{anchor:"transformers.RealmConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimension of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.RealmConfig.retriever_proj_size",description:`<strong>retriever_proj_size</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
Dimension of the retriever(embedder) projection.`,name:"retriever_proj_size"},{anchor:"transformers.RealmConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.RealmConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.RealmConfig.num_candidates",description:`<strong>num_candidates</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
Number of candidates inputted to the RealmScorer or RealmKnowledgeAugEncoder.`,name:"num_candidates"},{anchor:"transformers.RealmConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimension of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.RealmConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu_new&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.RealmConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.RealmConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.RealmConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.RealmConfig.type_vocab_size",description:`<strong>type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The vocabulary size of the <code>token_type_ids</code> passed when calling <a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmEmbedder">RealmEmbedder</a>, <a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmScorer">RealmScorer</a>,
<a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmKnowledgeAugEncoder">RealmKnowledgeAugEncoder</a>, or <a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmReader">RealmReader</a>.`,name:"type_vocab_size"},{anchor:"transformers.RealmConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.RealmConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.RealmConfig.span_hidden_size",description:`<strong>span_hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 256) &#x2014;
Dimension of the reader&#x2019;s spans.`,name:"span_hidden_size"},{anchor:"transformers.RealmConfig.max_span_width",description:`<strong>max_span_width</strong> (<code>int</code>, <em>optional</em>, defaults to 10) &#x2014;
Max span width of the reader.`,name:"max_span_width"},{anchor:"transformers.RealmConfig.reader_layer_norm_eps",description:`<strong>reader_layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-3) &#x2014;
The epsilon used by the reader&#x2019;s layer normalization layers.`,name:"reader_layer_norm_eps"},{anchor:"transformers.RealmConfig.reader_beam_size",description:`<strong>reader_beam_size</strong> (<code>int</code>, <em>optional</em>, defaults to 5) &#x2014;
Beam size of the reader.`,name:"reader_beam_size"},{anchor:"transformers.RealmConfig.reader_seq_len",description:`<strong>reader_seq_len</strong> (<code>int</code>, <em>optional</em>, defaults to 288+32) &#x2014;
Maximum sequence length of the reader.`,name:"reader_seq_len"},{anchor:"transformers.RealmConfig.num_block_records",description:`<strong>num_block_records</strong> (<code>int</code>, <em>optional</em>, defaults to 13353718) &#x2014;
Number of block records.`,name:"num_block_records"},{anchor:"transformers.RealmConfig.searcher_beam_size",description:`<strong>searcher_beam_size</strong> (<code>int</code>, <em>optional</em>, defaults to 5000) &#x2014;
Beam size of the searcher. Note that when eval mode is enabled, <em>searcher_beam_size</em> will be the same as
<em>reader_beam_size</em>.`,name:"searcher_beam_size"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/configuration_realm.py#L44"}}),ce=new We({props:{anchor:"transformers.RealmConfig.example",$$slots:{default:[da]},$$scope:{ctx:R}}}),Oe=new B({}),De=new x({props:{name:"class transformers.RealmTokenizer",anchor:"transformers.RealmTokenizer",parameters:[{name:"vocab_file",val:""},{name:"do_lower_case",val:" = True"},{name:"do_basic_tokenize",val:" = True"},{name:"never_split",val:" = None"},{name:"unk_token",val:" = '[UNK]'"},{name:"sep_token",val:" = '[SEP]'"},{name:"pad_token",val:" = '[PAD]'"},{name:"cls_token",val:" = '[CLS]'"},{name:"mask_token",val:" = '[MASK]'"},{name:"tokenize_chinese_chars",val:" = True"},{name:"strip_accents",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.RealmTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
File containing the vocabulary.`,name:"vocab_file"},{anchor:"transformers.RealmTokenizer.do_lower_case",description:`<strong>do_lower_case</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to lowercase the input when tokenizing.`,name:"do_lower_case"},{anchor:"transformers.RealmTokenizer.do_basic_tokenize",description:`<strong>do_basic_tokenize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to do basic tokenization before WordPiece.`,name:"do_basic_tokenize"},{anchor:"transformers.RealmTokenizer.never_split",description:`<strong>never_split</strong> (<code>Iterable</code>, <em>optional</em>) &#x2014;
Collection of tokens which will never be split during tokenization. Only has an effect when
<code>do_basic_tokenize=True</code>`,name:"never_split"},{anchor:"transformers.RealmTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[UNK]&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.RealmTokenizer.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[SEP]&quot;</code>) &#x2014;
The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
sequence classification or for a text and a question for question answering. It is also used as the last
token of a sequence built with special tokens.`,name:"sep_token"},{anchor:"transformers.RealmTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[PAD]&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.RealmTokenizer.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[CLS]&quot;</code>) &#x2014;
The classifier token which is used when doing sequence classification (classification of the whole sequence
instead of per-token classification). It is the first token of the sequence when built with special tokens.`,name:"cls_token"},{anchor:"transformers.RealmTokenizer.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[MASK]&quot;</code>) &#x2014;
The token used for masking values. This is the token used when training this model with masked language
modeling. This is the token which the model will try to predict.`,name:"mask_token"},{anchor:"transformers.RealmTokenizer.tokenize_chinese_chars",description:`<strong>tokenize_chinese_chars</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to tokenize Chinese characters.</p>
<p>This should likely be deactivated for Japanese (see this
<a href="https://github.com/huggingface/transformers/issues/328" rel="nofollow">issue</a>).`,name:"tokenize_chinese_chars"},{anchor:"transformers.RealmTokenizer.strip_accents",description:`<strong>strip_accents</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to strip all accents. If this option is not specified, then it will be determined by the
value for <code>lowercase</code> (as in the original BERT).`,name:"strip_accents"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/tokenization_realm.py#L95"}}),Ye=new x({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.RealmTokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.RealmTokenizer.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.RealmTokenizer.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/tokenization_realm.py#L300",returnDescription:`
<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Ke=new x({props:{name:"get_special_tokens_mask",anchor:"transformers.RealmTokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.RealmTokenizer.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.RealmTokenizer.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"},{anchor:"transformers.RealmTokenizer.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/tokenization_realm.py#L325",returnDescription:`
<p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),et=new x({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.RealmTokenizer.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.RealmTokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.RealmTokenizer.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/tokenization_realm.py#L353",returnDescription:`
<p>List of <a href="../glossary#token-type-ids">token type IDs</a> according to the given sequence(s).</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),he=new We({props:{anchor:"transformers.RealmTokenizer.create_token_type_ids_from_sequences.example",$$slots:{default:[ca]},$$scope:{ctx:R}}}),tt=new x({props:{name:"save_vocabulary",anchor:"transformers.RealmTokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/tokenization_realm.py#L382"}}),nt=new x({props:{name:"batch_encode_candidates",anchor:"transformers.RealmTokenizer.batch_encode_candidates",parameters:[{name:"text",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.RealmTokenizer.batch_encode_candidates.text",description:`<strong>text</strong> (<code>List[List[str]]</code>) &#x2014;
The batch of sequences to be encoded. Each sequence must be in this format: (batch_size,
num_candidates, text).`,name:"text"},{anchor:"transformers.RealmTokenizer.batch_encode_candidates.text_pair",description:`<strong>text_pair</strong> (<code>List[List[str]]</code>, <em>optional</em>) &#x2014;
The batch of sequences to be encoded. Each sequence must be in this format: (batch_size,
num_candidates, text).
**kwargs &#x2014;
Keyword arguments of the <strong>call</strong> method.`,name:"text_pair"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/tokenization_realm.py#L227",returnDescription:`
<p>Encoded text or text pair.</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),fe=new We({props:{anchor:"transformers.RealmTokenizer.batch_encode_candidates.example",$$slots:{default:[ma]},$$scope:{ctx:R}}}),ot=new B({}),rt=new x({props:{name:"class transformers.RealmTokenizerFast",anchor:"transformers.RealmTokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"do_lower_case",val:" = True"},{name:"unk_token",val:" = '[UNK]'"},{name:"sep_token",val:" = '[SEP]'"},{name:"pad_token",val:" = '[PAD]'"},{name:"cls_token",val:" = '[CLS]'"},{name:"mask_token",val:" = '[MASK]'"},{name:"tokenize_chinese_chars",val:" = True"},{name:"strip_accents",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.RealmTokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
File containing the vocabulary.`,name:"vocab_file"},{anchor:"transformers.RealmTokenizerFast.do_lower_case",description:`<strong>do_lower_case</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to lowercase the input when tokenizing.`,name:"do_lower_case"},{anchor:"transformers.RealmTokenizerFast.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[UNK]&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.RealmTokenizerFast.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[SEP]&quot;</code>) &#x2014;
The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
sequence classification or for a text and a question for question answering. It is also used as the last
token of a sequence built with special tokens.`,name:"sep_token"},{anchor:"transformers.RealmTokenizerFast.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[PAD]&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.RealmTokenizerFast.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[CLS]&quot;</code>) &#x2014;
The classifier token which is used when doing sequence classification (classification of the whole sequence
instead of per-token classification). It is the first token of the sequence when built with special tokens.`,name:"cls_token"},{anchor:"transformers.RealmTokenizerFast.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[MASK]&quot;</code>) &#x2014;
The token used for masking values. This is the token used when training this model with masked language
modeling. This is the token which the model will try to predict.`,name:"mask_token"},{anchor:"transformers.RealmTokenizerFast.clean_text",description:`<strong>clean_text</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to clean the text before tokenization by removing any control characters and replacing all
whitespaces by the classic one.`,name:"clean_text"},{anchor:"transformers.RealmTokenizerFast.tokenize_chinese_chars",description:`<strong>tokenize_chinese_chars</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to tokenize Chinese characters. This should likely be deactivated for Japanese (see <a href="https://github.com/huggingface/transformers/issues/328" rel="nofollow">this
issue</a>).`,name:"tokenize_chinese_chars"},{anchor:"transformers.RealmTokenizerFast.strip_accents",description:`<strong>strip_accents</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to strip all accents. If this option is not specified, then it will be determined by the
value for <code>lowercase</code> (as in the original BERT).`,name:"strip_accents"},{anchor:"transformers.RealmTokenizerFast.wordpieces_prefix",description:`<strong>wordpieces_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;##&quot;</code>) &#x2014;
The prefix for subwords.`,name:"wordpieces_prefix"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/tokenization_realm_fast.py#L102"}}),st=new x({props:{name:"batch_encode_candidates",anchor:"transformers.RealmTokenizerFast.batch_encode_candidates",parameters:[{name:"text",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.RealmTokenizerFast.batch_encode_candidates.text",description:`<strong>text</strong> (<code>List[List[str]]</code>) &#x2014;
The batch of sequences to be encoded. Each sequence must be in this format: (batch_size,
num_candidates, text).`,name:"text"},{anchor:"transformers.RealmTokenizerFast.batch_encode_candidates.text_pair",description:`<strong>text_pair</strong> (<code>List[List[str]]</code>, <em>optional</em>) &#x2014;
The batch of sequences to be encoded. Each sequence must be in this format: (batch_size,
num_candidates, text).
**kwargs &#x2014;
Keyword arguments of the <strong>call</strong> method.`,name:"text_pair"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/tokenization_realm_fast.py#L193",returnDescription:`
<p>Encoded text or text pair.</p>
`,returnType:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.BatchEncoding"
>BatchEncoding</a></p>
`}}),ge=new We({props:{anchor:"transformers.RealmTokenizerFast.batch_encode_candidates.example",$$slots:{default:[pa]},$$scope:{ctx:R}}}),at=new B({}),it=new x({props:{name:"class transformers.RealmRetriever",anchor:"transformers.RealmRetriever",parameters:[{name:"block_records",val:""},{name:"tokenizer",val:""}],parametersDescription:[{anchor:"transformers.RealmRetriever.block_records",description:`<strong>block_records</strong> (<code>np.ndarray</code>) &#x2014;
A numpy array which cantains evidence texts.`,name:"block_records"},{anchor:"transformers.RealmRetriever.tokenizer",description:`<strong>tokenizer</strong> (<a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmTokenizer">RealmTokenizer</a>) &#x2014;
The tokenizer to encode retrieved texts.`,name:"tokenizer"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/retrieval_realm.py#L72"}}),lt=new x({props:{name:"block_has_answer",anchor:"transformers.RealmRetriever.block_has_answer",parameters:[{name:"concat_inputs",val:""},{name:"answer_ids",val:""}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/retrieval_realm.py#L129"}}),dt=new B({}),ct=new x({props:{name:"class transformers.RealmEmbedder",anchor:"transformers.RealmEmbedder",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.RealmEmbedder.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmConfig">RealmConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.34.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/modeling_realm.py#L1151"}}),mt=new x({props:{name:"forward",anchor:"transformers.RealmEmbedder.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.RealmEmbedder.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.RealmEmbedder.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.RealmEmbedder.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.RealmEmbedder.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.RealmEmbedder.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.RealmEmbedder.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.RealmEmbedder.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.RealmEmbedder.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.RealmEmbedder.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/modeling_realm.py#L1167",returnDescription:`
<p>A <code>transformers.models.realm.modeling_realm.RealmEmbedderOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmConfig"
>RealmConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>projected_score</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.retriever_proj_size)</code>) — Projected score.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.realm.modeling_realm.RealmEmbedderOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ke=new Pn({props:{$$slots:{default:[ha]},$$scope:{ctx:R}}}),ye=new We({props:{anchor:"transformers.RealmEmbedder.forward.example",$$slots:{default:[fa]},$$scope:{ctx:R}}}),pt=new B({}),ht=new x({props:{name:"class transformers.RealmScorer",anchor:"transformers.RealmScorer",parameters:[{name:"config",val:""},{name:"query_embedder",val:" = None"}],parametersDescription:[{anchor:"transformers.RealmScorer.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmConfig">RealmConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.34.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"},{anchor:"transformers.RealmScorer.query_embedder",description:`<strong>query_embedder</strong> (<a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmEmbedder">RealmEmbedder</a>) &#x2014;
Embedder for input sequences. If not specified, it will use the same embedder as candidate sequences.`,name:"query_embedder"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/modeling_realm.py#L1233"}}),ft=new x({props:{name:"forward",anchor:"transformers.RealmScorer.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"candidate_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"candidate_attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"candidate_token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"candidate_inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.RealmScorer.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.RealmScorer.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.RealmScorer.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.RealmScorer.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.RealmScorer.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.RealmScorer.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.RealmScorer.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.RealmScorer.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.RealmScorer.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.RealmScorer.forward.candidate_input_ids",description:`<strong>candidate_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_candidates, sequence_length)</code>) &#x2014;
Indices of candidate input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"candidate_input_ids"},{anchor:"transformers.RealmScorer.forward.candidate_attention_mask",description:`<strong>candidate_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_candidates, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"candidate_attention_mask"},{anchor:"transformers.RealmScorer.forward.candidate_token_type_ids",description:`<strong>candidate_token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_candidates, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"candidate_token_type_ids"},{anchor:"transformers.RealmScorer.forward.candidate_inputs_embeds",description:`<strong>candidate_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size * num_candidates, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>candidate_input_ids</code> you can choose to directly pass an embedded
representation. This is useful if you want more control over how to convert <em>candidate_input_ids</em> indices
into associated vectors than the model&#x2019;s internal embedding lookup matrix.`,name:"candidate_inputs_embeds"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/modeling_realm.py#L1249",returnDescription:`
<p>A <code>transformers.models.realm.modeling_realm.RealmScorerOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmConfig"
>RealmConfig</a>) and inputs.</p>
<ul>
<li><strong>relevance_score</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_candidates)</code>) — The relevance score of document candidates (before softmax).</li>
<li><strong>query_score</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.retriever_proj_size)</code>) — Query score derived from the query embedder.</li>
<li><strong>candidate_score</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_candidates, config.retriever_proj_size)</code>) — Candidate score derived from the embedder.</li>
</ul>
`,returnType:`
<p><code>transformers.models.realm.modeling_realm.RealmScorerOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Te=new Pn({props:{$$slots:{default:[ua]},$$scope:{ctx:R}}}),Me=new We({props:{anchor:"transformers.RealmScorer.forward.example",$$slots:{default:[ga]},$$scope:{ctx:R}}}),ut=new B({}),gt=new x({props:{name:"class transformers.RealmKnowledgeAugEncoder",anchor:"transformers.RealmKnowledgeAugEncoder",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.RealmKnowledgeAugEncoder.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmConfig">RealmConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.34.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/modeling_realm.py#L1381"}}),_t=new x({props:{name:"forward",anchor:"transformers.RealmKnowledgeAugEncoder.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"relevance_score",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"mlm_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.RealmKnowledgeAugEncoder.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_candidates, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.RealmKnowledgeAugEncoder.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_candidates, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.RealmKnowledgeAugEncoder.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_candidates, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.RealmKnowledgeAugEncoder.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_candidates, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.RealmKnowledgeAugEncoder.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.RealmKnowledgeAugEncoder.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_candidates, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.RealmKnowledgeAugEncoder.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.RealmKnowledgeAugEncoder.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.RealmKnowledgeAugEncoder.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.RealmKnowledgeAugEncoder.forward.relevance_score",description:`<strong>relevance_score</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_candidates)</code>, <em>optional</em>) &#x2014;
Relevance score derived from RealmScorer, must be specified if you want to compute the masked language
modeling loss.`,name:"relevance_score"},{anchor:"transformers.RealmKnowledgeAugEncoder.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored (masked), the
loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"},{anchor:"transformers.RealmKnowledgeAugEncoder.forward.mlm_mask",description:`<strong>mlm_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid calculating joint loss on certain positions. If not specified, the loss will not be masked.
Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>`,name:"mlm_mask"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/modeling_realm.py#L1402",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmConfig"
>RealmConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Masked language modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),$e=new Pn({props:{$$slots:{default:[_a]},$$scope:{ctx:R}}}),xe=new We({props:{anchor:"transformers.RealmKnowledgeAugEncoder.forward.example",$$slots:{default:[ba]},$$scope:{ctx:R}}}),bt=new B({}),vt=new x({props:{name:"class transformers.RealmReader",anchor:"transformers.RealmReader",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.RealmReader.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmConfig">RealmConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.34.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/modeling_realm.py#L1531"}}),kt=new x({props:{name:"forward",anchor:"transformers.RealmReader.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"relevance_score",val:": typing.Optional[torch.FloatTensor] = None"},{name:"block_mask",val:": typing.Optional[torch.BoolTensor] = None"},{name:"start_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"end_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"has_answers",val:": typing.Optional[torch.BoolTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.RealmReader.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(reader_beam_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.RealmReader.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(reader_beam_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.RealmReader.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(reader_beam_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.RealmReader.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(reader_beam_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.RealmReader.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.RealmReader.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(reader_beam_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.RealmReader.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.RealmReader.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.RealmReader.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.RealmReader.forward.relevance_score",description:`<strong>relevance_score</strong> (<code>torch.FloatTensor</code> of shape <code>(searcher_beam_size,)</code>, <em>optional</em>) &#x2014;
Relevance score, which must be specified if you want to compute the logits and marginal log loss.`,name:"relevance_score"},{anchor:"transformers.RealmReader.forward.block_mask",description:`<strong>block_mask</strong> (<code>torch.BoolTensor</code> of shape <code>(searcher_beam_size, sequence_length)</code>, <em>optional</em>) &#x2014;
The mask of the evidence block, which must be specified if you want to compute the logits and marginal log
loss.`,name:"block_mask"},{anchor:"transformers.RealmReader.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(searcher_beam_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the start of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.RealmReader.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(searcher_beam_size,)</code>, <em>optional</em>) &#x2014;
Labels for position (index) of the end of the labelled span for computing the token classification loss.
Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence
are not taken into account for computing the loss.`,name:"end_positions"},{anchor:"transformers.RealmReader.forward.has_answers",description:`<strong>has_answers</strong> (<code>torch.BoolTensor</code> of shape <code>(searcher_beam_size,)</code>, <em>optional</em>) &#x2014;
Whether or not the evidence block has answer(s).`,name:"has_answers"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/modeling_realm.py#L1542",returnDescription:`
<p>A <code>transformers.models.realm.modeling_realm.RealmReaderOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmConfig"
>RealmConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>start_positions</code>, <code>end_positions</code>, <code>has_answers</code> are provided) — Total loss.</p>
</li>
<li>
<p><strong>retriever_loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>start_positions</code>, <code>end_positions</code>, <code>has_answers</code> are provided) — Retriever loss.</p>
</li>
<li>
<p><strong>reader_loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>start_positions</code>, <code>end_positions</code>, <code>has_answers</code> are provided) — Reader loss.</p>
</li>
<li>
<p><strong>retriever_correct</strong> (<code>torch.BoolTensor</code> of shape <code>(config.searcher_beam_size,)</code>, <em>optional</em>) — Whether or not an evidence block contains answer.</p>
</li>
<li>
<p><strong>reader_correct</strong> (<code>torch.BoolTensor</code> of shape <code>(config.reader_beam_size, num_candidates)</code>, <em>optional</em>) — Whether or not a span candidate contains answer.</p>
</li>
<li>
<p><strong>block_idx</strong> (<code>torch.LongTensor</code> of shape <code>()</code>) — The index of the retrieved evidence block in which the predicted answer is most likely.</p>
</li>
<li>
<p><strong>candidate</strong> (<code>torch.LongTensor</code> of shape <code>()</code>) — The index of the retrieved span candidates in which the predicted answer is most likely.</p>
</li>
<li>
<p><strong>start_pos</strong> (<code>torch.IntTensor</code> of shape <code>()</code>) — Predicted answer starting position in <em>RealmReader</em>’s inputs.</p>
</li>
<li>
<p><strong>end_pos</strong> (<code>torch.IntTensor</code> of shape <code>()</code>) — Predicted answer ending position in <em>RealmReader</em>’s inputs.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.models.realm.modeling_realm.RealmReaderOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),je=new Pn({props:{$$slots:{default:[va]},$$scope:{ctx:R}}}),yt=new B({}),wt=new x({props:{name:"class transformers.RealmForOpenQA",anchor:"transformers.RealmForOpenQA",parameters:[{name:"config",val:""},{name:"retriever",val:" = None"}],parametersDescription:[{anchor:"transformers.RealmForOpenQA.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmConfig">RealmConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.34.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/modeling_realm.py#L1735"}}),Tt=new x({props:{name:"block_embedding_to",anchor:"transformers.RealmForOpenQA.block_embedding_to",parameters:[{name:"device",val:""}],parametersDescription:[{anchor:"transformers.RealmForOpenQA.block_embedding_to.device",description:`<strong>device</strong> (<code>str</code> or <code>torch.device</code>) &#x2014;
The device to which <code>self.block_emb</code> will be sent.`,name:"device"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/modeling_realm.py#L1758"}}),Mt=new x({props:{name:"forward",anchor:"transformers.RealmForOpenQA.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor]"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"answer_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.RealmForOpenQA.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(1, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.RealmForOpenQA.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(1, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.RealmForOpenQA.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(1, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token (should not be used in this model by design).</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.RealmForOpenQA.forward.answer_ids",description:`<strong>answer_ids</strong> (<code>list</code> of shape <code>(num_answers, answer_length)</code>, <em>optional</em>) &#x2014;
Answer ids for computing the marginal log-likelihood loss. Indices should be in <code>[-1, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-1</code> are ignored (masked), the
loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"answer_ids"},{anchor:"transformers.RealmForOpenQA.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.34.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/realm/modeling_realm.py#L1768",returnDescription:`
<p>A <code>transformers.models.realm.modeling_realm.RealmForOpenQAOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.34.0/en/model_doc/realm#transformers.RealmConfig"
>RealmConfig</a>) and inputs.</p>
<ul>
<li><strong>reader_output</strong> (<code>dict</code>) — Reader output.</li>
<li><strong>predicted_answer_ids</strong> (<code>torch.LongTensor</code> of shape <code>(answer_sequence_length)</code>) — Predicted answer ids.</li>
</ul>
`,returnType:`
<p><code>transformers.models.realm.modeling_realm.RealmForOpenQAOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ue=new Pn({props:{$$slots:{default:[ka]},$$scope:{ctx:R}}}),qe=new We({props:{anchor:"transformers.RealmForOpenQA.forward.example",$$slots:{default:[ya]},$$scope:{ctx:R}}}),{c(){a=r("meta"),T=i(),m=r("p"),c=i(),w=r("h1"),o=r("a"),M=r("span"),g(Ve.$$.fragment),Co=i(),jt=r("span"),jt.textContent=Pr,Qn=i(),Y=r("h2"),le=r("a"),jn=r("span"),g(Se.$$.fragment),Uo=i(),Jt=r("span"),Jt.textContent=Qr,On=i(),He=r("p"),He.innerHTML=Or,Dn=i(),Ge=r("p"),Ge.textContent=Dr,Yn=i(),Be=r("p"),Be.innerHTML=Yr,Kn=i(),Xe=r("p"),Xe.innerHTML=Kr,eo=i(),K=r("h2"),de=r("a"),Jn=r("span"),g(Pe.$$.fragment),qo=i(),Ct=r("span"),Ct.textContent=es,to=i(),j=r("div"),g(Qe.$$.fragment),Io=i(),Ut=r("p"),Ut.textContent=ts,Eo=i(),qt=r("ol"),qt.innerHTML=ns,Lo=i(),It=r("p"),It.innerHTML=os,Zo=i(),Et=r("p"),Et.innerHTML=rs,Ao=i(),g(ce.$$.fragment),no=i(),ee=r("h2"),me=r("a"),Cn=r("span"),g(Oe.$$.fragment),Fo=i(),Lt=r("span"),Lt.textContent=ss,oo=i(),$=r("div"),g(De.$$.fragment),Wo=i(),Zt=r("p"),Zt.textContent=as,No=i(),At=r("p"),At.innerHTML=is,Vo=i(),Ft=r("p"),Ft.innerHTML=ls,So=i(),X=r("div"),g(Ye.$$.fragment),Ho=i(),Wt=r("p"),Wt.textContent=ds,Go=i(),Nt=r("ul"),Nt.innerHTML=cs,Bo=i(),pe=r("div"),g(Ke.$$.fragment),Xo=i(),Vt=r("p"),Vt.innerHTML=ms,Po=i(),L=r("div"),g(et.$$.fragment),Qo=i(),St=r("p"),St.textContent=ps,Oo=i(),g(he.$$.fragment),Do=i(),Ht=r("p"),Ht.innerHTML=hs,Yo=i(),Gt=r("div"),g(tt.$$.fragment),Ko=i(),U=r("div"),g(nt.$$.fragment),er=i(),Bt=r("p"),Bt.innerHTML=fs,tr=i(),Xt=r("ol"),Xt.innerHTML=us,nr=i(),Pt=r("ul"),Pt.innerHTML=gs,or=i(),g(fe.$$.fragment),ro=i(),te=r("h2"),ue=r("a"),Un=r("span"),g(ot.$$.fragment),rr=i(),Qt=r("span"),Qt.textContent=_s,so=i(),J=r("div"),g(rt.$$.fragment),sr=i(),Ot=r("p"),Ot.innerHTML=bs,ar=i(),Dt=r("p"),Dt.innerHTML=vs,ir=i(),Yt=r("p"),Yt.innerHTML=ks,lr=i(),q=r("div"),g(st.$$.fragment),dr=i(),Kt=r("p"),Kt.innerHTML=ys,cr=i(),en=r("ol"),en.innerHTML=ws,mr=i(),tn=r("ul"),tn.innerHTML=Ts,pr=i(),g(ge.$$.fragment),ao=i(),ne=r("h2"),_e=r("a"),qn=r("span"),g(at.$$.fragment),hr=i(),nn=r("span"),nn.textContent=Ms,io=i(),N=r("div"),g(it.$$.fragment),fr=i(),on=r("p"),on.textContent=Rs,ur=i(),be=r("div"),g(lt.$$.fragment),gr=i(),rn=r("p"),rn.textContent=$s,lo=i(),oe=r("h2"),ve=r("a"),In=r("span"),g(dt.$$.fragment),_r=i(),sn=r("span"),sn.textContent=xs,co=i(),V=r("div"),g(ct.$$.fragment),br=i(),an=r("p"),an.innerHTML=zs,vr=i(),Z=r("div"),g(mt.$$.fragment),kr=i(),ln=r("p"),ln.innerHTML=js,yr=i(),g(ke.$$.fragment),wr=i(),g(ye.$$.fragment),mo=i(),re=r("h2"),we=r("a"),En=r("span"),g(pt.$$.fragment),Tr=i(),dn=r("span"),dn.textContent=Js,po=i(),S=r("div"),g(ht.$$.fragment),Mr=i(),cn=r("p"),cn.innerHTML=Cs,Rr=i(),A=r("div"),g(ft.$$.fragment),$r=i(),mn=r("p"),mn.innerHTML=Us,xr=i(),g(Te.$$.fragment),zr=i(),g(Me.$$.fragment),ho=i(),se=r("h2"),Re=r("a"),Ln=r("span"),g(ut.$$.fragment),jr=i(),pn=r("span"),pn.textContent=qs,fo=i(),H=r("div"),g(gt.$$.fragment),Jr=i(),hn=r("p"),hn.innerHTML=Is,Cr=i(),F=r("div"),g(_t.$$.fragment),Ur=i(),fn=r("p"),fn.innerHTML=Es,qr=i(),g($e.$$.fragment),Ir=i(),g(xe.$$.fragment),uo=i(),ae=r("h2"),ze=r("a"),Zn=r("span"),g(bt.$$.fragment),Er=i(),un=r("span"),un.textContent=Ls,go=i(),G=r("div"),g(vt.$$.fragment),Lr=i(),gn=r("p"),gn.innerHTML=Zs,Zr=i(),P=r("div"),g(kt.$$.fragment),Ar=i(),_n=r("p"),_n.innerHTML=As,Fr=i(),g(je.$$.fragment),_o=i(),ie=r("h2"),Je=r("a"),An=r("span"),g(yt.$$.fragment),Wr=i(),bn=r("span"),bn.textContent=Fs,bo=i(),I=r("div"),g(wt.$$.fragment),Nr=i(),vn=r("p"),vn.innerHTML=Ws,Vr=i(),Ce=r("div"),g(Tt.$$.fragment),Sr=i(),kn=r("p"),kn.innerHTML=Ns,Hr=i(),W=r("div"),g(Mt.$$.fragment),Gr=i(),yn=r("p"),yn.innerHTML=Vs,Br=i(),g(Ue.$$.fragment),Xr=i(),g(qe.$$.fragment),vo=i(),Fn=r("p"),this.h()},l(e){const d=la("svelte-1phssyn",document.head);a=s(d,"META",{name:!0,content:!0}),d.forEach(n),T=l(e),m=s(e,"P",{}),u(m).forEach(n),c=l(e),w=s(e,"H1",{class:!0});var Rt=u(w);o=s(Rt,"A",{id:!0,class:!0,href:!0});var Wn=u(o);M=s(Wn,"SPAN",{});var Nn=u(M);_(Ve.$$.fragment,Nn),Nn.forEach(n),Wn.forEach(n),Co=l(Rt),jt=s(Rt,"SPAN",{"data-svelte-h":!0}),f(jt)!=="svelte-1t9q8u8"&&(jt.textContent=Pr),Rt.forEach(n),Qn=l(e),Y=s(e,"H2",{class:!0});var $t=u(Y);le=s($t,"A",{id:!0,class:!0,href:!0});var Vn=u(le);jn=s(Vn,"SPAN",{});var Sn=u(jn);_(Se.$$.fragment,Sn),Sn.forEach(n),Vn.forEach(n),Uo=l($t),Jt=s($t,"SPAN",{"data-svelte-h":!0}),f(Jt)!=="svelte-1jsw1pg"&&(Jt.textContent=Qr),$t.forEach(n),On=l(e),He=s(e,"P",{"data-svelte-h":!0}),f(He)!=="svelte-5xttfr"&&(He.innerHTML=Or),Dn=l(e),Ge=s(e,"P",{"data-svelte-h":!0}),f(Ge)!=="svelte-vfdo9a"&&(Ge.textContent=Dr),Yn=l(e),Be=s(e,"P",{"data-svelte-h":!0}),f(Be)!=="svelte-gptcva"&&(Be.innerHTML=Yr),Kn=l(e),Xe=s(e,"P",{"data-svelte-h":!0}),f(Xe)!=="svelte-112zouf"&&(Xe.innerHTML=Kr),eo=l(e),K=s(e,"H2",{class:!0});var xt=u(K);de=s(xt,"A",{id:!0,class:!0,href:!0});var Hn=u(de);Jn=s(Hn,"SPAN",{});var Gn=u(Jn);_(Pe.$$.fragment,Gn),Gn.forEach(n),Hn.forEach(n),qo=l(xt),Ct=s(xt,"SPAN",{"data-svelte-h":!0}),f(Ct)!=="svelte-1lrqlau"&&(Ct.textContent=es),xt.forEach(n),to=l(e),j=s(e,"DIV",{class:!0});var C=u(j);_(Qe.$$.fragment,C),Io=l(C),Ut=s(C,"P",{"data-svelte-h":!0}),f(Ut)!=="svelte-1txlcov"&&(Ut.textContent=ts),Eo=l(C),qt=s(C,"OL",{"data-svelte-h":!0}),f(qt)!=="svelte-17rmwrw"&&(qt.innerHTML=ns),Lo=l(C),It=s(C,"P",{"data-svelte-h":!0}),f(It)!=="svelte-15a8bjo"&&(It.innerHTML=os),Zo=l(C),Et=s(C,"P",{"data-svelte-h":!0}),f(Et)!=="svelte-10kqkkl"&&(Et.innerHTML=rs),Ao=l(C),_(ce.$$.fragment,C),C.forEach(n),no=l(e),ee=s(e,"H2",{class:!0});var zt=u(ee);me=s(zt,"A",{id:!0,class:!0,href:!0});var Bn=u(me);Cn=s(Bn,"SPAN",{});var Xn=u(Cn);_(Oe.$$.fragment,Xn),Xn.forEach(n),Bn.forEach(n),Fo=l(zt),Lt=s(zt,"SPAN",{"data-svelte-h":!0}),f(Lt)!=="svelte-1mo6jqx"&&(Lt.textContent=ss),zt.forEach(n),oo=l(e),$=s(e,"DIV",{class:!0});var z=u($);_(De.$$.fragment,z),Wo=l(z),Zt=s(z,"P",{"data-svelte-h":!0}),f(Zt)!=="svelte-x1le7e"&&(Zt.textContent=as),No=l(z),At=s(z,"P",{"data-svelte-h":!0}),f(At)!=="svelte-1tephpe"&&(At.innerHTML=is),Vo=l(z),Ft=s(z,"P",{"data-svelte-h":!0}),f(Ft)!=="svelte-1b0fouy"&&(Ft.innerHTML=ls),So=l(z),X=s(z,"DIV",{class:!0});var wn=u(X);_(Ye.$$.fragment,wn),Ho=l(wn),Wt=s(wn,"P",{"data-svelte-h":!0}),f(Wt)!=="svelte-q7bpic"&&(Wt.textContent=ds),Go=l(wn),Nt=s(wn,"UL",{"data-svelte-h":!0}),f(Nt)!=="svelte-xi6653"&&(Nt.innerHTML=cs),wn.forEach(n),Bo=l(z),pe=s(z,"DIV",{class:!0});var yo=u(pe);_(Ke.$$.fragment,yo),Xo=l(yo),Vt=s(yo,"P",{"data-svelte-h":!0}),f(Vt)!=="svelte-1f4f5kp"&&(Vt.innerHTML=ms),yo.forEach(n),Po=l(z),L=s(z,"DIV",{class:!0});var Ie=u(L);_(et.$$.fragment,Ie),Qo=l(Ie),St=s(Ie,"P",{"data-svelte-h":!0}),f(St)!=="svelte-11hyn6f"&&(St.textContent=ps),Oo=l(Ie),_(he.$$.fragment,Ie),Do=l(Ie),Ht=s(Ie,"P",{"data-svelte-h":!0}),f(Ht)!=="svelte-owoxgn"&&(Ht.innerHTML=hs),Ie.forEach(n),Yo=l(z),Gt=s(z,"DIV",{class:!0});var Ss=u(Gt);_(tt.$$.fragment,Ss),Ss.forEach(n),Ko=l(z),U=s(z,"DIV",{class:!0});var Q=u(U);_(nt.$$.fragment,Q),er=l(Q),Bt=s(Q,"P",{"data-svelte-h":!0}),f(Bt)!=="svelte-ykazgt"&&(Bt.innerHTML=fs),tr=l(Q),Xt=s(Q,"OL",{"data-svelte-h":!0}),f(Xt)!=="svelte-1kcpahy"&&(Xt.innerHTML=us),nr=l(Q),Pt=s(Q,"UL",{"data-svelte-h":!0}),f(Pt)!=="svelte-xi6653"&&(Pt.innerHTML=gs),or=l(Q),_(fe.$$.fragment,Q),Q.forEach(n),z.forEach(n),ro=l(e),te=s(e,"H2",{class:!0});var wo=u(te);ue=s(wo,"A",{id:!0,class:!0,href:!0});var Hs=u(ue);Un=s(Hs,"SPAN",{});var Gs=u(Un);_(ot.$$.fragment,Gs),Gs.forEach(n),Hs.forEach(n),rr=l(wo),Qt=s(wo,"SPAN",{"data-svelte-h":!0}),f(Qt)!=="svelte-8bimtr"&&(Qt.textContent=_s),wo.forEach(n),so=l(e),J=s(e,"DIV",{class:!0});var O=u(J);_(rt.$$.fragment,O),sr=l(O),Ot=s(O,"P",{"data-svelte-h":!0}),f(Ot)!=="svelte-q0n2sz"&&(Ot.innerHTML=bs),ar=l(O),Dt=s(O,"P",{"data-svelte-h":!0}),f(Dt)!=="svelte-19u8ha2"&&(Dt.innerHTML=vs),ir=l(O),Yt=s(O,"P",{"data-svelte-h":!0}),f(Yt)!=="svelte-ttxvs6"&&(Yt.innerHTML=ks),lr=l(O),q=s(O,"DIV",{class:!0});var D=u(q);_(st.$$.fragment,D),dr=l(D),Kt=s(D,"P",{"data-svelte-h":!0}),f(Kt)!=="svelte-ykazgt"&&(Kt.innerHTML=ys),cr=l(D),en=s(D,"OL",{"data-svelte-h":!0}),f(en)!=="svelte-1kcpahy"&&(en.innerHTML=ws),mr=l(D),tn=s(D,"UL",{"data-svelte-h":!0}),f(tn)!=="svelte-xi6653"&&(tn.innerHTML=Ts),pr=l(D),_(ge.$$.fragment,D),D.forEach(n),O.forEach(n),ao=l(e),ne=s(e,"H2",{class:!0});var To=u(ne);_e=s(To,"A",{id:!0,class:!0,href:!0});var Bs=u(_e);qn=s(Bs,"SPAN",{});var Xs=u(qn);_(at.$$.fragment,Xs),Xs.forEach(n),Bs.forEach(n),hr=l(To),nn=s(To,"SPAN",{"data-svelte-h":!0}),f(nn)!=="svelte-1dy9sng"&&(nn.textContent=Ms),To.forEach(n),io=l(e),N=s(e,"DIV",{class:!0});var Tn=u(N);_(it.$$.fragment,Tn),fr=l(Tn),on=s(Tn,"P",{"data-svelte-h":!0}),f(on)!=="svelte-ongswt"&&(on.textContent=Rs),ur=l(Tn),be=s(Tn,"DIV",{class:!0});var Mo=u(be);_(lt.$$.fragment,Mo),gr=l(Mo),rn=s(Mo,"P",{"data-svelte-h":!0}),f(rn)!=="svelte-1ig21z"&&(rn.textContent=$s),Mo.forEach(n),Tn.forEach(n),lo=l(e),oe=s(e,"H2",{class:!0});var Ro=u(oe);ve=s(Ro,"A",{id:!0,class:!0,href:!0});var Ps=u(ve);In=s(Ps,"SPAN",{});var Qs=u(In);_(dt.$$.fragment,Qs),Qs.forEach(n),Ps.forEach(n),_r=l(Ro),sn=s(Ro,"SPAN",{"data-svelte-h":!0}),f(sn)!=="svelte-12ov3r8"&&(sn.textContent=xs),Ro.forEach(n),co=l(e),V=s(e,"DIV",{class:!0});var Mn=u(V);_(ct.$$.fragment,Mn),br=l(Mn),an=s(Mn,"P",{"data-svelte-h":!0}),f(an)!=="svelte-2kzyme"&&(an.innerHTML=zs),vr=l(Mn),Z=s(Mn,"DIV",{class:!0});var Ee=u(Z);_(mt.$$.fragment,Ee),kr=l(Ee),ln=s(Ee,"P",{"data-svelte-h":!0}),f(ln)!=="svelte-rpsi0"&&(ln.innerHTML=js),yr=l(Ee),_(ke.$$.fragment,Ee),wr=l(Ee),_(ye.$$.fragment,Ee),Ee.forEach(n),Mn.forEach(n),mo=l(e),re=s(e,"H2",{class:!0});var $o=u(re);we=s($o,"A",{id:!0,class:!0,href:!0});var Os=u(we);En=s(Os,"SPAN",{});var Ds=u(En);_(pt.$$.fragment,Ds),Ds.forEach(n),Os.forEach(n),Tr=l($o),dn=s($o,"SPAN",{"data-svelte-h":!0}),f(dn)!=="svelte-12sp14k"&&(dn.textContent=Js),$o.forEach(n),po=l(e),S=s(e,"DIV",{class:!0});var Rn=u(S);_(ht.$$.fragment,Rn),Mr=l(Rn),cn=s(Rn,"P",{"data-svelte-h":!0}),f(cn)!=="svelte-1rwza5g"&&(cn.innerHTML=Cs),Rr=l(Rn),A=s(Rn,"DIV",{class:!0});var Le=u(A);_(ft.$$.fragment,Le),$r=l(Le),mn=s(Le,"P",{"data-svelte-h":!0}),f(mn)!=="svelte-21aq1g"&&(mn.innerHTML=Us),xr=l(Le),_(Te.$$.fragment,Le),zr=l(Le),_(Me.$$.fragment,Le),Le.forEach(n),Rn.forEach(n),ho=l(e),se=s(e,"H2",{class:!0});var xo=u(se);Re=s(xo,"A",{id:!0,class:!0,href:!0});var Ys=u(Re);Ln=s(Ys,"SPAN",{});var Ks=u(Ln);_(ut.$$.fragment,Ks),Ks.forEach(n),Ys.forEach(n),jr=l(xo),pn=s(xo,"SPAN",{"data-svelte-h":!0}),f(pn)!=="svelte-5qexw1"&&(pn.textContent=qs),xo.forEach(n),fo=l(e),H=s(e,"DIV",{class:!0});var $n=u(H);_(gt.$$.fragment,$n),Jr=l($n),hn=s($n,"P",{"data-svelte-h":!0}),f(hn)!=="svelte-1rac53c"&&(hn.innerHTML=Is),Cr=l($n),F=s($n,"DIV",{class:!0});var Ze=u(F);_(_t.$$.fragment,Ze),Ur=l(Ze),fn=s(Ze,"P",{"data-svelte-h":!0}),f(fn)!=="svelte-3o90s"&&(fn.innerHTML=Es),qr=l(Ze),_($e.$$.fragment,Ze),Ir=l(Ze),_(xe.$$.fragment,Ze),Ze.forEach(n),$n.forEach(n),uo=l(e),ae=s(e,"H2",{class:!0});var zo=u(ae);ze=s(zo,"A",{id:!0,class:!0,href:!0});var ea=u(ze);Zn=s(ea,"SPAN",{});var ta=u(Zn);_(bt.$$.fragment,ta),ta.forEach(n),ea.forEach(n),Er=l(zo),un=s(zo,"SPAN",{"data-svelte-h":!0}),f(un)!=="svelte-wn6ocv"&&(un.textContent=Ls),zo.forEach(n),go=l(e),G=s(e,"DIV",{class:!0});var xn=u(G);_(vt.$$.fragment,xn),Lr=l(xn),gn=s(xn,"P",{"data-svelte-h":!0}),f(gn)!=="svelte-1ybpoit"&&(gn.innerHTML=Zs),Zr=l(xn),P=s(xn,"DIV",{class:!0});var zn=u(P);_(kt.$$.fragment,zn),Ar=l(zn),_n=s(zn,"P",{"data-svelte-h":!0}),f(_n)!=="svelte-5g4ok0"&&(_n.innerHTML=As),Fr=l(zn),_(je.$$.fragment,zn),zn.forEach(n),xn.forEach(n),_o=l(e),ie=s(e,"H2",{class:!0});var jo=u(ie);Je=s(jo,"A",{id:!0,class:!0,href:!0});var na=u(Je);An=s(na,"SPAN",{});var oa=u(An);_(yt.$$.fragment,oa),oa.forEach(n),na.forEach(n),Wr=l(jo),bn=s(jo,"SPAN",{"data-svelte-h":!0}),f(bn)!=="svelte-6xz6yp"&&(bn.textContent=Fs),jo.forEach(n),bo=l(e),I=s(e,"DIV",{class:!0});var Ae=u(I);_(wt.$$.fragment,Ae),Nr=l(Ae),vn=s(Ae,"P",{"data-svelte-h":!0}),f(vn)!=="svelte-16o09y2"&&(vn.innerHTML=Ws),Vr=l(Ae),Ce=s(Ae,"DIV",{class:!0});var Jo=u(Ce);_(Tt.$$.fragment,Jo),Sr=l(Jo),kn=s(Jo,"P",{"data-svelte-h":!0}),f(kn)!=="svelte-4rmqa9"&&(kn.innerHTML=Ns),Jo.forEach(n),Hr=l(Ae),W=s(Ae,"DIV",{class:!0});var Fe=u(W);_(Mt.$$.fragment,Fe),Gr=l(Fe),yn=s(Fe,"P",{"data-svelte-h":!0}),f(yn)!=="svelte-9au21w"&&(yn.innerHTML=Vs),Br=l(Fe),_(Ue.$$.fragment,Fe),Xr=l(Fe),_(qe.$$.fragment,Fe),Fe.forEach(n),Ae.forEach(n),vo=l(e),Fn=s(e,"P",{}),u(Fn).forEach(n),this.h()},h(){h(a,"name","hf:doc:metadata"),h(a,"content",JSON.stringify(Ta)),h(o,"id","realm"),h(o,"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"),h(o,"href","#realm"),h(w,"class","relative group"),h(le,"id","overview"),h(le,"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"),h(le,"href","#overview"),h(Y,"class","relative group"),h(de,"id","transformers.RealmConfig"),h(de,"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"),h(de,"href","#transformers.RealmConfig"),h(K,"class","relative group"),h(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(me,"id","transformers.RealmTokenizer"),h(me,"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"),h(me,"href","#transformers.RealmTokenizer"),h(ee,"class","relative group"),h(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Gt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ue,"id","transformers.RealmTokenizerFast"),h(ue,"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"),h(ue,"href","#transformers.RealmTokenizerFast"),h(te,"class","relative group"),h(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(_e,"id","transformers.RealmRetriever"),h(_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"),h(_e,"href","#transformers.RealmRetriever"),h(ne,"class","relative group"),h(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ve,"id","transformers.RealmEmbedder"),h(ve,"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"),h(ve,"href","#transformers.RealmEmbedder"),h(oe,"class","relative group"),h(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(we,"id","transformers.RealmScorer"),h(we,"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"),h(we,"href","#transformers.RealmScorer"),h(re,"class","relative group"),h(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Re,"id","transformers.RealmKnowledgeAugEncoder"),h(Re,"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"),h(Re,"href","#transformers.RealmKnowledgeAugEncoder"),h(se,"class","relative group"),h(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ze,"id","transformers.RealmReader"),h(ze,"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"),h(ze,"href","#transformers.RealmReader"),h(ae,"class","relative group"),h(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Je,"id","transformers.RealmForOpenQA"),h(Je,"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"),h(Je,"href","#transformers.RealmForOpenQA"),h(ie,"class","relative group"),h(Ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,d){t(document.head,a),p(e,T,d),p(e,m,d),p(e,c,d),p(e,w,d),t(w,o),t(o,M),b(Ve,M,null),t(w,Co),t(w,jt),p(e,Qn,d),p(e,Y,d),t(Y,le),t(le,jn),b(Se,jn,null),t(Y,Uo),t(Y,Jt),p(e,On,d),p(e,He,d),p(e,Dn,d),p(e,Ge,d),p(e,Yn,d),p(e,Be,d),p(e,Kn,d),p(e,Xe,d),p(e,eo,d),p(e,K,d),t(K,de),t(de,Jn),b(Pe,Jn,null),t(K,qo),t(K,Ct),p(e,to,d),p(e,j,d),b(Qe,j,null),t(j,Io),t(j,Ut),t(j,Eo),t(j,qt),t(j,Lo),t(j,It),t(j,Zo),t(j,Et),t(j,Ao),b(ce,j,null),p(e,no,d),p(e,ee,d),t(ee,me),t(me,Cn),b(Oe,Cn,null),t(ee,Fo),t(ee,Lt),p(e,oo,d),p(e,$,d),b(De,$,null),t($,Wo),t($,Zt),t($,No),t($,At),t($,Vo),t($,Ft),t($,So),t($,X),b(Ye,X,null),t(X,Ho),t(X,Wt),t(X,Go),t(X,Nt),t($,Bo),t($,pe),b(Ke,pe,null),t(pe,Xo),t(pe,Vt),t($,Po),t($,L),b(et,L,null),t(L,Qo),t(L,St),t(L,Oo),b(he,L,null),t(L,Do),t(L,Ht),t($,Yo),t($,Gt),b(tt,Gt,null),t($,Ko),t($,U),b(nt,U,null),t(U,er),t(U,Bt),t(U,tr),t(U,Xt),t(U,nr),t(U,Pt),t(U,or),b(fe,U,null),p(e,ro,d),p(e,te,d),t(te,ue),t(ue,Un),b(ot,Un,null),t(te,rr),t(te,Qt),p(e,so,d),p(e,J,d),b(rt,J,null),t(J,sr),t(J,Ot),t(J,ar),t(J,Dt),t(J,ir),t(J,Yt),t(J,lr),t(J,q),b(st,q,null),t(q,dr),t(q,Kt),t(q,cr),t(q,en),t(q,mr),t(q,tn),t(q,pr),b(ge,q,null),p(e,ao,d),p(e,ne,d),t(ne,_e),t(_e,qn),b(at,qn,null),t(ne,hr),t(ne,nn),p(e,io,d),p(e,N,d),b(it,N,null),t(N,fr),t(N,on),t(N,ur),t(N,be),b(lt,be,null),t(be,gr),t(be,rn),p(e,lo,d),p(e,oe,d),t(oe,ve),t(ve,In),b(dt,In,null),t(oe,_r),t(oe,sn),p(e,co,d),p(e,V,d),b(ct,V,null),t(V,br),t(V,an),t(V,vr),t(V,Z),b(mt,Z,null),t(Z,kr),t(Z,ln),t(Z,yr),b(ke,Z,null),t(Z,wr),b(ye,Z,null),p(e,mo,d),p(e,re,d),t(re,we),t(we,En),b(pt,En,null),t(re,Tr),t(re,dn),p(e,po,d),p(e,S,d),b(ht,S,null),t(S,Mr),t(S,cn),t(S,Rr),t(S,A),b(ft,A,null),t(A,$r),t(A,mn),t(A,xr),b(Te,A,null),t(A,zr),b(Me,A,null),p(e,ho,d),p(e,se,d),t(se,Re),t(Re,Ln),b(ut,Ln,null),t(se,jr),t(se,pn),p(e,fo,d),p(e,H,d),b(gt,H,null),t(H,Jr),t(H,hn),t(H,Cr),t(H,F),b(_t,F,null),t(F,Ur),t(F,fn),t(F,qr),b($e,F,null),t(F,Ir),b(xe,F,null),p(e,uo,d),p(e,ae,d),t(ae,ze),t(ze,Zn),b(bt,Zn,null),t(ae,Er),t(ae,un),p(e,go,d),p(e,G,d),b(vt,G,null),t(G,Lr),t(G,gn),t(G,Zr),t(G,P),b(kt,P,null),t(P,Ar),t(P,_n),t(P,Fr),b(je,P,null),p(e,_o,d),p(e,ie,d),t(ie,Je),t(Je,An),b(yt,An,null),t(ie,Wr),t(ie,bn),p(e,bo,d),p(e,I,d),b(wt,I,null),t(I,Nr),t(I,vn),t(I,Vr),t(I,Ce),b(Tt,Ce,null),t(Ce,Sr),t(Ce,kn),t(I,Hr),t(I,W),b(Mt,W,null),t(W,Gr),t(W,yn),t(W,Br),b(Ue,W,null),t(W,Xr),b(qe,W,null),p(e,vo,d),p(e,Fn,d),ko=!0},p(e,[d]){const Rt={};d&2&&(Rt.$$scope={dirty:d,ctx:e}),ce.$set(Rt);const Wn={};d&2&&(Wn.$$scope={dirty:d,ctx:e}),he.$set(Wn);const Nn={};d&2&&(Nn.$$scope={dirty:d,ctx:e}),fe.$set(Nn);const $t={};d&2&&($t.$$scope={dirty:d,ctx:e}),ge.$set($t);const Vn={};d&2&&(Vn.$$scope={dirty:d,ctx:e}),ke.$set(Vn);const Sn={};d&2&&(Sn.$$scope={dirty:d,ctx:e}),ye.$set(Sn);const xt={};d&2&&(xt.$$scope={dirty:d,ctx:e}),Te.$set(xt);const Hn={};d&2&&(Hn.$$scope={dirty:d,ctx:e}),Me.$set(Hn);const Gn={};d&2&&(Gn.$$scope={dirty:d,ctx:e}),$e.$set(Gn);const C={};d&2&&(C.$$scope={dirty:d,ctx:e}),xe.$set(C);const zt={};d&2&&(zt.$$scope={dirty:d,ctx:e}),je.$set(zt);const Bn={};d&2&&(Bn.$$scope={dirty:d,ctx:e}),Ue.$set(Bn);const Xn={};d&2&&(Xn.$$scope={dirty:d,ctx:e}),qe.$set(Xn)},i(e){ko||(v(Ve.$$.fragment,e),v(Se.$$.fragment,e),v(Pe.$$.fragment,e),v(Qe.$$.fragment,e),v(ce.$$.fragment,e),v(Oe.$$.fragment,e),v(De.$$.fragment,e),v(Ye.$$.fragment,e),v(Ke.$$.fragment,e),v(et.$$.fragment,e),v(he.$$.fragment,e),v(tt.$$.fragment,e),v(nt.$$.fragment,e),v(fe.$$.fragment,e),v(ot.$$.fragment,e),v(rt.$$.fragment,e),v(st.$$.fragment,e),v(ge.$$.fragment,e),v(at.$$.fragment,e),v(it.$$.fragment,e),v(lt.$$.fragment,e),v(dt.$$.fragment,e),v(ct.$$.fragment,e),v(mt.$$.fragment,e),v(ke.$$.fragment,e),v(ye.$$.fragment,e),v(pt.$$.fragment,e),v(ht.$$.fragment,e),v(ft.$$.fragment,e),v(Te.$$.fragment,e),v(Me.$$.fragment,e),v(ut.$$.fragment,e),v(gt.$$.fragment,e),v(_t.$$.fragment,e),v($e.$$.fragment,e),v(xe.$$.fragment,e),v(bt.$$.fragment,e),v(vt.$$.fragment,e),v(kt.$$.fragment,e),v(je.$$.fragment,e),v(yt.$$.fragment,e),v(wt.$$.fragment,e),v(Tt.$$.fragment,e),v(Mt.$$.fragment,e),v(Ue.$$.fragment,e),v(qe.$$.fragment,e),ko=!0)},o(e){k(Ve.$$.fragment,e),k(Se.$$.fragment,e),k(Pe.$$.fragment,e),k(Qe.$$.fragment,e),k(ce.$$.fragment,e),k(Oe.$$.fragment,e),k(De.$$.fragment,e),k(Ye.$$.fragment,e),k(Ke.$$.fragment,e),k(et.$$.fragment,e),k(he.$$.fragment,e),k(tt.$$.fragment,e),k(nt.$$.fragment,e),k(fe.$$.fragment,e),k(ot.$$.fragment,e),k(rt.$$.fragment,e),k(st.$$.fragment,e),k(ge.$$.fragment,e),k(at.$$.fragment,e),k(it.$$.fragment,e),k(lt.$$.fragment,e),k(dt.$$.fragment,e),k(ct.$$.fragment,e),k(mt.$$.fragment,e),k(ke.$$.fragment,e),k(ye.$$.fragment,e),k(pt.$$.fragment,e),k(ht.$$.fragment,e),k(ft.$$.fragment,e),k(Te.$$.fragment,e),k(Me.$$.fragment,e),k(ut.$$.fragment,e),k(gt.$$.fragment,e),k(_t.$$.fragment,e),k($e.$$.fragment,e),k(xe.$$.fragment,e),k(bt.$$.fragment,e),k(vt.$$.fragment,e),k(kt.$$.fragment,e),k(je.$$.fragment,e),k(yt.$$.fragment,e),k(wt.$$.fragment,e),k(Tt.$$.fragment,e),k(Mt.$$.fragment,e),k(Ue.$$.fragment,e),k(qe.$$.fragment,e),ko=!1},d(e){e&&(n(T),n(m),n(c),n(w),n(Qn),n(Y),n(On),n(He),n(Dn),n(Ge),n(Yn),n(Be),n(Kn),n(Xe),n(eo),n(K),n(to),n(j),n(no),n(ee),n(oo),n($),n(ro),n(te),n(so),n(J),n(ao),n(ne),n(io),n(N),n(lo),n(oe),n(co),n(V),n(mo),n(re),n(po),n(S),n(ho),n(se),n(fo),n(H),n(uo),n(ae),n(go),n(G),n(_o),n(ie),n(bo),n(I),n(vo),n(Fn)),n(a),y(Ve),y(Se),y(Pe),y(Qe),y(ce),y(Oe),y(De),y(Ye),y(Ke),y(et),y(he),y(tt),y(nt),y(fe),y(ot),y(rt),y(st),y(ge),y(at),y(it),y(lt),y(dt),y(ct),y(mt),y(ke),y(ye),y(pt),y(ht),y(ft),y(Te),y(Me),y(ut),y(gt),y(_t),y($e),y(xe),y(bt),y(vt),y(kt),y(je),y(yt),y(wt),y(Tt),y(Mt),y(Ue),y(qe)}}}const Ta={local:"realm",sections:[{local:"overview",title:"Overview"},{local:"transformers.RealmConfig",title:"RealmConfig"},{local:"transformers.RealmTokenizer",title:"RealmTokenizer"},{local:"transformers.RealmTokenizerFast",title:"RealmTokenizerFast"},{local:"transformers.RealmRetriever",title:"RealmRetriever"},{local:"transformers.RealmEmbedder",title:"RealmEmbedder"},{local:"transformers.RealmScorer",title:"RealmScorer"},{local:"transformers.RealmKnowledgeAugEncoder",title:"RealmKnowledgeAugEncoder"},{local:"transformers.RealmReader",title:"RealmReader"},{local:"transformers.RealmForOpenQA",title:"RealmForOpenQA"}],title:"REALM"};function Ma(R){return sa(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ua extends aa{constructor(a){super(),ia(this,a,Ma,wa,ra,{})}}export{Ua as component};
