import{S as Hl,i as Kl,s as Bl,e as p,k as u,w as b,t as o,U as Fl,M as Yl,c as f,d as e,m as _,x as k,a as c,h as i,V as Ml,b as N,N as Il,G as a,g as l,y as w,o as h,p as D,q as d,B as x,v as Vl,n as J}from"../../chunks/vendor-hf-doc-builder.js";import{T as Ya}from"../../chunks/Tip-hf-doc-builder.js";import{Y as Dl}from"../../chunks/Youtube-hf-doc-builder.js";import{I as Ul}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as y}from"../../chunks/CodeBlock-hf-doc-builder.js";import{C as Jl}from"../../chunks/CourseFloatingBanner-hf-doc-builder.js";import{F as Xl}from"../../chunks/FrameworkSwitchCourse-hf-doc-builder.js";import"../../chunks/DocNotebookDropdown-hf-doc-builder.js";function Zl(v){let n,m;return n=new Jl({props:{chapter:6,classNames:"absolute z-10 right-0 top-0",notebooks:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/zh-CN/chapter6/section3b_tf.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/zh-CN/chapter6/section3b_tf.ipynb"}]}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function sm(v){let n,m;return n=new Jl({props:{chapter:6,classNames:"absolute z-10 right-0 top-0",notebooks:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/zh-CN/chapter6/section3b_pt.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/zh-CN/chapter6/section3b_pt.ipynb"}]}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function tm(v){let n,m;return n=new Dl({props:{id:"b3u8RzBCX9Y"}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function em(v){let n,m;return n=new Dl({props:{id:"_wxyB3j3mk4"}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function nm(v){let n,m;return n=new y({props:{code:`from transformers import AutoTokenizer, TFAutoModelForQuestionAnswering

model_checkpoint = "distilbert-base-cased-distilled-squad"
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
model = TFAutoModelForQuestionAnswering.from_pretrained(model_checkpoint)

inputs = tokenizer(question, context, return_tensors="tf")
outputs = model(**inputs)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFAutoModelForQuestionAnswering

model_checkpoint = <span class="hljs-string">&quot;distilbert-base-cased-distilled-squad&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
model = TFAutoModelForQuestionAnswering.from_pretrained(model_checkpoint)

inputs = tokenizer(question, context, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
outputs = model(**inputs)`}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function am(v){let n,m;return n=new y({props:{code:`from transformers import AutoTokenizer, AutoModelForQuestionAnswering

model_checkpoint = "distilbert-base-cased-distilled-squad"
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
model = AutoModelForQuestionAnswering.from_pretrained(model_checkpoint)

inputs = tokenizer(question, context, return_tensors="pt")
outputs = model(**inputs)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForQuestionAnswering

model_checkpoint = <span class="hljs-string">&quot;distilbert-base-cased-distilled-squad&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
model = AutoModelForQuestionAnswering.from_pretrained(model_checkpoint)

inputs = tokenizer(question, context, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
outputs = model(**inputs)`}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function rm(v){let n,m;return n=new y({props:{code:"(1, 66) (1, 66)",highlighted:'(<span class="hljs-number">1</span>, <span class="hljs-number">66</span>) (<span class="hljs-number">1</span>, <span class="hljs-number">66</span>)'}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function om(v){let n,m;return n=new y({props:{code:"torch.Size([1, 66]) torch.Size([1, 66])",highlighted:'torch.Size([<span class="hljs-number">1</span>, <span class="hljs-number">66</span>]) torch.Size([<span class="hljs-number">1</span>, <span class="hljs-number">66</span>])'}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function im(v){let n,m;return n=new y({props:{code:`import tensorflow as tf

sequence_ids = inputs.sequence_ids()
# Mask everything apart from the tokens of the context
mask = [i != 1 for i in sequence_ids]
# Unmask the [CLS] token
mask[0] = False
mask = tf.constant(mask)[None]

start_logits = tf.where(mask, -10000, start_logits)
end_logits = tf.where(mask, -10000, end_logits)`,highlighted:`<span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

sequence_ids = inputs.sequence_ids()
<span class="hljs-comment"># Mask everything apart from the tokens of the context</span>
mask = [i != <span class="hljs-number">1</span> <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> sequence_ids]
<span class="hljs-comment"># Unmask the [CLS] token</span>
mask[<span class="hljs-number">0</span>] = <span class="hljs-literal">False</span>
mask = tf.constant(mask)[<span class="hljs-literal">None</span>]

start_logits = tf.where(mask, -<span class="hljs-number">10000</span>, start_logits)
end_logits = tf.where(mask, -<span class="hljs-number">10000</span>, end_logits)`}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function lm(v){let n,m;return n=new y({props:{code:`import torch

sequence_ids = inputs.sequence_ids()
# Mask everything apart from the tokens of the context
mask = [i != 1 for i in sequence_ids]
# Unmask the [CLS] token
mask[0] = False
mask = torch.tensor(mask)[None]

start_logits[mask] = -10000
end_logits[mask] = -10000`,highlighted:`<span class="hljs-keyword">import</span> torch

sequence_ids = inputs.sequence_ids()
<span class="hljs-comment"># Mask everything apart from the tokens of the context</span>
mask = [i != <span class="hljs-number">1</span> <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> sequence_ids]
<span class="hljs-comment"># Unmask the [CLS] token</span>
mask[<span class="hljs-number">0</span>] = <span class="hljs-literal">False</span>
mask = torch.tensor(mask)[<span class="hljs-literal">None</span>]

start_logits[mask] = -<span class="hljs-number">10000</span>
end_logits[mask] = -<span class="hljs-number">10000</span>`}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function mm(v){let n,m;return n=new y({props:{code:`start_probabilities = tf.math.softmax(start_logits, axis=-1)[0].numpy()
end_probabilities = tf.math.softmax(end_logits, axis=-1)[0].numpy()`,highlighted:`start_probabilities = tf.math.softmax(start_logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>].numpy()
end_probabilities = tf.math.softmax(end_logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>].numpy()`}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function pm(v){let n,m;return n=new y({props:{code:`start_probabilities = torch.nn.functional.softmax(start_logits, dim=-1)[0]
end_probabilities = torch.nn.functional.softmax(end_logits, dim=-1)[0]`,highlighted:`start_probabilities = torch.nn.functional.softmax(start_logits, dim=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>]
end_probabilities = torch.nn.functional.softmax(end_logits, dim=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>]`}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function fm(v){let n,m,t,g,$,j,q,S,A,O,W,G,P,z;return P=new y({props:{code:"scores = np.triu(scores)",highlighted:"scores = np.triu(scores)"}}),{c(){n=p("p"),m=o("\u7136\u540E\u6211\u4EEC\u5C06\u5C4F\u853D\u8FD9\u4E9B\u503C "),t=p("strong"),g=o("start_index > end_index"),$=o(" \u901A\u8FC7\u5C06\u5B83\u4EEC\u8BBE\u7F6E\u4E3A "),j=p("strong"),q=o("0"),S=o(" \uFF08\u5176\u4ED6\u6982\u7387\u90FD\u662F\u6B63\u6570\uFF09\u3002\u8FD9 "),A=p("strong"),O=o("torch.triu()"),W=o(" \u51FD\u6570\u8FD4\u56DE\u4F5C\u4E3A\u53C2\u6570\u4F20\u9012\u7684 2D \u5F20\u91CF\u7684\u4E0A\u4E09\u89D2\u90E8\u5206\uFF0C\u56E0\u6B64\u5B83\u4F1A\u4E3A\u6211\u4EEC\u505A\u5C4F\u853D\uFF1A"),G=u(),b(P.$$.fragment)},l(T){n=f(T,"P",{});var E=c(n);m=i(E,"\u7136\u540E\u6211\u4EEC\u5C06\u5C4F\u853D\u8FD9\u4E9B\u503C "),t=f(E,"STRONG",{});var vs=c(t);g=i(vs,"start_index > end_index"),vs.forEach(e),$=i(E," \u901A\u8FC7\u5C06\u5B83\u4EEC\u8BBE\u7F6E\u4E3A "),j=f(E,"STRONG",{});var Q=c(j);q=i(Q,"0"),Q.forEach(e),S=i(E," \uFF08\u5176\u4ED6\u6982\u7387\u90FD\u662F\u6B63\u6570\uFF09\u3002\u8FD9 "),A=f(E,"STRONG",{});var js=c(A);O=i(js,"torch.triu()"),js.forEach(e),W=i(E," \u51FD\u6570\u8FD4\u56DE\u4F5C\u4E3A\u53C2\u6570\u4F20\u9012\u7684 2D \u5F20\u91CF\u7684\u4E0A\u4E09\u89D2\u90E8\u5206\uFF0C\u56E0\u6B64\u5B83\u4F1A\u4E3A\u6211\u4EEC\u505A\u5C4F\u853D\uFF1A"),E.forEach(e),G=_(T),k(P.$$.fragment,T)},m(T,E){l(T,n,E),a(n,m),a(n,t),a(t,g),a(n,$),a(n,j),a(j,q),a(n,S),a(n,A),a(A,O),a(n,W),l(T,G,E),w(P,T,E),z=!0},i(T){z||(d(P.$$.fragment,T),z=!0)},o(T){h(P.$$.fragment,T),z=!1},d(T){T&&e(n),T&&e(G),x(P,T)}}}function cm(v){let n,m,t,g,$,j,q,S,A,O,W,G,P,z;return P=new y({props:{code:"scores = torch.triu(scores)",highlighted:"scores = torch.triu(scores)"}}),{c(){n=p("p"),m=o("\u7136\u540E\u6211\u4EEC\u5C06\u5C4F\u853D\u8FD9\u4E9B\u503C "),t=p("strong"),g=o("start_index > end_index"),$=o(" \u901A\u8FC7\u5C06\u5B83\u4EEC\u8BBE\u7F6E\u4E3A "),j=p("strong"),q=o("0"),S=o(" \uFF08\u5176\u4ED6\u6982\u7387\u90FD\u662F\u6B63\u6570\uFF09\u3002\u8FD9 "),A=p("strong"),O=o("torch.triu()"),W=o(" \u51FD\u6570\u8FD4\u56DE\u4F5C\u4E3A\u53C2\u6570\u4F20\u9012\u7684 2D \u5F20\u91CF\u7684\u4E0A\u4E09\u89D2\u90E8\u5206\uFF0C\u56E0\u6B64\u5B83\u4F1A\u4E3A\u6211\u4EEC\u505A\u5C4F\u853D\uFF1A"),G=u(),b(P.$$.fragment)},l(T){n=f(T,"P",{});var E=c(n);m=i(E,"\u7136\u540E\u6211\u4EEC\u5C06\u5C4F\u853D\u8FD9\u4E9B\u503C "),t=f(E,"STRONG",{});var vs=c(t);g=i(vs,"start_index > end_index"),vs.forEach(e),$=i(E," \u901A\u8FC7\u5C06\u5B83\u4EEC\u8BBE\u7F6E\u4E3A "),j=f(E,"STRONG",{});var Q=c(j);q=i(Q,"0"),Q.forEach(e),S=i(E," \uFF08\u5176\u4ED6\u6982\u7387\u90FD\u662F\u6B63\u6570\uFF09\u3002\u8FD9 "),A=f(E,"STRONG",{});var js=c(A);O=i(js,"torch.triu()"),js.forEach(e),W=i(E," \u51FD\u6570\u8FD4\u56DE\u4F5C\u4E3A\u53C2\u6570\u4F20\u9012\u7684 2D \u5F20\u91CF\u7684\u4E0A\u4E09\u89D2\u90E8\u5206\uFF0C\u56E0\u6B64\u5B83\u4F1A\u4E3A\u6211\u4EEC\u505A\u5C4F\u853D\uFF1A"),E.forEach(e),G=_(T),k(P.$$.fragment,T)},m(T,E){l(T,n,E),a(n,m),a(n,t),a(t,g),a(n,$),a(n,j),a(j,q),a(n,S),a(n,A),a(A,O),a(n,W),l(T,G,E),w(P,T,E),z=!0},i(T){z||(d(P.$$.fragment,T),z=!0)},o(T){h(P.$$.fragment,T),z=!1},d(T){T&&e(n),T&&e(G),x(P,T)}}}function um(v){let n,m,t,g,$;return{c(){n=p("p"),m=o("\u270F\uFE0F "),t=p("strong"),g=o("\u8BD5\u8BD5\u770B!"),$=o(" \u8BA1\u7B97\u4E94\u4E2A\u6700\u53EF\u80FD\u7684\u7B54\u6848\u7684\u5F00\u59CB\u548C\u7ED3\u675F\u7D22\u5F15\u3002")},l(j){n=f(j,"P",{});var q=c(n);m=i(q,"\u270F\uFE0F "),t=f(q,"STRONG",{});var S=c(t);g=i(S,"\u8BD5\u8BD5\u770B!"),S.forEach(e),$=i(q," \u8BA1\u7B97\u4E94\u4E2A\u6700\u53EF\u80FD\u7684\u7B54\u6848\u7684\u5F00\u59CB\u548C\u7ED3\u675F\u7D22\u5F15\u3002"),q.forEach(e)},m(j,q){l(j,n,q),a(n,m),a(n,t),a(t,g),a(n,$)},d(j){j&&e(n)}}}function _m(v){let n,m,t,g,$;return{c(){n=p("p"),m=o("\u270F\uFE0F "),t=p("strong"),g=o("\u8BD5\u8BD5\u770B!"),$=o(" \u4F7F\u7528\u60A8\u4E4B\u524D\u8BA1\u7B97\u7684\u6700\u4F73\u5206\u6570\u6765\u663E\u793A\u4E94\u4E2A\u6700\u53EF\u80FD\u7684\u7B54\u6848\u3002\u8981\u68C0\u67E5\u60A8\u7684\u7ED3\u679C\uFF0C\u8BF7\u8FD4\u56DE\u5230\u7B2C\u4E00\u4E2A\u7BA1\u9053\u5E76\u5728\u8C03\u7528\u5B83\u65F6\u4F20\u5165\u3002")},l(j){n=f(j,"P",{});var q=c(n);m=i(q,"\u270F\uFE0F "),t=f(q,"STRONG",{});var S=c(t);g=i(S,"\u8BD5\u8BD5\u770B!"),S.forEach(e),$=i(q," \u4F7F\u7528\u60A8\u4E4B\u524D\u8BA1\u7B97\u7684\u6700\u4F73\u5206\u6570\u6765\u663E\u793A\u4E94\u4E2A\u6700\u53EF\u80FD\u7684\u7B54\u6848\u3002\u8981\u68C0\u67E5\u60A8\u7684\u7ED3\u679C\uFF0C\u8BF7\u8FD4\u56DE\u5230\u7B2C\u4E00\u4E2A\u7BA1\u9053\u5E76\u5728\u8C03\u7528\u5B83\u65F6\u4F20\u5165\u3002"),q.forEach(e)},m(j,q){l(j,n,q),a(n,m),a(n,t),a(t,g),a(n,$)},d(j){j&&e(n)}}}function hm(v){let n,m,t,g;return n=new y({props:{code:`_ = inputs.pop("overflow_to_sample_mapping")
offsets = inputs.pop("offset_mapping")

inputs = inputs.convert_to_tensors("tf")
print(inputs["input_ids"].shape)`,highlighted:`_ = inputs.pop(<span class="hljs-string">&quot;overflow_to_sample_mapping&quot;</span>)
offsets = inputs.pop(<span class="hljs-string">&quot;offset_mapping&quot;</span>)

inputs = inputs.convert_to_tensors(<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-built_in">print</span>(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>].shape)`}}),t=new y({props:{code:"(2, 384)",highlighted:'(<span class="hljs-number">2</span>, <span class="hljs-number">384</span>)'}}),{c(){b(n.$$.fragment),m=u(),b(t.$$.fragment)},l($){k(n.$$.fragment,$),m=_($),k(t.$$.fragment,$)},m($,j){w(n,$,j),l($,m,j),w(t,$,j),g=!0},i($){g||(d(n.$$.fragment,$),d(t.$$.fragment,$),g=!0)},o($){h(n.$$.fragment,$),h(t.$$.fragment,$),g=!1},d($){x(n,$),$&&e(m),x(t,$)}}}function dm(v){let n,m,t,g;return n=new y({props:{code:`_ = inputs.pop("overflow_to_sample_mapping")
offsets = inputs.pop("offset_mapping")

inputs = inputs.convert_to_tensors("pt")
print(inputs["input_ids"].shape)`,highlighted:`_ = inputs.pop(<span class="hljs-string">&quot;overflow_to_sample_mapping&quot;</span>)
offsets = inputs.pop(<span class="hljs-string">&quot;offset_mapping&quot;</span>)

inputs = inputs.convert_to_tensors(<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-built_in">print</span>(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>].shape)`}}),t=new y({props:{code:"torch.Size([2, 384])",highlighted:'torch.Size([<span class="hljs-number">2</span>, <span class="hljs-number">384</span>])'}}),{c(){b(n.$$.fragment),m=u(),b(t.$$.fragment)},l($){k(n.$$.fragment,$),m=_($),k(t.$$.fragment,$)},m($,j){w(n,$,j),l($,m,j),w(t,$,j),g=!0},i($){g||(d(n.$$.fragment,$),d(t.$$.fragment,$),g=!0)},o($){h(n.$$.fragment,$),h(t.$$.fragment,$),g=!1},d($){x(n,$),$&&e(m),x(t,$)}}}function gm(v){let n,m;return n=new y({props:{code:"(2, 384) (2, 384)",highlighted:'(<span class="hljs-number">2</span>, <span class="hljs-number">384</span>) (<span class="hljs-number">2</span>, <span class="hljs-number">384</span>)'}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function $m(v){let n,m;return n=new y({props:{code:"torch.Size([2, 384]) torch.Size([2, 384])",highlighted:'torch.Size([<span class="hljs-number">2</span>, <span class="hljs-number">384</span>]) torch.Size([<span class="hljs-number">2</span>, <span class="hljs-number">384</span>])'}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function bm(v){let n,m;return n=new y({props:{code:`sequence_ids = inputs.sequence_ids()
# Mask everything apart from the tokens of the context
mask = [i != 1 for i in sequence_ids]
# Unmask the [CLS] token
mask[0] = False
# Mask all the [PAD] tokens
mask = tf.math.logical_or(tf.constant(mask)[None], inputs["attention_mask"] == 0)

start_logits = tf.where(mask, -10000, start_logits)
end_logits = tf.where(mask, -10000, end_logits)`,highlighted:`sequence_ids = inputs.sequence_ids()
<span class="hljs-comment"># Mask everything apart from the tokens of the context</span>
mask = [i != <span class="hljs-number">1</span> <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> sequence_ids]
<span class="hljs-comment"># Unmask the [CLS] token</span>
mask[<span class="hljs-number">0</span>] = <span class="hljs-literal">False</span>
<span class="hljs-comment"># Mask all the [PAD] tokens</span>
mask = tf.math.logical_or(tf.constant(mask)[<span class="hljs-literal">None</span>], inputs[<span class="hljs-string">&quot;attention_mask&quot;</span>] == <span class="hljs-number">0</span>)

start_logits = tf.where(mask, -<span class="hljs-number">10000</span>, start_logits)
end_logits = tf.where(mask, -<span class="hljs-number">10000</span>, end_logits)`}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function km(v){let n,m;return n=new y({props:{code:`sequence_ids = inputs.sequence_ids()
# Mask everything apart from the tokens of the context
mask = [i != 1 for i in sequence_ids]
# Unmask the [CLS] token
mask[0] = False
# Mask all the [PAD] tokens
mask = torch.logical_or(torch.tensor(mask)[None], (inputs["attention_mask"] == 0))

start_logits[mask] = -10000
end_logits[mask] = -10000`,highlighted:`sequence_ids = inputs.sequence_ids()
<span class="hljs-comment"># Mask everything apart from the tokens of the context</span>
mask = [i != <span class="hljs-number">1</span> <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> sequence_ids]
<span class="hljs-comment"># Unmask the [CLS] token</span>
mask[<span class="hljs-number">0</span>] = <span class="hljs-literal">False</span>
<span class="hljs-comment"># Mask all the [PAD] tokens</span>
mask = torch.logical_or(torch.tensor(mask)[<span class="hljs-literal">None</span>], (inputs[<span class="hljs-string">&quot;attention_mask&quot;</span>] == <span class="hljs-number">0</span>))

start_logits[mask] = -<span class="hljs-number">10000</span>
end_logits[mask] = -<span class="hljs-number">10000</span>`}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function wm(v){let n,m;return n=new y({props:{code:`start_probabilities = tf.math.softmax(start_logits, axis=-1).numpy()
end_probabilities = tf.math.softmax(end_logits, axis=-1).numpy()`,highlighted:`start_probabilities = tf.math.softmax(start_logits, axis=-<span class="hljs-number">1</span>).numpy()
end_probabilities = tf.math.softmax(end_logits, axis=-<span class="hljs-number">1</span>).numpy()`}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function xm(v){let n,m;return n=new y({props:{code:`start_probabilities = torch.nn.functional.softmax(start_logits, dim=-1)
end_probabilities = torch.nn.functional.softmax(end_logits, dim=-1)`,highlighted:`start_probabilities = torch.nn.functional.softmax(start_logits, dim=-<span class="hljs-number">1</span>)
end_probabilities = torch.nn.functional.softmax(end_logits, dim=-<span class="hljs-number">1</span>)`}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function vm(v){let n,m;return n=new y({props:{code:`candidates = []
for start_probs, end_probs in zip(start_probabilities, end_probabilities):
    scores = start_probs[:, None] * end_probs[None, :]
    idx = np.triu(scores).argmax().item()

    start_idx = idx // scores.shape[1]
    end_idx = idx % scores.shape[1]
    score = scores[start_idx, end_idx].item()
    candidates.append((start_idx, end_idx, score))

print(candidates)`,highlighted:`candidates = []
<span class="hljs-keyword">for</span> start_probs, end_probs <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(start_probabilities, end_probabilities):
    scores = start_probs[:, <span class="hljs-literal">None</span>] * end_probs[<span class="hljs-literal">None</span>, :]
    idx = np.triu(scores).argmax().item()

    start_idx = idx // scores.shape[<span class="hljs-number">1</span>]
    end_idx = idx % scores.shape[<span class="hljs-number">1</span>]
    score = scores[start_idx, end_idx].item()
    candidates.append((start_idx, end_idx, score))

<span class="hljs-built_in">print</span>(candidates)`}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function jm(v){let n,m;return n=new y({props:{code:`candidates = []
for start_probs, end_probs in zip(start_probabilities, end_probabilities):
    scores = start_probs[:, None] * end_probs[None, :]
    idx = torch.triu(scores).argmax().item()

    start_idx = idx // scores.shape[1]
    end_idx = idx % scores.shape[1]
    score = scores[start_idx, end_idx].item()
    candidates.append((start_idx, end_idx, score))

print(candidates)`,highlighted:`candidates = []
<span class="hljs-keyword">for</span> start_probs, end_probs <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(start_probabilities, end_probabilities):
    scores = start_probs[:, <span class="hljs-literal">None</span>] * end_probs[<span class="hljs-literal">None</span>, :]
    idx = torch.triu(scores).argmax().item()

    start_idx = idx // scores.shape[<span class="hljs-number">1</span>]
    end_idx = idx % scores.shape[<span class="hljs-number">1</span>]
    score = scores[start_idx, end_idx].item()
    candidates.append((start_idx, end_idx, score))

<span class="hljs-built_in">print</span>(candidates)`}}),{c(){b(n.$$.fragment)},l(t){k(n.$$.fragment,t)},m(t,g){w(n,t,g),m=!0},i(t){m||(d(n.$$.fragment,t),m=!0)},o(t){h(n.$$.fragment,t),m=!1},d(t){x(n,t)}}}function ym(v){let n,m,t,g,$;return{c(){n=p("p"),m=o("\u270F\uFE0F "),t=p("strong"),g=o("\u8BD5\u8BD5\u770B!"),$=o(" \u4FEE\u6539\u4E0A\u9762\u7684\u4EE3\u7801\u4EE5\u8FD4\u56DE\u4E94\u4E2A\u6700\u53EF\u80FD\u7684\u7B54\u6848\u7684\u5206\u6570\u548C\u8DE8\u5EA6\uFF08\u603B\u8BA1\uFF0C\u800C\u4E0D\u662F\u6BCF\u4E2A\u5757\uFF09\u3002")},l(j){n=f(j,"P",{});var q=c(n);m=i(q,"\u270F\uFE0F "),t=f(q,"STRONG",{});var S=c(t);g=i(S,"\u8BD5\u8BD5\u770B!"),S.forEach(e),$=i(q," \u4FEE\u6539\u4E0A\u9762\u7684\u4EE3\u7801\u4EE5\u8FD4\u56DE\u4E94\u4E2A\u6700\u53EF\u80FD\u7684\u7B54\u6848\u7684\u5206\u6570\u548C\u8DE8\u5EA6\uFF08\u603B\u8BA1\uFF0C\u800C\u4E0D\u662F\u6BCF\u4E2A\u5757\uFF09\u3002"),q.forEach(e)},m(j,q){l(j,n,q),a(n,m),a(n,t),a(t,g),a(n,$)},d(j){j&&e(n)}}}function qm(v){let n,m,t,g,$;return{c(){n=p("p"),m=o("\u270F\uFE0F "),t=p("strong"),g=o("\u8BD5\u8BD5\u770B!"),$=o(" \u4F7F\u7528\u60A8\u4E4B\u524D\u8BA1\u7B97\u7684\u6700\u4F73\u5206\u6570\u6765\u663E\u793A\u4E94\u4E2A\u6700\u53EF\u80FD\u7684\u7B54\u6848\uFF08\u5BF9\u4E8E\u6574\u4E2A\u4E0A\u4E0B\u6587\uFF0C\u800C\u4E0D\u662F\u6BCF\u4E2A\u5757\uFF09\u3002\u8981\u68C0\u67E5\u60A8\u7684\u7ED3\u679C\uFF0C\u8BF7\u8FD4\u56DE\u5230\u7B2C\u4E00\u4E2A\u7BA1\u9053\u5E76\u5728\u8C03\u7528\u5B83\u65F6\u4F20\u5165\u3002")},l(j){n=f(j,"P",{});var q=c(n);m=i(q,"\u270F\uFE0F "),t=f(q,"STRONG",{});var S=c(t);g=i(S,"\u8BD5\u8BD5\u770B!"),S.forEach(e),$=i(q," \u4F7F\u7528\u60A8\u4E4B\u524D\u8BA1\u7B97\u7684\u6700\u4F73\u5206\u6570\u6765\u663E\u793A\u4E94\u4E2A\u6700\u53EF\u80FD\u7684\u7B54\u6848\uFF08\u5BF9\u4E8E\u6574\u4E2A\u4E0A\u4E0B\u6587\uFF0C\u800C\u4E0D\u662F\u6BCF\u4E2A\u5757\uFF09\u3002\u8981\u68C0\u67E5\u60A8\u7684\u7ED3\u679C\uFF0C\u8BF7\u8FD4\u56DE\u5230\u7B2C\u4E00\u4E2A\u7BA1\u9053\u5E76\u5728\u8C03\u7528\u5B83\u65F6\u4F20\u5165\u3002"),q.forEach(e)},m(j,q){l(j,n,q),a(n,m),a(n,t),a(t,g),a(n,$)},d(j){j&&e(n)}}}function Tm(v){let n,m,t,g,$,j,q,S,A,O,W,G,P,z,T,E,vs,Q,js,Va,$n,H,K,Mt,ys,Ts,Ne,Ws,Xa,Qs,Za,ze,sr,tr,bn,ds,er,It,nr,ar,Ae,rr,or,kn,Hs,wn,Ks,xn,Ut,ir,vn,Bs,jn,Ys,yn,Dt,lr,qn,Vs,mr,Tn,F,pr,Le,fr,cr,Xs,ur,_r,Jt,hr,dr,En,B,Y,Wt,Qt,gr,Sn,qs,Zs,ci,$r,st,ui,Pn,Ht,br,Nn,tt,zn,V,X,Kt,M,kr,Ge,wr,xr,Ce,vr,jr,Re,yr,qr,An,Es,Tr,Oe,Er,Sr,Ln,Z,ss,Bt,Yt,Pr,Gn,ts,es,Vt,C,Nr,Fe,zr,Ar,Me,Lr,Gr,Ie,Cr,Rr,Ue,Or,Fr,Cn,L,Mr,De,Ir,Ur,Je,Dr,Jr,We,Wr,Qr,Qe,Hr,Kr,Rn,Wl='<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mrow><mi mathvariant="normal">s</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">_</mi><mi mathvariant="normal">p</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">o</mi><mi mathvariant="normal">b</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">b</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">l</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">s</mi></mrow><mo stretchy="false">[</mo><mrow><mi mathvariant="normal">s</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">_</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">n</mi><mi mathvariant="normal">d</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">x</mi></mrow><mo stretchy="false">]</mo><mo>\xD7</mo><mrow><mi mathvariant="normal">e</mi><mi mathvariant="normal">n</mi><mi mathvariant="normal">d</mi><mi mathvariant="normal">_</mi><mi mathvariant="normal">p</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">o</mi><mi mathvariant="normal">b</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">b</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">l</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">s</mi></mrow><mo stretchy="false">[</mo><mrow><mi mathvariant="normal">e</mi><mi mathvariant="normal">n</mi><mi mathvariant="normal">d</mi><mi mathvariant="normal">_</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">n</mi><mi mathvariant="normal">d</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">x</mi></mrow><mo stretchy="false">]</mo></mrow><annotation encoding="application/x-tex">\\mathrm{start\\_probabilities}[\\mathrm{start\\_index}] \\times \\mathrm{end\\_probabilities}[\\mathrm{end\\_index}]</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.06em;vertical-align:-0.31em;"></span><span class="mord"><span class="mord mathrm">start_probabilities</span></span><span class="mopen">[</span><span class="mord"><span class="mord mathrm">start_index</span></span><span class="mclose">]</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">\xD7</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.06em;vertical-align:-0.31em;"></span><span class="mord"><span class="mord mathrm">end_probabilities</span></span><span class="mopen">[</span><span class="mord"><span class="mord mathrm">end_index</span></span><span class="mclose">]</span></span></span></span></span>',On,gs,Br,Fn,Ql='<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mrow><mi mathvariant="normal">s</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">_</mi><mi mathvariant="normal">p</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">o</mi><mi mathvariant="normal">b</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">b</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">l</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">s</mi></mrow><mo stretchy="false">[</mo><mrow><mi mathvariant="normal">s</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">_</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">n</mi><mi mathvariant="normal">d</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">x</mi></mrow><mo stretchy="false">]</mo><mo>\xD7</mo><mrow><mi mathvariant="normal">e</mi><mi mathvariant="normal">n</mi><mi mathvariant="normal">d</mi><mi mathvariant="normal">_</mi><mi mathvariant="normal">p</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">o</mi><mi mathvariant="normal">b</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">b</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">l</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">s</mi></mrow><mo stretchy="false">[</mo><mrow><mi mathvariant="normal">e</mi><mi mathvariant="normal">n</mi><mi mathvariant="normal">d</mi><mi mathvariant="normal">_</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">n</mi><mi mathvariant="normal">d</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">x</mi></mrow><mo stretchy="false">]</mo></mrow><annotation encoding="application/x-tex">\\mathrm{start\\_probabilities}[\\mathrm{start\\_index}] \\times \\mathrm{end\\_probabilities}[\\mathrm{end\\_index}]</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.06em;vertical-align:-0.31em;"></span><span class="mord"><span class="mord mathrm">start_probabilities</span></span><span class="mopen">[</span><span class="mord"><span class="mord mathrm">start_index</span></span><span class="mclose">]</span><span class="mspace" style="margin-right:0.2222em;"></span><span class="mbin">\xD7</span><span class="mspace" style="margin-right:0.2222em;"></span></span><span class="base"><span class="strut" style="height:1.06em;vertical-align:-0.31em;"></span><span class="mord"><span class="mord mathrm">end_probabilities</span></span><span class="mopen">[</span><span class="mord"><span class="mord mathrm">end_index</span></span><span class="mclose">]</span></span></span></span>',Mn,He,Yr,Vr,In,Xt,Xr,Un,et,Dn,ns,as,Zt,R,Zr,Ke,so,to,Be,eo,no,Ye,ao,ro,Ve,oo,io,Jn,nt,Wn,se,lo,Qn,at,Hn,Ss,Kn,$s,mo,Xe,po,fo,Ze,co,uo,Bn,rt,Yn,te,_o,Vn,ot,Xn,it,Zn,ee,ho,sa,Ps,ta,lt,go,ea,Ns,$o,sn,bo,ko,na,mt,aa,pt,ra,zs,wo,tn,xo,vo,oa,ft,ia,ct,la,As,jo,en,yo,qo,ma,bs,To,nn,Eo,So,an,Po,No,pa,ut,fa,_t,ca,Ls,zo,rn,Ao,Lo,ua,ne,Go,_a,ht,ha,dt,da,Gs,Co,on,Ro,Oo,ga,gt,$a,$t,ba,ae,Fo,ka,bt,wa,re,Mo,xa,kt,va,oe,Io,ja,I,Uo,ln,Do,Jo,mn,Wo,Qo,pn,Ho,Ko,ya,wt,qa,U,Bo,fn,Yo,Vo,cn,Xo,Zo,un,si,ti,Ta,rs,os,ie,le,ei,Ea,xt,Sa,is,ls,me,pe,ni,Pa,ms,ps,fe,ce,ai,Na,fs,cs,ue,_e,ri,za,us,_s,he,vt,Aa,de,oi,La,Cs,Ga,Rs,ii,_n,li,mi,Ca,jt,Ra,yt,Oa,ge,pi,Fa,Os,Ma,$e,fi,Ia;t=new Xl({props:{fw:v[0]}}),S=new Ul({});const _i=[sm,Zl],qt=[];function hi(s,r){return s[0]==="pt"?0:1}P=hi(v),z=qt[P]=_i[P](v);const di=[em,tm],Tt=[];function gi(s,r){return s[0]==="pt"?0:1}H=gi(v),K=Tt[H]=di[H](v),Ws=new Ul({}),Hs=new y({props:{code:`from transformers import pipeline

question_answerer = pipeline("question-answering")
context = """
\u{1F917} Transformers is backed by the three most popular deep learning libraries \u2014 Jax, PyTorch, and TensorFlow \u2014 with a seamless integration
between them. It's straightforward to train your models with one before loading them for inference with the other.
"""
question = "Which deep learning libraries back \u{1F917} Transformers?"
question_answerer(question=question, context=context)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

question_answerer = pipeline(<span class="hljs-string">&quot;question-answering&quot;</span>)
context = <span class="hljs-string">&quot;&quot;&quot;
\u{1F917} Transformers is backed by the three most popular deep learning libraries \u2014 Jax, PyTorch, and TensorFlow \u2014 with a seamless integration
between them. It&#x27;s straightforward to train your models with one before loading them for inference with the other.
&quot;&quot;&quot;</span>
question = <span class="hljs-string">&quot;Which deep learning libraries back \u{1F917} Transformers?&quot;</span>
question_answerer(question=question, context=context)`}}),Ks=new y({props:{code:`{'score': 0.97773,
 'start': 78,
 'end': 105,
 'answer': 'Jax, PyTorch and TensorFlow'}`,highlighted:`{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.97773</span>,
 <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">78</span>,
 <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">105</span>,
 <span class="hljs-string">&#x27;answer&#x27;</span>: <span class="hljs-string">&#x27;Jax, PyTorch and TensorFlow&#x27;</span>}`}}),Bs=new y({props:{code:`long_context = """
\u{1F917} Transformers: State of the Art NLP

\u{1F917} Transformers provides thousands of pretrained models to perform tasks on texts such as classification, information extraction,
question answering, summarization, translation, text generation and more in over 100 languages.
Its aim is to make cutting-edge NLP easier to use for everyone.

\u{1F917} Transformers provides APIs to quickly download and use those pretrained models on a given text, fine-tune them on your own datasets and
then share them with the community on our model hub. At the same time, each python module defining an architecture is fully standalone and
can be modified to enable quick research experiments.

Why should I use transformers?

1. Easy-to-use state-of-the-art models:
  - High performance on NLU and NLG tasks.
  - Low barrier to entry for educators and practitioners.
  - Few user-facing abstractions with just three classes to learn.
  - A unified API for using all our pretrained models.
  - Lower compute costs, smaller carbon footprint:

2. Researchers can share trained models instead of always retraining.
  - Practitioners can reduce compute time and production costs.
  - Dozens of architectures with over 10,000 pretrained models, some in more than 100 languages.

3. Choose the right framework for every part of a model's lifetime:
  - Train state-of-the-art models in 3 lines of code.
  - Move a single model between TF2.0/PyTorch frameworks at will.
  - Seamlessly pick the right framework for training, evaluation and production.

4. Easily customize a model or an example to your needs:
  - We provide examples for each architecture to reproduce the results published by its original authors.
  - Model internals are exposed as consistently as possible.
  - Model files can be used independently of the library for quick experiments.

\u{1F917} Transformers is backed by the three most popular deep learning libraries \u2014 Jax, PyTorch and TensorFlow \u2014 with a seamless integration
between them. It's straightforward to train your models with one before loading them for inference with the other.
"""
question_answerer(question=question, context=long_context)`,highlighted:`long_context = <span class="hljs-string">&quot;&quot;&quot;
\u{1F917} Transformers: State of the Art NLP

\u{1F917} Transformers provides thousands of pretrained models to perform tasks on texts such as classification, information extraction,
question answering, summarization, translation, text generation and more in over 100 languages.
Its aim is to make cutting-edge NLP easier to use for everyone.

\u{1F917} Transformers provides APIs to quickly download and use those pretrained models on a given text, fine-tune them on your own datasets and
then share them with the community on our model hub. At the same time, each python module defining an architecture is fully standalone and
can be modified to enable quick research experiments.

Why should I use transformers?

1. Easy-to-use state-of-the-art models:
  - High performance on NLU and NLG tasks.
  - Low barrier to entry for educators and practitioners.
  - Few user-facing abstractions with just three classes to learn.
  - A unified API for using all our pretrained models.
  - Lower compute costs, smaller carbon footprint:

2. Researchers can share trained models instead of always retraining.
  - Practitioners can reduce compute time and production costs.
  - Dozens of architectures with over 10,000 pretrained models, some in more than 100 languages.

3. Choose the right framework for every part of a model&#x27;s lifetime:
  - Train state-of-the-art models in 3 lines of code.
  - Move a single model between TF2.0/PyTorch frameworks at will.
  - Seamlessly pick the right framework for training, evaluation and production.

4. Easily customize a model or an example to your needs:
  - We provide examples for each architecture to reproduce the results published by its original authors.
  - Model internals are exposed as consistently as possible.
  - Model files can be used independently of the library for quick experiments.

\u{1F917} Transformers is backed by the three most popular deep learning libraries \u2014 Jax, PyTorch and TensorFlow \u2014 with a seamless integration
between them. It&#x27;s straightforward to train your models with one before loading them for inference with the other.
&quot;&quot;&quot;</span>
question_answerer(question=question, context=long_context)`}}),Ys=new y({props:{code:`{'score': 0.97149,
 'start': 1892,
 'end': 1919,
 'answer': 'Jax, PyTorch and TensorFlow'}`,highlighted:`{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.97149</span>,
 <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">1892</span>,
 <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">1919</span>,
 <span class="hljs-string">&#x27;answer&#x27;</span>: <span class="hljs-string">&#x27;Jax, PyTorch and TensorFlow&#x27;</span>}`}});const $i=[am,nm],Et=[];function bi(s,r){return s[0]==="pt"?0:1}B=bi(v),Y=Et[B]=$i[B](v),tt=new y({props:{code:`start_logits = outputs.start_logits
end_logits = outputs.end_logits
print(start_logits.shape, end_logits.shape)`,highlighted:`start_logits = outputs.start_logits
end_logits = outputs.end_logits
<span class="hljs-built_in">print</span>(start_logits.shape, end_logits.shape)`}});const ki=[om,rm],St=[];function wi(s,r){return s[0]==="pt"?0:1}V=wi(v),X=St[V]=ki[V](v);const xi=[lm,im],Pt=[];function vi(s,r){return s[0]==="pt"?0:1}Z=vi(v),ss=Pt[Z]=xi[Z](v);const ji=[pm,mm],Nt=[];function yi(s,r){return s[0]==="pt"?0:1}ts=yi(v),es=Nt[ts]=ji[ts](v),et=new y({props:{code:"scores = start_probabilities[:, None] * end_probabilities[None, :]",highlighted:'scores = start_probabilities[:, <span class="hljs-literal">None</span>] * end_probabilities[<span class="hljs-literal">None</span>, :]'}});const qi=[cm,fm],zt=[];function Ti(s,r){return s[0]==="pt"?0:1}ns=Ti(v),as=zt[ns]=qi[ns](v),nt=new y({props:{code:`max_index = scores.argmax().item()
start_index = max_index // scores.shape[1]
end_index = max_index % scores.shape[1]
print(scores[start_index, end_index])`,highlighted:`max_index = scores.argmax().item()
start_index = max_index // scores.shape[<span class="hljs-number">1</span>]
end_index = max_index % scores.shape[<span class="hljs-number">1</span>]
<span class="hljs-built_in">print</span>(scores[start_index, end_index])`}}),at=new y({props:{code:"0.97773",highlighted:'<span class="hljs-number">0.97773</span>'}}),Ss=new Ya({props:{$$slots:{default:[um]},$$scope:{ctx:v}}}),rt=new y({props:{code:`inputs_with_offsets = tokenizer(question, context, return_offsets_mapping=True)
offsets = inputs_with_offsets["offset_mapping"]

start_char, _ = offsets[start_index]
_, end_char = offsets[end_index]
answer = context[start_char:end_char]`,highlighted:`inputs_with_offsets = tokenizer(question, context, return_offsets_mapping=<span class="hljs-literal">True</span>)
offsets = inputs_with_offsets[<span class="hljs-string">&quot;offset_mapping&quot;</span>]

start_char, _ = offsets[start_index]
_, end_char = offsets[end_index]
answer = context[start_char:end_char]`}}),ot=new y({props:{code:`result = {
    "answer": answer,
    "start": start_char,
    "end": end_char,
    "score": scores[start_index, end_index],
}
print(result)`,highlighted:`result = {
    <span class="hljs-string">&quot;answer&quot;</span>: answer,
    <span class="hljs-string">&quot;start&quot;</span>: start_char,
    <span class="hljs-string">&quot;end&quot;</span>: end_char,
    <span class="hljs-string">&quot;score&quot;</span>: scores[start_index, end_index],
}
<span class="hljs-built_in">print</span>(result)`}}),it=new y({props:{code:`{'answer': 'Jax, PyTorch and TensorFlow',
 'start': 78,
 'end': 105,
 'score': 0.97773}`,highlighted:`{<span class="hljs-string">&#x27;answer&#x27;</span>: <span class="hljs-string">&#x27;Jax, PyTorch and TensorFlow&#x27;</span>,
 <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">78</span>,
 <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">105</span>,
 <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.97773</span>}`}}),Ps=new Ya({props:{$$slots:{default:[_m]},$$scope:{ctx:v}}}),mt=new y({props:{code:`inputs = tokenizer(question, long_context)
print(len(inputs["input_ids"]))`,highlighted:`inputs = tokenizer(question, long_context)
<span class="hljs-built_in">print</span>(<span class="hljs-built_in">len</span>(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>]))`}}),pt=new y({props:{code:"461",highlighted:'<span class="hljs-number">461</span>'}}),ft=new y({props:{code:`inputs = tokenizer(question, long_context, max_length=384, truncation="only_second")
print(tokenizer.decode(inputs["input_ids"]))`,highlighted:`inputs = tokenizer(question, long_context, max_length=<span class="hljs-number">384</span>, truncation=<span class="hljs-string">&quot;only_second&quot;</span>)
<span class="hljs-built_in">print</span>(tokenizer.decode(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>]))`}}),ct=new y({props:{code:`"""
[CLS] Which deep learning libraries back [UNK] Transformers? [SEP] [UNK] Transformers : State of the Art NLP

[UNK] Transformers provides thousands of pretrained models to perform tasks on texts such as classification, information extraction,
question answering, summarization, translation, text generation and more in over 100 languages.
Its aim is to make cutting-edge NLP easier to use for everyone.

[UNK] Transformers provides APIs to quickly download and use those pretrained models on a given text, fine-tune them on your own datasets and
then share them with the community on our model hub. At the same time, each python module defining an architecture is fully standalone and
can be modified to enable quick research experiments.

Why should I use transformers?

1. Easy-to-use state-of-the-art models:
  - High performance on NLU and NLG tasks.
  - Low barrier to entry for educators and practitioners.
  - Few user-facing abstractions with just three classes to learn.
  - A unified API for using all our pretrained models.
  - Lower compute costs, smaller carbon footprint:

2. Researchers can share trained models instead of always retraining.
  - Practitioners can reduce compute time and production costs.
  - Dozens of architectures with over 10,000 pretrained models, some in more than 100 languages.

3. Choose the right framework for every part of a model's lifetime:
  - Train state-of-the-art models in 3 lines of code.
  - Move a single model between TF2.0/PyTorch frameworks at will.
  - Seamlessly pick the right framework for training, evaluation and production.

4. Easily customize a model or an example to your needs:
  - We provide examples for each architecture to reproduce the results published by its original authors.
  - Model internal [SEP]
"""`,highlighted:`<span class="hljs-string">&quot;&quot;&quot;
[CLS] Which deep learning libraries back [UNK] Transformers? [SEP] [UNK] Transformers : State of the Art NLP

[UNK] Transformers provides thousands of pretrained models to perform tasks on texts such as classification, information extraction,
question answering, summarization, translation, text generation and more in over 100 languages.
Its aim is to make cutting-edge NLP easier to use for everyone.

[UNK] Transformers provides APIs to quickly download and use those pretrained models on a given text, fine-tune them on your own datasets and
then share them with the community on our model hub. At the same time, each python module defining an architecture is fully standalone and
can be modified to enable quick research experiments.

Why should I use transformers?

1. Easy-to-use state-of-the-art models:
  - High performance on NLU and NLG tasks.
  - Low barrier to entry for educators and practitioners.
  - Few user-facing abstractions with just three classes to learn.
  - A unified API for using all our pretrained models.
  - Lower compute costs, smaller carbon footprint:

2. Researchers can share trained models instead of always retraining.
  - Practitioners can reduce compute time and production costs.
  - Dozens of architectures with over 10,000 pretrained models, some in more than 100 languages.

3. Choose the right framework for every part of a model&#x27;s lifetime:
  - Train state-of-the-art models in 3 lines of code.
  - Move a single model between TF2.0/PyTorch frameworks at will.
  - Seamlessly pick the right framework for training, evaluation and production.

4. Easily customize a model or an example to your needs:
  - We provide examples for each architecture to reproduce the results published by its original authors.
  - Model internal [SEP]
&quot;&quot;&quot;</span>`}}),ut=new y({props:{code:`sentence = "This sentence is not too long but we are going to split it anyway."
inputs = tokenizer(
    sentence, truncation=True, return_overflowing_tokens=True, max_length=6, stride=2
)

for ids in inputs["input_ids"]:
    print(tokenizer.decode(ids))`,highlighted:`sentence = <span class="hljs-string">&quot;This sentence is not too long but we are going to split it anyway.&quot;</span>
inputs = tokenizer(
    sentence, truncation=<span class="hljs-literal">True</span>, return_overflowing_tokens=<span class="hljs-literal">True</span>, max_length=<span class="hljs-number">6</span>, stride=<span class="hljs-number">2</span>
)

<span class="hljs-keyword">for</span> ids <span class="hljs-keyword">in</span> inputs[<span class="hljs-string">&quot;input_ids&quot;</span>]:
    <span class="hljs-built_in">print</span>(tokenizer.decode(ids))`}}),_t=new y({props:{code:`'[CLS] This sentence is not [SEP]'
'[CLS] is not too long [SEP]'
'[CLS] too long but we [SEP]'
'[CLS] but we are going [SEP]'
'[CLS] are going to split [SEP]'
'[CLS] to split it anyway [SEP]'
'[CLS] it anyway. [SEP]'`,highlighted:`<span class="hljs-string">&#x27;[CLS] This sentence is not [SEP]&#x27;</span>
<span class="hljs-string">&#x27;[CLS] is not too long [SEP]&#x27;</span>
<span class="hljs-string">&#x27;[CLS] too long but we [SEP]&#x27;</span>
<span class="hljs-string">&#x27;[CLS] but we are going [SEP]&#x27;</span>
<span class="hljs-string">&#x27;[CLS] are going to split [SEP]&#x27;</span>
<span class="hljs-string">&#x27;[CLS] to split it anyway [SEP]&#x27;</span>
<span class="hljs-string">&#x27;[CLS] it anyway. [SEP]&#x27;</span>`}}),ht=new y({props:{code:"print(inputs.keys())",highlighted:'<span class="hljs-built_in">print</span>(inputs.keys())'}}),dt=new y({props:{code:"dict_keys(['input_ids', 'attention_mask', 'overflow_to_sample_mapping'])",highlighted:'dict_keys([<span class="hljs-string">&#x27;input_ids&#x27;</span>, <span class="hljs-string">&#x27;attention_mask&#x27;</span>, <span class="hljs-string">&#x27;overflow_to_sample_mapping&#x27;</span>])'}}),gt=new y({props:{code:'print(inputs["overflow_to_sample_mapping"])',highlighted:'<span class="hljs-built_in">print</span>(inputs[<span class="hljs-string">&quot;overflow_to_sample_mapping&quot;</span>])'}}),$t=new y({props:{code:"[0, 0, 0, 0, 0, 0, 0]",highlighted:'[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]'}}),bt=new y({props:{code:`sentences = [
    "This sentence is not too long but we are going to split it anyway.",
    "This sentence is shorter but will still get split.",
]
inputs = tokenizer(
    sentences, truncation=True, return_overflowing_tokens=True, max_length=6, stride=2
)

print(inputs["overflow_to_sample_mapping"])`,highlighted:`sentences = [
    <span class="hljs-string">&quot;This sentence is not too long but we are going to split it anyway.&quot;</span>,
    <span class="hljs-string">&quot;This sentence is shorter but will still get split.&quot;</span>,
]
inputs = tokenizer(
    sentences, truncation=<span class="hljs-literal">True</span>, return_overflowing_tokens=<span class="hljs-literal">True</span>, max_length=<span class="hljs-number">6</span>, stride=<span class="hljs-number">2</span>
)

<span class="hljs-built_in">print</span>(inputs[<span class="hljs-string">&quot;overflow_to_sample_mapping&quot;</span>])`}}),kt=new y({props:{code:"[0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1]",highlighted:'[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>]'}}),wt=new y({props:{code:`inputs = tokenizer(
    question,
    long_context,
    stride=128,
    max_length=384,
    padding="longest",
    truncation="only_second",
    return_overflowing_tokens=True,
    return_offsets_mapping=True,
)`,highlighted:`inputs = tokenizer(
    question,
    long_context,
    stride=<span class="hljs-number">128</span>,
    max_length=<span class="hljs-number">384</span>,
    padding=<span class="hljs-string">&quot;longest&quot;</span>,
    truncation=<span class="hljs-string">&quot;only_second&quot;</span>,
    return_overflowing_tokens=<span class="hljs-literal">True</span>,
    return_offsets_mapping=<span class="hljs-literal">True</span>,
)`}});const Ei=[dm,hm],At=[];function Si(s,r){return s[0]==="pt"?0:1}rs=Si(v),os=At[rs]=Ei[rs](v),xt=new y({props:{code:`outputs = model(**inputs)

start_logits = outputs.start_logits
end_logits = outputs.end_logits
print(start_logits.shape, end_logits.shape)`,highlighted:`outputs = model(**inputs)

start_logits = outputs.start_logits
end_logits = outputs.end_logits
<span class="hljs-built_in">print</span>(start_logits.shape, end_logits.shape)`}});const Pi=[$m,gm],Lt=[];function Ni(s,r){return s[0]==="pt"?0:1}is=Ni(v),ls=Lt[is]=Pi[is](v);const zi=[km,bm],Gt=[];function Ai(s,r){return s[0]==="pt"?0:1}ms=Ai(v),ps=Gt[ms]=zi[ms](v);const Li=[xm,wm],Ct=[];function Gi(s,r){return s[0]==="pt"?0:1}fs=Gi(v),cs=Ct[fs]=Li[fs](v);const Ci=[jm,vm],Rt=[];function Ri(s,r){return s[0]==="pt"?0:1}return us=Ri(v),_s=Rt[us]=Ci[us](v),vt=new y({props:{code:"[(0, 18, 0.33867), (173, 184, 0.97149)]",highlighted:'[(<span class="hljs-number">0</span>, <span class="hljs-number">18</span>, <span class="hljs-number">0.33867</span>), (<span class="hljs-number">173</span>, <span class="hljs-number">184</span>, <span class="hljs-number">0.97149</span>)]'}}),Cs=new Ya({props:{$$slots:{default:[ym]},$$scope:{ctx:v}}}),jt=new y({props:{code:`for candidate, offset in zip(candidates, offsets):
    start_token, end_token, score = candidate
    start_char, _ = offset[start_token]
    _, end_char = offset[end_token]
    answer = long_context[start_char:end_char]
    result = {"answer": answer, "start": start_char, "end": end_char, "score": score}
    print(result)`,highlighted:`<span class="hljs-keyword">for</span> candidate, offset <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(candidates, offsets):
    start_token, end_token, score = candidate
    start_char, _ = offset[start_token]
    _, end_char = offset[end_token]
    answer = long_context[start_char:end_char]
    result = {<span class="hljs-string">&quot;answer&quot;</span>: answer, <span class="hljs-string">&quot;start&quot;</span>: start_char, <span class="hljs-string">&quot;end&quot;</span>: end_char, <span class="hljs-string">&quot;score&quot;</span>: score}
    <span class="hljs-built_in">print</span>(result)`}}),yt=new y({props:{code:`{'answer': '\\n\u{1F917} Transformers: State of the Art NLP', 'start': 0, 'end': 37, 'score': 0.33867}
{'answer': 'Jax, PyTorch and TensorFlow', 'start': 1892, 'end': 1919, 'score': 0.97149}`,highlighted:`{<span class="hljs-string">&#x27;answer&#x27;</span>: <span class="hljs-string">&#x27;\\n\u{1F917} Transformers: State of the Art NLP&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">0</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">37</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.33867</span>}
{<span class="hljs-string">&#x27;answer&#x27;</span>: <span class="hljs-string">&#x27;Jax, PyTorch and TensorFlow&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">1892</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">1919</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.97149</span>}`}}),Os=new Ya({props:{$$slots:{default:[qm]},$$scope:{ctx:v}}}),{c(){n=p("meta"),m=u(),b(t.$$.fragment),g=u(),$=p("h1"),j=p("a"),q=p("span"),b(S.$$.fragment),A=u(),O=p("span"),W=o("QA \u7BA1\u9053\u4E2D\u7684\u5FEB\u901F\u6807\u8BB0\u5668"),G=u(),z.c(),T=u(),E=p("p"),vs=o("\u6211\u4EEC\u73B0\u5728\u5C06\u6DF1\u5165\u7814\u7A76 "),Q=p("strong"),js=o("question-answering"),Va=o(" \u7BA1\u9053\uFF0C\u770B\u770B\u5982\u4F55\u5229\u7528\u504F\u79FB\u91CF\u4ECE\u4E0A\u4E0B\u6587\u4E2D\u83B7\u53D6\u624B\u5934\u95EE\u9898\u7684\u7B54\u6848\uFF0C\u6709\u70B9\u50CF\u6211\u4EEC\u5728\u4E0A\u4E00\u8282\u4E2D\u5BF9\u5206\u7EC4\u5B9E\u4F53\u6240\u505A\u7684\u3002\u7136\u540E\u6211\u4EEC\u5C06\u770B\u5230\u6211\u4EEC\u5982\u4F55\u5904\u7406\u6700\u7EC8\u88AB\u622A\u65AD\u7684\u975E\u5E38\u957F\u7684\u4E0A\u4E0B\u6587\u3002\u5982\u679C\u60A8\u5BF9\u95EE\u7B54\u4EFB\u52A1\u4E0D\u611F\u5174\u8DA3\uFF0C\u53EF\u4EE5\u8DF3\u8FC7\u6B64\u90E8\u5206\u3002"),$n=u(),K.c(),Mt=u(),ys=p("h2"),Ts=p("a"),Ne=p("span"),b(Ws.$$.fragment),Xa=u(),Qs=p("span"),Za=o("\u4F7F\u7528 "),ze=p("code"),sr=o("question-answering"),tr=o(" \u7BA1\u9053"),bn=u(),ds=p("p"),er=o("\u6B63\u5982\u6211\u4EEC\u5728"),It=p("a"),nr=o("Chapter 1"),ar=o("\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528 "),Ae=p("strong"),rr=o("question-answering"),or=o(" \u50CF\u8FD9\u6837\u7684\u7BA1\u9053\u4EE5\u83B7\u5F97\u95EE\u9898\u7684\u7B54\u6848\uFF1A"),kn=u(),b(Hs.$$.fragment),wn=u(),b(Ks.$$.fragment),xn=u(),Ut=p("p"),ir=o("\u4E0E\u5176\u4ED6\u7BA1\u9053\u4E0D\u540C\uFF0C\u5B83\u4E0D\u80FD\u622A\u65AD\u548C\u62C6\u5206\u957F\u4E8E\u6A21\u578B\u63A5\u53D7\u7684\u6700\u5927\u957F\u5EA6\u7684\u6587\u672C\uFF08\u56E0\u6B64\u53EF\u80FD\u4F1A\u4E22\u5931\u6587\u6863\u672B\u5C3E\u7684\u4FE1\u606F\uFF09\uFF0C\u6B64\u7BA1\u9053\u53EF\u4EE5\u5904\u7406\u975E\u5E38\u957F\u7684\u4E0A\u4E0B\u6587\uFF0C\u5E76\u5C06\u8FD4\u56DE\u56DE\u7B54\u8FD9\u4E2A\u95EE\u9898\uFF0C\u5373\u4F7F\u5B83\u5728\u6700\u540E\uFF1A"),vn=u(),b(Bs.$$.fragment),jn=u(),b(Ys.$$.fragment),yn=u(),Dt=p("p"),lr=o("\u8BA9\u6211\u4EEC\u770B\u770B\u5B83\u662F\u5982\u4F55\u505A\u5230\u8FD9\u4E00\u5207\u7684\uFF01"),qn=u(),Vs=p("h2"),mr=o("\u4F7F\u7528\u6A21\u578B\u8FDB\u884C\u95EE\u7B54"),Tn=u(),F=p("p"),pr=o("\u4E0E\u4EFB\u4F55\u5176\u4ED6\u7BA1\u9053\u4E00\u6837\uFF0C\u6211\u4EEC\u9996\u5148\u5BF9\u8F93\u5165\u8FDB\u884C\u6807\u8BB0\u5316\uFF0C\u7136\u540E\u901A\u8FC7\u6A21\u578B\u5C06\u5176\u53D1\u9001\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u7528\u4E8E\u7684\u68C0\u67E5\u70B9 "),Le=p("strong"),fr=o("question-answering"),cr=o(" \u7BA1\u9053\u662F"),Xs=p("a"),ur=o("distilbert-base-cased-distilled-squad"),_r=o("\uFF08\u540D\u79F0\u4E2D\u7684\u201Csquad\u201D\u6765\u81EA\u6A21\u578B\u5FAE\u8C03\u7684\u6570\u636E\u96C6\uFF1B\u6211\u4EEC\u5C06\u5728"),Jt=p("a"),hr=o("Chapter 7"),dr=o("):"),En=u(),Y.c(),Wt=u(),Qt=p("p"),gr=o("\u8BF7\u6CE8\u610F\uFF0C\u6211\u4EEC\u5C06\u95EE\u9898\u548C\u4E0A\u4E0B\u6587\u6807\u8BB0\u4E3A\u4E00\u5BF9\uFF0C\u9996\u5148\u662F\u95EE\u9898"),Sn=u(),qs=p("div"),Zs=p("img"),$r=u(),st=p("img"),Pn=u(),Ht=p("p"),br=o("\u95EE\u7B54\u6A21\u578B\u7684\u5DE5\u4F5C\u65B9\u5F0F\u4E0E\u6211\u4EEC\u8FC4\u4ECA\u4E3A\u6B62\u770B\u5230\u7684\u6A21\u578B\u7565\u6709\u4E0D\u540C\u3002\u4EE5\u4E0A\u56FE\u4E3A\u4F8B\uFF0C\u8BE5\u6A21\u578B\u5DF2\u7ECF\u8FC7\u8BAD\u7EC3\uFF0C\u53EF\u4EE5\u9884\u6D4B\u7B54\u6848\u5F00\u59CB\u7684\u6807\u8BB0\u7684\u7D22\u5F15\uFF08\u6B64\u5904\u4E3A 21\uFF09\u548C\u7B54\u6848\u7ED3\u675F\u5904\u7684\u6807\u8BB0\u7684\u7D22\u5F15\uFF08\u6B64\u5904\u4E3A 24\uFF09\u3002\u8FD9\u5C31\u662F\u4E3A\u4EC0\u4E48\u8FD9\u4E9B\u6A21\u578B\u4E0D\u8FD4\u56DE\u4E00\u4E2A logits \u7684\u5F20\u91CF\uFF0C\u800C\u662F\u8FD4\u56DE\u4E24\u4E2A\uFF1A\u4E00\u4E2A\u7528\u4E8E\u5BF9\u5E94\u4E8E\u7B54\u6848\u7684\u5F00\u59CB\u6807\u8BB0\u7684 logits\uFF0C\u53E6\u4E00\u4E2A\u7528\u4E8E\u5BF9\u5E94\u4E8E\u7B54\u6848\u7684\u7ED3\u675F\u6807\u8BB0\u7684 logits\u3002\u7531\u4E8E\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\u6211\u4EEC\u53EA\u6709\u4E00\u4E2A\u5305\u542B 66 \u4E2A\u6807\u8BB0\u7684\u8F93\u5165\uFF0C\u6211\u4EEC\u5F97\u5230\uFF1A"),Nn=u(),b(tt.$$.fragment),zn=u(),X.c(),Kt=u(),M=p("p"),kr=o("\u4E3A\u4E86\u5C06\u8FD9\u4E9B logits \u8F6C\u6362\u4E3A\u6982\u7387\uFF0C\u6211\u4EEC\u5C06\u5E94\u7528\u4E00\u4E2A softmax \u51FD\u6570\u2014\u2014\u4F46\u5728\u6B64\u4E4B\u524D\uFF0C\u6211\u4EEC\u9700\u8981\u786E\u4FDD\u6211\u4EEC\u5C4F\u853D\u4E86\u4E0D\u5C5E\u4E8E\u4E0A\u4E0B\u6587\u7684\u7D22\u5F15\u3002\u6211\u4EEC\u7684\u8F93\u5165\u662F "),Ge=p("strong"),wr=o("[CLS] question [SEP] context [SEP]"),xr=o(" \uFF0C\u6240\u4EE5\u6211\u4EEC\u9700\u8981\u5C4F\u853D\u95EE\u9898\u7684\u6807\u8BB0\u4EE5\u53CA "),Ce=p("strong"),vr=o("[SEP]"),jr=o(" \u4EE4\u724C\u3002\u6211\u4EEC\u5C06\u4FDD\u7559 "),Re=p("strong"),yr=o("[CLS]"),qr=o(" \u7136\u800C\uFF0C\u56E0\u4E3A\u67D0\u4E9B\u6A21\u578B\u4F7F\u7528\u5B83\u6765\u8868\u793A\u7B54\u6848\u4E0D\u5728\u4E0A\u4E0B\u6587\u4E2D\u3002"),An=u(),Es=p("p"),Tr=o("\u7531\u4E8E\u6211\u4EEC\u5C06\u5728\u4E4B\u540E\u5E94\u7528 softmax\uFF0C\u6211\u4EEC\u53EA\u9700\u8981\u7528\u4E00\u4E2A\u5927\u7684\u8D1F\u6570\u66FF\u6362\u6211\u4EEC\u60F3\u8981\u5C4F\u853D\u7684 logits\u3002\u5728\u8FD9\u91CC\uFF0C\u6211\u4EEC\u4F7F\u7528 "),Oe=p("strong"),Er=o("-10000"),Sr=o(" \uFF1A"),Ln=u(),ss.c(),Bt=u(),Yt=p("p"),Pr=o("\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u6B63\u786E\u5C4F\u853D\u4E86\u4E0E\u6211\u4EEC\u4E0D\u60F3\u9884\u6D4B\u7684\u4F4D\u7F6E\u76F8\u5BF9\u5E94\u7684 logits\uFF0C\u6211\u4EEC\u53EF\u4EE5\u5E94\u7528 softmax\uFF1A"),Gn=u(),es.c(),Vt=u(),C=p("p"),Nr=o("\u5728\u8FD9\u4E2A\u9636\u6BB5\uFF0C\u6211\u4EEC\u53EF\u4EE5\u91C7\u7528\u5F00\u59CB\u548C\u7ED3\u675F\u6982\u7387\u7684 argmax\u2014\u2014\u4F46\u6211\u4EEC\u6700\u7EC8\u53EF\u80FD\u4F1A\u5F97\u5230\u4E00\u4E2A\u5927\u4E8E\u7ED3\u675F\u7D22\u5F15\u7684\u5F00\u59CB\u7D22\u5F15\uFF0C\u6240\u4EE5\u6211\u4EEC\u9700\u8981\u91C7\u53D6\u66F4\u591A\u7684\u9884\u9632\u63AA\u65BD\u3002\u6211\u4EEC\u5C06\u8BA1\u7B97\u6BCF\u4E2A\u53EF\u80FD\u7684\u6982\u7387 "),Fe=p("strong"),zr=o("start_index"),Ar=o(" \u548C "),Me=p("strong"),Lr=o("end_index"),Gr=o(" \u5728\u54EA\u91CC "),Ie=p("strong"),Cr=o("start_index <= end_index"),Rr=o(" \uFF0C\u7136\u540E\u53D6\u5143\u7EC4 "),Ue=p("strong"),Or=o("(start_index, end_index)"),Fr=o(" \u4EE5\u6700\u9AD8\u7684\u6982\u7387\u3002"),Cn=u(),L=p("p"),Mr=o("\u5047\u8BBE\u4E8B\u4EF6\u201C\u7B54\u6848\u5F00\u59CB\u4E8E "),De=p("strong"),Ir=o("start_index"),Ur=o(" \u201D\u548C\u201C\u7B54\u6848\u7ED3\u675F\u4E8E "),Je=p("strong"),Dr=o("end_index"),Jr=o(" \u201D \u8981\u72EC\u7ACB\uFF0C\u7B54\u6848\u5F00\u59CB\u4E8E\u7684\u6982\u7387 "),We=p("strong"),Wr=o("start_index"),Qr=o(" \u5E76\u7ED3\u675F\u4E8E "),Qe=p("strong"),Hr=o("end_index"),Kr=o(` \u662F\uFF1A
`),Rn=new Fl,On=u(),gs=p("p"),Br=o("\u6240\u4EE5\uFF0C\u8981\u8BA1\u7B97\u6240\u6709\u7684\u5206\u6570\uFF0C\u6211\u4EEC\u53EA\u9700\u8981\u8BA1\u7B97\u6240\u6709\u7684\u4EA7\u54C1 "),Fn=new Fl,Mn=o(" where "),He=p("code"),Yr=o("start_index <= end_index"),Vr=o("."),In=u(),Xt=p("p"),Xr=o("\u9996\u5148\u8BA9\u6211\u4EEC\u8BA1\u7B97\u6240\u6709\u53EF\u80FD\u7684\u4EA7\u54C1\uFF1A"),Un=u(),b(et.$$.fragment),Dn=u(),as.c(),Zt=u(),R=p("p"),Zr=o("\u73B0\u5728\u6211\u4EEC\u53EA\u9700\u8981\u5F97\u5230\u6700\u5927\u503C\u7684\u7D22\u5F15\u3002\u7531\u4E8E PyTorch \u5C06\u8FD4\u56DE\u5C55\u5E73\u5F20\u91CF\u4E2D\u7684\u7D22\u5F15\uFF0C\u56E0\u6B64\u6211\u4EEC\u9700\u8981\u4F7F\u7528\u5730\u677F\u9664\u6CD5 "),Ke=p("strong"),so=o("//"),to=o(" \u548C\u6A21\u6570 "),Be=p("strong"),eo=o("%"),no=o(" \u64CD\u4F5C\u4EE5\u83B7\u5F97 "),Ye=p("strong"),ao=o("start_index"),ro=o(" \u548C "),Ve=p("strong"),oo=o("end_index"),io=o(" \uFF1A"),Jn=u(),b(nt.$$.fragment),Wn=u(),se=p("p"),lo=o("\u6211\u4EEC\u8FD8\u6CA1\u6709\u5B8C\u5168\u5B8C\u6210\uFF0C\u4F46\u81F3\u5C11\u6211\u4EEC\u5DF2\u7ECF\u6709\u4E86\u6B63\u786E\u7684\u7B54\u6848\u5206\u6570\uFF08\u60A8\u53EF\u4EE5\u901A\u8FC7\u5C06\u5176\u4E0E\u4E0A\u4E00\u8282\u4E2D\u7684\u7B2C\u4E00\u4E2A\u7ED3\u679C\u8FDB\u884C\u6BD4\u8F83\u6765\u68C0\u67E5\u8FD9\u4E00\u70B9\uFF09\uFF1A"),Qn=u(),b(at.$$.fragment),Hn=u(),b(Ss.$$.fragment),Kn=u(),$s=p("p"),mo=o("\u6211\u4EEC\u6709 "),Xe=p("strong"),po=o("start_index"),fo=o(" \u548C "),Ze=p("strong"),co=o("end_index"),uo=o(" \u5C31\u6807\u8BB0\u800C\u8A00\u7684\u7B54\u6848\uFF0C\u6240\u4EE5\u73B0\u5728\u6211\u4EEC\u53EA\u9700\u8981\u8F6C\u6362\u4E3A\u4E0A\u4E0B\u6587\u4E2D\u7684\u5B57\u7B26\u7D22\u5F15\u3002\u8FD9\u662F\u504F\u79FB\u91CF\u975E\u5E38\u6709\u7528\u7684\u5730\u65B9\u3002\u6211\u4EEC\u53EF\u4EE5\u50CF\u5728\u4EE4\u724C\u5206\u7C7B\u4EFB\u52A1\u4E2D\u4E00\u6837\u6293\u4F4F\u5B83\u4EEC\u5E76\u4F7F\u7528\u5B83\u4EEC\uFF1A"),Bn=u(),b(rt.$$.fragment),Yn=u(),te=p("p"),_o=o("\u73B0\u5728\u6211\u4EEC\u53EA\u9700\u8981\u683C\u5F0F\u5316\u6240\u6709\u5185\u5BB9\u4EE5\u83B7\u5F97\u6211\u4EEC\u7684\u7ED3\u679C\uFF1A"),Vn=u(),b(ot.$$.fragment),Xn=u(),b(it.$$.fragment),Zn=u(),ee=p("p"),ho=o("\u592A\u68D2\u4E86\uFF01\u8FD9\u548C\u6211\u4EEC\u7684\u7B2C\u4E00\u4E2A\u4F8B\u5B50\u4E00\u6837\uFF01"),sa=u(),b(Ps.$$.fragment),ta=u(),lt=p("h2"),go=o("\u5904\u7406\u957F\u4E0A\u4E0B\u6587"),ea=u(),Ns=p("p"),$o=o("\u5982\u679C\u6211\u4EEC\u5C1D\u8BD5\u5BF9\u6211\u4EEC\u4E4B\u524D\u4F5C\u4E3A\u793A\u4F8B\u4F7F\u7528\u7684\u95EE\u9898\u548C\u957F\u4E0A\u4E0B\u6587\u8FDB\u884C\u6807\u8BB0\u5316\uFF0C\u6211\u4EEC\u5C06\u83B7\u5F97\u6BD4\u5728 "),sn=p("strong"),bo=o("question-answering"),ko=o(" \u7BA1\u9053\uFF08\u5373 384\uFF09\uFF1A"),na=u(),b(mt.$$.fragment),aa=u(),b(pt.$$.fragment),ra=u(),zs=p("p"),wo=o("\u56E0\u6B64\uFF0C\u6211\u4EEC\u9700\u8981\u5728\u6700\u5927\u957F\u5EA6\u5904\u622A\u65AD\u6211\u4EEC\u7684\u8F93\u5165\u3002\u6709\u51E0\u79CD\u65B9\u6CD5\u53EF\u4EE5\u505A\u5230\u8FD9\u4E00\u70B9\uFF0C\u4F46\u6211\u4EEC\u4E0D\u60F3\u622A\u65AD\u95EE\u9898\uFF0C\u53EA\u60F3\u622A\u65AD\u4E0A\u4E0B\u6587\u3002\u7531\u4E8E\u4E0A\u4E0B\u6587\u662F\u7B2C\u4E8C\u4E2A\u53E5\u5B50\uFF0C\u6211\u4EEC\u5C06\u4F7F\u7528 "),tn=p("strong"),xo=o("\u201Conly_second\u201D"),vo=o(" \u622A\u65AD\u7B56\u7565\u3002\u90A3\u4E48\u51FA\u73B0\u7684\u95EE\u9898\u662F\u95EE\u9898\u7684\u7B54\u6848\u53EF\u80FD\u4E0D\u5728\u622A\u65AD\u4E0A\u4E0B\u6587\u4E2D\u3002\u4F8B\u5982\uFF0C\u5728\u8FD9\u91CC\uFF0C\u6211\u4EEC\u9009\u62E9\u4E86\u4E00\u4E2A\u7B54\u6848\u5728\u4E0A\u4E0B\u6587\u672B\u5C3E\u7684\u95EE\u9898\uFF0C\u5F53\u6211\u4EEC\u622A\u65AD\u5B83\u65F6\uFF0C\u7B54\u6848\u4E0D\u5B58\u5728"),oa=u(),b(ft.$$.fragment),ia=u(),b(ct.$$.fragment),la=u(),As=p("p"),jo=o("\u8FD9\u610F\u5473\u7740\u6A21\u578B\u5C06\u5F88\u96BE\u9009\u62E9\u6B63\u786E\u7684\u7B54\u6848\u3002\u4E3A\u4E86\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\uFF0C "),en=p("strong"),yo=o("question-answering"),qo=o(" \u7BA1\u9053\u5141\u8BB8\u6211\u4EEC\u5C06\u4E0A\u4E0B\u6587\u5206\u6210\u66F4\u5C0F\u7684\u5757\uFF0C\u6307\u5B9A\u6700\u5927\u957F\u5EA6\u3002\u4E3A\u786E\u4FDD\u6211\u4EEC\u4E0D\u4F1A\u5728\u5B8C\u5168\u9519\u8BEF\u7684\u4F4D\u7F6E\u62C6\u5206\u4E0A\u4E0B\u6587\u4EE5\u627E\u5230\u7B54\u6848\uFF0C\u5B83\u8FD8\u5305\u62EC\u5757\u4E4B\u95F4\u7684\u4E00\u4E9B\u91CD\u53E0\u3002"),ma=u(),bs=p("p"),To=o("\u6211\u4EEC\u53EF\u4EE5\u8BA9\u5206\u8BCD\u5668\uFF08\u5FEB\u6216\u6162\uFF09\u901A\u8FC7\u6DFB\u52A0\u6765\u4E3A\u6211\u4EEC\u505A\u8FD9\u4EF6\u4E8B "),nn=p("strong"),Eo=o("return_overflowing_tokens=True"),So=o(" \uFF0C\u6211\u4EEC\u53EF\u4EE5\u6307\u5B9A\u6211\u4EEC\u60F3\u8981\u7684\u91CD\u53E0 "),an=p("strong"),Po=o("stride"),No=o(" \u4E89\u8BBA\u3002\u8FD9\u662F\u4E00\u4E2A\u4F7F\u7528\u8F83\u5C0F\u53E5\u5B50\u7684\u793A\u4F8B\uFF1A"),pa=u(),b(ut.$$.fragment),fa=u(),b(_t.$$.fragment),ca=u(),Ls=p("p"),zo=o("\u6B63\u5982\u6211\u4EEC\u6240\u770B\u5230\u7684\uFF0C\u53E5\u5B50\u5DF2\u88AB\u5206\u6210\u591A\u4E2A\u5757\uFF0C\u4F7F\u5F97\u6BCF\u4E2A\u6761\u76EE "),rn=p("strong"),Ao=o("inputs[\u201Cinput_ids\u201D]"),Lo=o(" \u6700\u591A\u6709 6 \u4E2A\u6807\u8BB0\uFF08\u6211\u4EEC\u9700\u8981\u6DFB\u52A0\u586B\u5145\u4EE5\u4F7F\u6700\u540E\u4E00\u4E2A\u6761\u76EE\u4E0E\u5176\u4ED6\u6761\u76EE\u7684\u5927\u5C0F\u76F8\u540C\uFF09\u5E76\u4E14\u6BCF\u4E2A\u6761\u76EE\u4E4B\u95F4\u6709 2 \u4E2A\u6807\u8BB0\u7684\u91CD\u53E0\u3002"),ua=u(),ne=p("p"),Go=o("\u8BA9\u6211\u4EEC\u4ED4\u7EC6\u770B\u770B\u6807\u8BB0\u5316\u7684\u7ED3\u679C\uFF1A"),_a=u(),b(ht.$$.fragment),ha=u(),b(dt.$$.fragment),da=u(),Gs=p("p"),Co=o("\u6B63\u5982\u9884\u671F\u7684\u90A3\u6837\uFF0C\u6211\u4EEC\u5F97\u5230\u4E86\u8F93\u5165 ID \u548C\u4E00\u4E2A\u6CE8\u610F\u529B\u63A9\u7801\u3002\u6700\u540E\u4E00\u4E2A\u952E\uFF0C "),on=p("strong"),Ro=o("overflow_to_sample_mapping"),Oo=o(" , \u662F\u4E00\u4E2A\u6620\u5C04\uFF0C\u5B83\u544A\u8BC9\u6211\u4EEC\u6BCF\u4E2A\u7ED3\u679C\u5BF9\u5E94\u54EA\u4E2A\u53E5\u5B50\u2014\u2014\u8FD9\u91CC\u6211\u4EEC\u6709 7 \u4E2A\u7ED3\u679C\uFF0C\u5B83\u4EEC\u90FD\u6765\u81EA\u6211\u4EEC\u901A\u8FC7\u6807\u8BB0\u5668\u7684\uFF08\u552F\u4E00\uFF09\u53E5\u5B50\uFF1A"),ga=u(),b(gt.$$.fragment),$a=u(),b($t.$$.fragment),ba=u(),ae=p("p"),Fo=o("\u5F53\u6211\u4EEC\u5C06\u51E0\u4E2A\u53E5\u5B50\u6807\u8BB0\u5728\u4E00\u8D77\u65F6\uFF0C\u8FD9\u66F4\u6709\u7528\u3002\u4F8B\u5982\uFF0C\u8FD9\u4E2A\uFF1A"),ka=u(),b(bt.$$.fragment),wa=u(),re=p("p"),Mo=o("\u8BA9\u6211\u4EEC\uFF1A"),xa=u(),b(kt.$$.fragment),va=u(),oe=p("p"),Io=o("\u8FD9\u610F\u5473\u7740\u7B2C\u4E00\u4E2A\u53E5\u5B50\u50CF\u4EE5\u524D\u4E00\u6837\u5206\u6210 7 \u4E2A\u5757\uFF0C\u63A5\u4E0B\u6765\u7684 4 \u4E2A\u5757\u6765\u81EA\u7B2C\u4E8C\u4E2A\u53E5\u5B50\u3002"),ja=u(),I=p("p"),Uo=o("\u73B0\u5728\u8BA9\u6211\u4EEC\u56DE\u5230\u6211\u4EEC\u7684\u957F\u671F\u80CC\u666F\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B "),ln=p("strong"),Do=o("question-answering"),Jo=o(" \u7BA1\u9053\u4F7F\u7528\u7684\u6700\u5927\u957F\u5EA6\u4E3A 384\uFF0C\u6B63\u5982\u6211\u4EEC\u4E4B\u524D\u63D0\u5230\u7684\uFF0C\u6B65\u957F\u4E3A 128\uFF0C\u8FD9\u5BF9\u5E94\u4E8E\u6A21\u578B\u5FAE\u8C03\u7684\u65B9\u5F0F\uFF08\u60A8\u53EF\u4EE5\u901A\u8FC7\u4F20\u9012 "),mn=p("strong"),Wo=o("max_seq_len"),Qo=o(" \u548C "),pn=p("strong"),Ho=o("stride"),Ko=o(" \u8C03\u7528\u7BA1\u9053\u65F6\u7684\u53C2\u6570\uFF09\u3002\u56E0\u6B64\uFF0C\u6211\u4EEC\u5C06\u5728\u6807\u8BB0\u5316\u65F6\u4F7F\u7528\u8FD9\u4E9B\u53C2\u6570\u3002\u6211\u4EEC\u8FD8\u5C06\u6DFB\u52A0\u586B\u5145\uFF08\u5177\u6709\u76F8\u540C\u957F\u5EA6\u7684\u6837\u672C\uFF0C\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u6784\u5EFA\u5F20\u91CF\uFF09\u4EE5\u53CA\u8BF7\u6C42\u504F\u79FB\u91CF\uFF1A"),ya=u(),b(wt.$$.fragment),qa=u(),U=p("p"),Bo=o("\u90A3\u4E9B "),fn=p("strong"),Yo=o("inputs"),Vo=o(" \u5C06\u5305\u542B\u6A21\u578B\u671F\u671B\u7684\u8F93\u5165 ID \u548C\u6CE8\u610F\u529B\u63A9\u7801\uFF0C\u4EE5\u53CA\u504F\u79FB\u91CF\u548C "),cn=p("strong"),Xo=o("overflow_to_sample_mapping"),Zo=o(" \u6211\u4EEC\u521A\u521A\u8C08\u5230\u3002\u7531\u4E8E\u8FD9\u4E24\u4E2A\u4E0D\u662F\u6A21\u578B\u4F7F\u7528\u7684\u53C2\u6570\uFF0C\u6211\u4EEC\u5C06\u628A\u5B83\u4EEC\u4ECE "),un=p("strong"),si=o("inputs"),ti=o(" \uFF08\u6211\u4EEC\u4E0D\u4F1A\u5B58\u50A8\u5730\u56FE\uFF0C\u56E0\u4E3A\u5B83\u5728\u8FD9\u91CC\u6CA1\u6709\u7528\uFF09\u5728\u5C06\u5176\u8F6C\u6362\u4E3A\u5F20\u91CF\u4E4B\u524D\uFF1A"),Ta=u(),os.c(),ie=u(),le=p("p"),ei=o("\u6211\u4EEC\u7684\u957F\u4E0A\u4E0B\u6587\u88AB\u5206\u6210\u4E24\u90E8\u5206\uFF0C\u8FD9\u610F\u5473\u7740\u5728\u5B83\u901A\u8FC7\u6211\u4EEC\u7684\u6A21\u578B\u540E\uFF0C\u6211\u4EEC\u5C06\u6709\u4E24\u7EC4\u5F00\u59CB\u548C\u7ED3\u675F logits\uFF1A"),Ea=u(),b(xt.$$.fragment),Sa=u(),ls.c(),me=u(),pe=p("p"),ni=o("\u548C\u4EE5\u524D\u4E00\u6837\uFF0C\u6211\u4EEC\u5728\u91C7\u7528 softmax \u4E4B\u524D\u9996\u5148\u5C4F\u853D\u4E0D\u5C5E\u4E8E\u4E0A\u4E0B\u6587\u7684\u6807\u8BB0\u3002\u6211\u4EEC\u8FD8\u5C4F\u853D\u4E86\u6240\u6709\u586B\u5145\u6807\u8BB0\uFF08\u7531\u6CE8\u610F\u63A9\u7801\u6807\u8BB0\uFF09\uFF1A"),Pa=u(),ps.c(),fe=u(),ce=p("p"),ai=o("\u7136\u540E\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528 softmax \u5C06\u6211\u4EEC\u7684 logits \u8F6C\u6362\u4E3A\u6982\u7387\uFF1A"),Na=u(),cs.c(),ue=u(),_e=p("p"),ri=o("\u4E0B\u4E00\u6B65\u4E0E\u6211\u4EEC\u5BF9\u5C0F\u4E0A\u4E0B\u6587\u6240\u505A\u7684\u7C7B\u4F3C\uFF0C\u4F46\u6211\u4EEC\u5BF9\u4E24\u4E2A\u5757\u4E2D\u7684\u6BCF\u4E00\u4E2A\u90FD\u91CD\u590D\u5B83\u3002\u6211\u4EEC\u5C06\u5206\u6570\u5F52\u56E0\u4E8E\u6240\u6709\u53EF\u80FD\u7684\u7B54\u6848\u8DE8\u5EA6\uFF0C\u7136\u540E\u53D6\u5F97\u5206\u6700\u9AD8\u7684\u8DE8\u5EA6\uFF1A"),za=u(),_s.c(),he=u(),b(vt.$$.fragment),Aa=u(),de=p("p"),oi=o("\u8FD9\u4E24\u4E2A\u5019\u9009\u5BF9\u5E94\u4E8E\u6A21\u578B\u80FD\u591F\u5728\u6BCF\u4E2A\u5757\u4E2D\u627E\u5230\u7684\u6700\u4F73\u7B54\u6848\u3002\u8BE5\u6A21\u578B\u5BF9\u6B63\u786E\u7B54\u6848\u5728\u7B2C\u4E8C\u90E8\u5206\u66F4\u6709\u4FE1\u5FC3\uFF08\u8FD9\u662F\u4E00\u4E2A\u597D\u5146\u5934\uFF01\uFF09\u3002\u73B0\u5728\u6211\u4EEC\u53EA\u9700\u8981\u5C06\u8FD9\u4E24\u4E2A\u6807\u8BB0\u8DE8\u5EA6\u6620\u5C04\u5230\u4E0A\u4E0B\u6587\u4E2D\u7684\u5B57\u7B26\u8DE8\u5EA6\uFF08\u6211\u4EEC\u53EA\u9700\u8981\u6620\u5C04\u7B2C\u4E8C\u4E2A\u6807\u8BB0\u4EE5\u83B7\u5F97\u6211\u4EEC\u7684\u7B54\u6848\uFF0C\u4F46\u770B\u770B\u6A21\u578B\u5728\u7B2C\u4E00\u4E2A\u5757\u4E2D\u9009\u62E9\u4E86\u4EC0\u4E48\u5F88\u6709\u8DA3\uFF09\u3002"),La=u(),b(Cs.$$.fragment),Ga=u(),Rs=p("p"),ii=o("\u8FD9 "),_n=p("strong"),li=o("offsets"),mi=o(" \u6211\u4EEC\u4E4B\u524D\u6293\u53D6\u7684\u5B9E\u9645\u4E0A\u662F\u4E00\u4E2A\u504F\u79FB\u91CF\u5217\u8868\uFF0C\u6BCF\u4E2A\u6587\u672C\u5757\u6709\u4E00\u4E2A\u5217\u8868\uFF1A"),Ca=u(),b(jt.$$.fragment),Ra=u(),b(yt.$$.fragment),Oa=u(),ge=p("p"),pi=o("\u5982\u679C\u6211\u4EEC\u5FFD\u7565\u7B2C\u4E00\u4E2A\u7ED3\u679C\uFF0C\u6211\u4EEC\u4F1A\u5F97\u5230\u4E0E\u8FD9\u4E2A\u957F\u4E0A\u4E0B\u6587\u7684\u7BA1\u9053\u76F8\u540C\u7684\u7ED3\u679C\u2014\u2014\u662F\u7684\uFF01"),Fa=u(),b(Os.$$.fragment),Ma=u(),$e=p("p"),fi=o("\u6211\u4EEC\u5BF9\u5206\u8BCD\u5668\u529F\u80FD\u7684\u6DF1\u5165\u7814\u7A76\u5230\u6B64\u7ED3\u675F\u3002\u6211\u4EEC\u5C06\u5728\u4E0B\u4E00\u7AE0\u518D\u6B21\u5C06\u6240\u6709\u8FD9\u4E9B\u4ED8\u8BF8\u5B9E\u8DF5\uFF0C\u5C4A\u65F6\u6211\u4EEC\u5C06\u5411\u60A8\u5C55\u793A\u5982\u4F55\u5728\u4E00\u7CFB\u5217\u5E38\u89C1\u7684 NLP \u4EFB\u52A1\u4E0A\u5FAE\u8C03\u6A21\u578B\u3002"),this.h()},l(s){const r=Yl('[data-svelte="svelte-1phssyn"]',document.head);n=f(r,"META",{name:!0,content:!0}),r.forEach(e),m=_(s),k(t.$$.fragment,s),g=_(s),$=f(s,"H1",{class:!0});var Ot=c($);j=f(Ot,"A",{id:!0,class:!0,href:!0});var be=c(j);q=f(be,"SPAN",{});var ke=c(q);k(S.$$.fragment,ke),ke.forEach(e),be.forEach(e),A=_(Ot),O=f(Ot,"SPAN",{});var we=c(O);W=i(we,"QA \u7BA1\u9053\u4E2D\u7684\u5FEB\u901F\u6807\u8BB0\u5668"),we.forEach(e),Ot.forEach(e),G=_(s),z.l(s),T=_(s),E=f(s,"P",{});var Fs=c(E);vs=i(Fs,"\u6211\u4EEC\u73B0\u5728\u5C06\u6DF1\u5165\u7814\u7A76 "),Q=f(Fs,"STRONG",{});var xe=c(Q);js=i(xe,"question-answering"),xe.forEach(e),Va=i(Fs," \u7BA1\u9053\uFF0C\u770B\u770B\u5982\u4F55\u5229\u7528\u504F\u79FB\u91CF\u4ECE\u4E0A\u4E0B\u6587\u4E2D\u83B7\u53D6\u624B\u5934\u95EE\u9898\u7684\u7B54\u6848\uFF0C\u6709\u70B9\u50CF\u6211\u4EEC\u5728\u4E0A\u4E00\u8282\u4E2D\u5BF9\u5206\u7EC4\u5B9E\u4F53\u6240\u505A\u7684\u3002\u7136\u540E\u6211\u4EEC\u5C06\u770B\u5230\u6211\u4EEC\u5982\u4F55\u5904\u7406\u6700\u7EC8\u88AB\u622A\u65AD\u7684\u975E\u5E38\u957F\u7684\u4E0A\u4E0B\u6587\u3002\u5982\u679C\u60A8\u5BF9\u95EE\u7B54\u4EFB\u52A1\u4E0D\u611F\u5174\u8DA3\uFF0C\u53EF\u4EE5\u8DF3\u8FC7\u6B64\u90E8\u5206\u3002"),Fs.forEach(e),$n=_(s),K.l(s),Mt=_(s),ys=f(s,"H2",{class:!0});var Ms=c(ys);Ts=f(Ms,"A",{id:!0,class:!0,href:!0});var ve=c(Ts);Ne=f(ve,"SPAN",{});var hn=c(Ne);k(Ws.$$.fragment,hn),hn.forEach(e),ve.forEach(e),Xa=_(Ms),Qs=f(Ms,"SPAN",{});var Ft=c(Qs);Za=i(Ft,"\u4F7F\u7528 "),ze=f(Ft,"CODE",{});var je=c(ze);sr=i(je,"question-answering"),je.forEach(e),tr=i(Ft," \u7BA1\u9053"),Ft.forEach(e),Ms.forEach(e),bn=_(s),ds=f(s,"P",{});var ks=c(ds);er=i(ks,"\u6B63\u5982\u6211\u4EEC\u5728"),It=f(ks,"A",{href:!0});var ye=c(It);nr=i(ye,"Chapter 1"),ye.forEach(e),ar=i(ks,"\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528 "),Ae=f(ks,"STRONG",{});var qe=c(Ae);rr=i(qe,"question-answering"),qe.forEach(e),or=i(ks," \u50CF\u8FD9\u6837\u7684\u7BA1\u9053\u4EE5\u83B7\u5F97\u95EE\u9898\u7684\u7B54\u6848\uFF1A"),ks.forEach(e),kn=_(s),k(Hs.$$.fragment,s),wn=_(s),k(Ks.$$.fragment,s),xn=_(s),Ut=f(s,"P",{});var Te=c(Ut);ir=i(Te,"\u4E0E\u5176\u4ED6\u7BA1\u9053\u4E0D\u540C\uFF0C\u5B83\u4E0D\u80FD\u622A\u65AD\u548C\u62C6\u5206\u957F\u4E8E\u6A21\u578B\u63A5\u53D7\u7684\u6700\u5927\u957F\u5EA6\u7684\u6587\u672C\uFF08\u56E0\u6B64\u53EF\u80FD\u4F1A\u4E22\u5931\u6587\u6863\u672B\u5C3E\u7684\u4FE1\u606F\uFF09\uFF0C\u6B64\u7BA1\u9053\u53EF\u4EE5\u5904\u7406\u975E\u5E38\u957F\u7684\u4E0A\u4E0B\u6587\uFF0C\u5E76\u5C06\u8FD4\u56DE\u56DE\u7B54\u8FD9\u4E2A\u95EE\u9898\uFF0C\u5373\u4F7F\u5B83\u5728\u6700\u540E\uFF1A"),Te.forEach(e),vn=_(s),k(Bs.$$.fragment,s),jn=_(s),k(Ys.$$.fragment,s),yn=_(s),Dt=f(s,"P",{});var dn=c(Dt);lr=i(dn,"\u8BA9\u6211\u4EEC\u770B\u770B\u5B83\u662F\u5982\u4F55\u505A\u5230\u8FD9\u4E00\u5207\u7684\uFF01"),dn.forEach(e),qn=_(s),Vs=f(s,"H2",{id:!0});var gn=c(Vs);mr=i(gn,"\u4F7F\u7528\u6A21\u578B\u8FDB\u884C\u95EE\u7B54"),gn.forEach(e),Tn=_(s),F=f(s,"P",{});var Is=c(F);pr=i(Is,"\u4E0E\u4EFB\u4F55\u5176\u4ED6\u7BA1\u9053\u4E00\u6837\uFF0C\u6211\u4EEC\u9996\u5148\u5BF9\u8F93\u5165\u8FDB\u884C\u6807\u8BB0\u5316\uFF0C\u7136\u540E\u901A\u8FC7\u6A21\u578B\u5C06\u5176\u53D1\u9001\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u7528\u4E8E\u7684\u68C0\u67E5\u70B9 "),Le=f(Is,"STRONG",{});var Oi=c(Le);fr=i(Oi,"question-answering"),Oi.forEach(e),cr=i(Is," \u7BA1\u9053\u662F"),Xs=f(Is,"A",{href:!0,rel:!0});var Fi=c(Xs);ur=i(Fi,"distilbert-base-cased-distilled-squad"),Fi.forEach(e),_r=i(Is,"\uFF08\u540D\u79F0\u4E2D\u7684\u201Csquad\u201D\u6765\u81EA\u6A21\u578B\u5FAE\u8C03\u7684\u6570\u636E\u96C6\uFF1B\u6211\u4EEC\u5C06\u5728"),Jt=f(Is,"A",{href:!0});var Mi=c(Jt);hr=i(Mi,"Chapter 7"),Mi.forEach(e),dr=i(Is,"):"),Is.forEach(e),En=_(s),Y.l(s),Wt=_(s),Qt=f(s,"P",{});var Ii=c(Qt);gr=i(Ii,"\u8BF7\u6CE8\u610F\uFF0C\u6211\u4EEC\u5C06\u95EE\u9898\u548C\u4E0A\u4E0B\u6587\u6807\u8BB0\u4E3A\u4E00\u5BF9\uFF0C\u9996\u5148\u662F\u95EE\u9898"),Ii.forEach(e),Sn=_(s),qs=f(s,"DIV",{class:!0});var Ua=c(qs);Zs=f(Ua,"IMG",{class:!0,src:!0,alt:!0}),$r=_(Ua),st=f(Ua,"IMG",{class:!0,src:!0,alt:!0}),Ua.forEach(e),Pn=_(s),Ht=f(s,"P",{});var Ui=c(Ht);br=i(Ui,"\u95EE\u7B54\u6A21\u578B\u7684\u5DE5\u4F5C\u65B9\u5F0F\u4E0E\u6211\u4EEC\u8FC4\u4ECA\u4E3A\u6B62\u770B\u5230\u7684\u6A21\u578B\u7565\u6709\u4E0D\u540C\u3002\u4EE5\u4E0A\u56FE\u4E3A\u4F8B\uFF0C\u8BE5\u6A21\u578B\u5DF2\u7ECF\u8FC7\u8BAD\u7EC3\uFF0C\u53EF\u4EE5\u9884\u6D4B\u7B54\u6848\u5F00\u59CB\u7684\u6807\u8BB0\u7684\u7D22\u5F15\uFF08\u6B64\u5904\u4E3A 21\uFF09\u548C\u7B54\u6848\u7ED3\u675F\u5904\u7684\u6807\u8BB0\u7684\u7D22\u5F15\uFF08\u6B64\u5904\u4E3A 24\uFF09\u3002\u8FD9\u5C31\u662F\u4E3A\u4EC0\u4E48\u8FD9\u4E9B\u6A21\u578B\u4E0D\u8FD4\u56DE\u4E00\u4E2A logits \u7684\u5F20\u91CF\uFF0C\u800C\u662F\u8FD4\u56DE\u4E24\u4E2A\uFF1A\u4E00\u4E2A\u7528\u4E8E\u5BF9\u5E94\u4E8E\u7B54\u6848\u7684\u5F00\u59CB\u6807\u8BB0\u7684 logits\uFF0C\u53E6\u4E00\u4E2A\u7528\u4E8E\u5BF9\u5E94\u4E8E\u7B54\u6848\u7684\u7ED3\u675F\u6807\u8BB0\u7684 logits\u3002\u7531\u4E8E\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\u6211\u4EEC\u53EA\u6709\u4E00\u4E2A\u5305\u542B 66 \u4E2A\u6807\u8BB0\u7684\u8F93\u5165\uFF0C\u6211\u4EEC\u5F97\u5230\uFF1A"),Ui.forEach(e),Nn=_(s),k(tt.$$.fragment,s),zn=_(s),X.l(s),Kt=_(s),M=f(s,"P",{});var Us=c(M);kr=i(Us,"\u4E3A\u4E86\u5C06\u8FD9\u4E9B logits \u8F6C\u6362\u4E3A\u6982\u7387\uFF0C\u6211\u4EEC\u5C06\u5E94\u7528\u4E00\u4E2A softmax \u51FD\u6570\u2014\u2014\u4F46\u5728\u6B64\u4E4B\u524D\uFF0C\u6211\u4EEC\u9700\u8981\u786E\u4FDD\u6211\u4EEC\u5C4F\u853D\u4E86\u4E0D\u5C5E\u4E8E\u4E0A\u4E0B\u6587\u7684\u7D22\u5F15\u3002\u6211\u4EEC\u7684\u8F93\u5165\u662F "),Ge=f(Us,"STRONG",{});var Di=c(Ge);wr=i(Di,"[CLS] question [SEP] context [SEP]"),Di.forEach(e),xr=i(Us," \uFF0C\u6240\u4EE5\u6211\u4EEC\u9700\u8981\u5C4F\u853D\u95EE\u9898\u7684\u6807\u8BB0\u4EE5\u53CA "),Ce=f(Us,"STRONG",{});var Ji=c(Ce);vr=i(Ji,"[SEP]"),Ji.forEach(e),jr=i(Us," \u4EE4\u724C\u3002\u6211\u4EEC\u5C06\u4FDD\u7559 "),Re=f(Us,"STRONG",{});var Wi=c(Re);yr=i(Wi,"[CLS]"),Wi.forEach(e),qr=i(Us," \u7136\u800C\uFF0C\u56E0\u4E3A\u67D0\u4E9B\u6A21\u578B\u4F7F\u7528\u5B83\u6765\u8868\u793A\u7B54\u6848\u4E0D\u5728\u4E0A\u4E0B\u6587\u4E2D\u3002"),Us.forEach(e),An=_(s),Es=f(s,"P",{});var Da=c(Es);Tr=i(Da,"\u7531\u4E8E\u6211\u4EEC\u5C06\u5728\u4E4B\u540E\u5E94\u7528 softmax\uFF0C\u6211\u4EEC\u53EA\u9700\u8981\u7528\u4E00\u4E2A\u5927\u7684\u8D1F\u6570\u66FF\u6362\u6211\u4EEC\u60F3\u8981\u5C4F\u853D\u7684 logits\u3002\u5728\u8FD9\u91CC\uFF0C\u6211\u4EEC\u4F7F\u7528 "),Oe=f(Da,"STRONG",{});var Qi=c(Oe);Er=i(Qi,"-10000"),Qi.forEach(e),Sr=i(Da," \uFF1A"),Da.forEach(e),Ln=_(s),ss.l(s),Bt=_(s),Yt=f(s,"P",{});var Hi=c(Yt);Pr=i(Hi,"\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u6B63\u786E\u5C4F\u853D\u4E86\u4E0E\u6211\u4EEC\u4E0D\u60F3\u9884\u6D4B\u7684\u4F4D\u7F6E\u76F8\u5BF9\u5E94\u7684 logits\uFF0C\u6211\u4EEC\u53EF\u4EE5\u5E94\u7528 softmax\uFF1A"),Hi.forEach(e),Gn=_(s),es.l(s),Vt=_(s),C=f(s,"P",{});var ws=c(C);Nr=i(ws,"\u5728\u8FD9\u4E2A\u9636\u6BB5\uFF0C\u6211\u4EEC\u53EF\u4EE5\u91C7\u7528\u5F00\u59CB\u548C\u7ED3\u675F\u6982\u7387\u7684 argmax\u2014\u2014\u4F46\u6211\u4EEC\u6700\u7EC8\u53EF\u80FD\u4F1A\u5F97\u5230\u4E00\u4E2A\u5927\u4E8E\u7ED3\u675F\u7D22\u5F15\u7684\u5F00\u59CB\u7D22\u5F15\uFF0C\u6240\u4EE5\u6211\u4EEC\u9700\u8981\u91C7\u53D6\u66F4\u591A\u7684\u9884\u9632\u63AA\u65BD\u3002\u6211\u4EEC\u5C06\u8BA1\u7B97\u6BCF\u4E2A\u53EF\u80FD\u7684\u6982\u7387 "),Fe=f(ws,"STRONG",{});var Ki=c(Fe);zr=i(Ki,"start_index"),Ki.forEach(e),Ar=i(ws," \u548C "),Me=f(ws,"STRONG",{});var Bi=c(Me);Lr=i(Bi,"end_index"),Bi.forEach(e),Gr=i(ws," \u5728\u54EA\u91CC "),Ie=f(ws,"STRONG",{});var Yi=c(Ie);Cr=i(Yi,"start_index <= end_index"),Yi.forEach(e),Rr=i(ws," \uFF0C\u7136\u540E\u53D6\u5143\u7EC4 "),Ue=f(ws,"STRONG",{});var Vi=c(Ue);Or=i(Vi,"(start_index, end_index)"),Vi.forEach(e),Fr=i(ws," \u4EE5\u6700\u9AD8\u7684\u6982\u7387\u3002"),ws.forEach(e),Cn=_(s),L=f(s,"P",{});var hs=c(L);Mr=i(hs,"\u5047\u8BBE\u4E8B\u4EF6\u201C\u7B54\u6848\u5F00\u59CB\u4E8E "),De=f(hs,"STRONG",{});var Xi=c(De);Ir=i(Xi,"start_index"),Xi.forEach(e),Ur=i(hs," \u201D\u548C\u201C\u7B54\u6848\u7ED3\u675F\u4E8E "),Je=f(hs,"STRONG",{});var Zi=c(Je);Dr=i(Zi,"end_index"),Zi.forEach(e),Jr=i(hs," \u201D \u8981\u72EC\u7ACB\uFF0C\u7B54\u6848\u5F00\u59CB\u4E8E\u7684\u6982\u7387 "),We=f(hs,"STRONG",{});var sl=c(We);Wr=i(sl,"start_index"),sl.forEach(e),Qr=i(hs," \u5E76\u7ED3\u675F\u4E8E "),Qe=f(hs,"STRONG",{});var tl=c(Qe);Hr=i(tl,"end_index"),tl.forEach(e),Kr=i(hs,` \u662F\uFF1A
`),Rn=Ml(hs),hs.forEach(e),On=_(s),gs=f(s,"P",{});var Ee=c(gs);Br=i(Ee,"\u6240\u4EE5\uFF0C\u8981\u8BA1\u7B97\u6240\u6709\u7684\u5206\u6570\uFF0C\u6211\u4EEC\u53EA\u9700\u8981\u8BA1\u7B97\u6240\u6709\u7684\u4EA7\u54C1 "),Fn=Ml(Ee),Mn=i(Ee," where "),He=f(Ee,"CODE",{});var el=c(He);Yr=i(el,"start_index <= end_index"),el.forEach(e),Vr=i(Ee,"."),Ee.forEach(e),In=_(s),Xt=f(s,"P",{});var nl=c(Xt);Xr=i(nl,"\u9996\u5148\u8BA9\u6211\u4EEC\u8BA1\u7B97\u6240\u6709\u53EF\u80FD\u7684\u4EA7\u54C1\uFF1A"),nl.forEach(e),Un=_(s),k(et.$$.fragment,s),Dn=_(s),as.l(s),Zt=_(s),R=f(s,"P",{});var xs=c(R);Zr=i(xs,"\u73B0\u5728\u6211\u4EEC\u53EA\u9700\u8981\u5F97\u5230\u6700\u5927\u503C\u7684\u7D22\u5F15\u3002\u7531\u4E8E PyTorch \u5C06\u8FD4\u56DE\u5C55\u5E73\u5F20\u91CF\u4E2D\u7684\u7D22\u5F15\uFF0C\u56E0\u6B64\u6211\u4EEC\u9700\u8981\u4F7F\u7528\u5730\u677F\u9664\u6CD5 "),Ke=f(xs,"STRONG",{});var al=c(Ke);so=i(al,"//"),al.forEach(e),to=i(xs," \u548C\u6A21\u6570 "),Be=f(xs,"STRONG",{});var rl=c(Be);eo=i(rl,"%"),rl.forEach(e),no=i(xs," \u64CD\u4F5C\u4EE5\u83B7\u5F97 "),Ye=f(xs,"STRONG",{});var ol=c(Ye);ao=i(ol,"start_index"),ol.forEach(e),ro=i(xs," \u548C "),Ve=f(xs,"STRONG",{});var il=c(Ve);oo=i(il,"end_index"),il.forEach(e),io=i(xs," \uFF1A"),xs.forEach(e),Jn=_(s),k(nt.$$.fragment,s),Wn=_(s),se=f(s,"P",{});var ll=c(se);lo=i(ll,"\u6211\u4EEC\u8FD8\u6CA1\u6709\u5B8C\u5168\u5B8C\u6210\uFF0C\u4F46\u81F3\u5C11\u6211\u4EEC\u5DF2\u7ECF\u6709\u4E86\u6B63\u786E\u7684\u7B54\u6848\u5206\u6570\uFF08\u60A8\u53EF\u4EE5\u901A\u8FC7\u5C06\u5176\u4E0E\u4E0A\u4E00\u8282\u4E2D\u7684\u7B2C\u4E00\u4E2A\u7ED3\u679C\u8FDB\u884C\u6BD4\u8F83\u6765\u68C0\u67E5\u8FD9\u4E00\u70B9\uFF09\uFF1A"),ll.forEach(e),Qn=_(s),k(at.$$.fragment,s),Hn=_(s),k(Ss.$$.fragment,s),Kn=_(s),$s=f(s,"P",{});var Se=c($s);mo=i(Se,"\u6211\u4EEC\u6709 "),Xe=f(Se,"STRONG",{});var ml=c(Xe);po=i(ml,"start_index"),ml.forEach(e),fo=i(Se," \u548C "),Ze=f(Se,"STRONG",{});var pl=c(Ze);co=i(pl,"end_index"),pl.forEach(e),uo=i(Se," \u5C31\u6807\u8BB0\u800C\u8A00\u7684\u7B54\u6848\uFF0C\u6240\u4EE5\u73B0\u5728\u6211\u4EEC\u53EA\u9700\u8981\u8F6C\u6362\u4E3A\u4E0A\u4E0B\u6587\u4E2D\u7684\u5B57\u7B26\u7D22\u5F15\u3002\u8FD9\u662F\u504F\u79FB\u91CF\u975E\u5E38\u6709\u7528\u7684\u5730\u65B9\u3002\u6211\u4EEC\u53EF\u4EE5\u50CF\u5728\u4EE4\u724C\u5206\u7C7B\u4EFB\u52A1\u4E2D\u4E00\u6837\u6293\u4F4F\u5B83\u4EEC\u5E76\u4F7F\u7528\u5B83\u4EEC\uFF1A"),Se.forEach(e),Bn=_(s),k(rt.$$.fragment,s),Yn=_(s),te=f(s,"P",{});var fl=c(te);_o=i(fl,"\u73B0\u5728\u6211\u4EEC\u53EA\u9700\u8981\u683C\u5F0F\u5316\u6240\u6709\u5185\u5BB9\u4EE5\u83B7\u5F97\u6211\u4EEC\u7684\u7ED3\u679C\uFF1A"),fl.forEach(e),Vn=_(s),k(ot.$$.fragment,s),Xn=_(s),k(it.$$.fragment,s),Zn=_(s),ee=f(s,"P",{});var cl=c(ee);ho=i(cl,"\u592A\u68D2\u4E86\uFF01\u8FD9\u548C\u6211\u4EEC\u7684\u7B2C\u4E00\u4E2A\u4F8B\u5B50\u4E00\u6837\uFF01"),cl.forEach(e),sa=_(s),k(Ps.$$.fragment,s),ta=_(s),lt=f(s,"H2",{id:!0});var ul=c(lt);go=i(ul,"\u5904\u7406\u957F\u4E0A\u4E0B\u6587"),ul.forEach(e),ea=_(s),Ns=f(s,"P",{});var Ja=c(Ns);$o=i(Ja,"\u5982\u679C\u6211\u4EEC\u5C1D\u8BD5\u5BF9\u6211\u4EEC\u4E4B\u524D\u4F5C\u4E3A\u793A\u4F8B\u4F7F\u7528\u7684\u95EE\u9898\u548C\u957F\u4E0A\u4E0B\u6587\u8FDB\u884C\u6807\u8BB0\u5316\uFF0C\u6211\u4EEC\u5C06\u83B7\u5F97\u6BD4\u5728 "),sn=f(Ja,"STRONG",{});var _l=c(sn);bo=i(_l,"question-answering"),_l.forEach(e),ko=i(Ja," \u7BA1\u9053\uFF08\u5373 384\uFF09\uFF1A"),Ja.forEach(e),na=_(s),k(mt.$$.fragment,s),aa=_(s),k(pt.$$.fragment,s),ra=_(s),zs=f(s,"P",{});var Wa=c(zs);wo=i(Wa,"\u56E0\u6B64\uFF0C\u6211\u4EEC\u9700\u8981\u5728\u6700\u5927\u957F\u5EA6\u5904\u622A\u65AD\u6211\u4EEC\u7684\u8F93\u5165\u3002\u6709\u51E0\u79CD\u65B9\u6CD5\u53EF\u4EE5\u505A\u5230\u8FD9\u4E00\u70B9\uFF0C\u4F46\u6211\u4EEC\u4E0D\u60F3\u622A\u65AD\u95EE\u9898\uFF0C\u53EA\u60F3\u622A\u65AD\u4E0A\u4E0B\u6587\u3002\u7531\u4E8E\u4E0A\u4E0B\u6587\u662F\u7B2C\u4E8C\u4E2A\u53E5\u5B50\uFF0C\u6211\u4EEC\u5C06\u4F7F\u7528 "),tn=f(Wa,"STRONG",{});var hl=c(tn);xo=i(hl,"\u201Conly_second\u201D"),hl.forEach(e),vo=i(Wa," \u622A\u65AD\u7B56\u7565\u3002\u90A3\u4E48\u51FA\u73B0\u7684\u95EE\u9898\u662F\u95EE\u9898\u7684\u7B54\u6848\u53EF\u80FD\u4E0D\u5728\u622A\u65AD\u4E0A\u4E0B\u6587\u4E2D\u3002\u4F8B\u5982\uFF0C\u5728\u8FD9\u91CC\uFF0C\u6211\u4EEC\u9009\u62E9\u4E86\u4E00\u4E2A\u7B54\u6848\u5728\u4E0A\u4E0B\u6587\u672B\u5C3E\u7684\u95EE\u9898\uFF0C\u5F53\u6211\u4EEC\u622A\u65AD\u5B83\u65F6\uFF0C\u7B54\u6848\u4E0D\u5B58\u5728"),Wa.forEach(e),oa=_(s),k(ft.$$.fragment,s),ia=_(s),k(ct.$$.fragment,s),la=_(s),As=f(s,"P",{});var Qa=c(As);jo=i(Qa,"\u8FD9\u610F\u5473\u7740\u6A21\u578B\u5C06\u5F88\u96BE\u9009\u62E9\u6B63\u786E\u7684\u7B54\u6848\u3002\u4E3A\u4E86\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\uFF0C "),en=f(Qa,"STRONG",{});var dl=c(en);yo=i(dl,"question-answering"),dl.forEach(e),qo=i(Qa," \u7BA1\u9053\u5141\u8BB8\u6211\u4EEC\u5C06\u4E0A\u4E0B\u6587\u5206\u6210\u66F4\u5C0F\u7684\u5757\uFF0C\u6307\u5B9A\u6700\u5927\u957F\u5EA6\u3002\u4E3A\u786E\u4FDD\u6211\u4EEC\u4E0D\u4F1A\u5728\u5B8C\u5168\u9519\u8BEF\u7684\u4F4D\u7F6E\u62C6\u5206\u4E0A\u4E0B\u6587\u4EE5\u627E\u5230\u7B54\u6848\uFF0C\u5B83\u8FD8\u5305\u62EC\u5757\u4E4B\u95F4\u7684\u4E00\u4E9B\u91CD\u53E0\u3002"),Qa.forEach(e),ma=_(s),bs=f(s,"P",{});var Pe=c(bs);To=i(Pe,"\u6211\u4EEC\u53EF\u4EE5\u8BA9\u5206\u8BCD\u5668\uFF08\u5FEB\u6216\u6162\uFF09\u901A\u8FC7\u6DFB\u52A0\u6765\u4E3A\u6211\u4EEC\u505A\u8FD9\u4EF6\u4E8B "),nn=f(Pe,"STRONG",{});var gl=c(nn);Eo=i(gl,"return_overflowing_tokens=True"),gl.forEach(e),So=i(Pe," \uFF0C\u6211\u4EEC\u53EF\u4EE5\u6307\u5B9A\u6211\u4EEC\u60F3\u8981\u7684\u91CD\u53E0 "),an=f(Pe,"STRONG",{});var $l=c(an);Po=i($l,"stride"),$l.forEach(e),No=i(Pe," \u4E89\u8BBA\u3002\u8FD9\u662F\u4E00\u4E2A\u4F7F\u7528\u8F83\u5C0F\u53E5\u5B50\u7684\u793A\u4F8B\uFF1A"),Pe.forEach(e),pa=_(s),k(ut.$$.fragment,s),fa=_(s),k(_t.$$.fragment,s),ca=_(s),Ls=f(s,"P",{});var Ha=c(Ls);zo=i(Ha,"\u6B63\u5982\u6211\u4EEC\u6240\u770B\u5230\u7684\uFF0C\u53E5\u5B50\u5DF2\u88AB\u5206\u6210\u591A\u4E2A\u5757\uFF0C\u4F7F\u5F97\u6BCF\u4E2A\u6761\u76EE "),rn=f(Ha,"STRONG",{});var bl=c(rn);Ao=i(bl,"inputs[\u201Cinput_ids\u201D]"),bl.forEach(e),Lo=i(Ha," \u6700\u591A\u6709 6 \u4E2A\u6807\u8BB0\uFF08\u6211\u4EEC\u9700\u8981\u6DFB\u52A0\u586B\u5145\u4EE5\u4F7F\u6700\u540E\u4E00\u4E2A\u6761\u76EE\u4E0E\u5176\u4ED6\u6761\u76EE\u7684\u5927\u5C0F\u76F8\u540C\uFF09\u5E76\u4E14\u6BCF\u4E2A\u6761\u76EE\u4E4B\u95F4\u6709 2 \u4E2A\u6807\u8BB0\u7684\u91CD\u53E0\u3002"),Ha.forEach(e),ua=_(s),ne=f(s,"P",{});var kl=c(ne);Go=i(kl,"\u8BA9\u6211\u4EEC\u4ED4\u7EC6\u770B\u770B\u6807\u8BB0\u5316\u7684\u7ED3\u679C\uFF1A"),kl.forEach(e),_a=_(s),k(ht.$$.fragment,s),ha=_(s),k(dt.$$.fragment,s),da=_(s),Gs=f(s,"P",{});var Ka=c(Gs);Co=i(Ka,"\u6B63\u5982\u9884\u671F\u7684\u90A3\u6837\uFF0C\u6211\u4EEC\u5F97\u5230\u4E86\u8F93\u5165 ID \u548C\u4E00\u4E2A\u6CE8\u610F\u529B\u63A9\u7801\u3002\u6700\u540E\u4E00\u4E2A\u952E\uFF0C "),on=f(Ka,"STRONG",{});var wl=c(on);Ro=i(wl,"overflow_to_sample_mapping"),wl.forEach(e),Oo=i(Ka," , \u662F\u4E00\u4E2A\u6620\u5C04\uFF0C\u5B83\u544A\u8BC9\u6211\u4EEC\u6BCF\u4E2A\u7ED3\u679C\u5BF9\u5E94\u54EA\u4E2A\u53E5\u5B50\u2014\u2014\u8FD9\u91CC\u6211\u4EEC\u6709 7 \u4E2A\u7ED3\u679C\uFF0C\u5B83\u4EEC\u90FD\u6765\u81EA\u6211\u4EEC\u901A\u8FC7\u6807\u8BB0\u5668\u7684\uFF08\u552F\u4E00\uFF09\u53E5\u5B50\uFF1A"),Ka.forEach(e),ga=_(s),k(gt.$$.fragment,s),$a=_(s),k($t.$$.fragment,s),ba=_(s),ae=f(s,"P",{});var xl=c(ae);Fo=i(xl,"\u5F53\u6211\u4EEC\u5C06\u51E0\u4E2A\u53E5\u5B50\u6807\u8BB0\u5728\u4E00\u8D77\u65F6\uFF0C\u8FD9\u66F4\u6709\u7528\u3002\u4F8B\u5982\uFF0C\u8FD9\u4E2A\uFF1A"),xl.forEach(e),ka=_(s),k(bt.$$.fragment,s),wa=_(s),re=f(s,"P",{});var vl=c(re);Mo=i(vl,"\u8BA9\u6211\u4EEC\uFF1A"),vl.forEach(e),xa=_(s),k(kt.$$.fragment,s),va=_(s),oe=f(s,"P",{});var jl=c(oe);Io=i(jl,"\u8FD9\u610F\u5473\u7740\u7B2C\u4E00\u4E2A\u53E5\u5B50\u50CF\u4EE5\u524D\u4E00\u6837\u5206\u6210 7 \u4E2A\u5757\uFF0C\u63A5\u4E0B\u6765\u7684 4 \u4E2A\u5757\u6765\u81EA\u7B2C\u4E8C\u4E2A\u53E5\u5B50\u3002"),jl.forEach(e),ja=_(s),I=f(s,"P",{});var Ds=c(I);Uo=i(Ds,"\u73B0\u5728\u8BA9\u6211\u4EEC\u56DE\u5230\u6211\u4EEC\u7684\u957F\u671F\u80CC\u666F\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B "),ln=f(Ds,"STRONG",{});var yl=c(ln);Do=i(yl,"question-answering"),yl.forEach(e),Jo=i(Ds," \u7BA1\u9053\u4F7F\u7528\u7684\u6700\u5927\u957F\u5EA6\u4E3A 384\uFF0C\u6B63\u5982\u6211\u4EEC\u4E4B\u524D\u63D0\u5230\u7684\uFF0C\u6B65\u957F\u4E3A 128\uFF0C\u8FD9\u5BF9\u5E94\u4E8E\u6A21\u578B\u5FAE\u8C03\u7684\u65B9\u5F0F\uFF08\u60A8\u53EF\u4EE5\u901A\u8FC7\u4F20\u9012 "),mn=f(Ds,"STRONG",{});var ql=c(mn);Wo=i(ql,"max_seq_len"),ql.forEach(e),Qo=i(Ds," \u548C "),pn=f(Ds,"STRONG",{});var Tl=c(pn);Ho=i(Tl,"stride"),Tl.forEach(e),Ko=i(Ds," \u8C03\u7528\u7BA1\u9053\u65F6\u7684\u53C2\u6570\uFF09\u3002\u56E0\u6B64\uFF0C\u6211\u4EEC\u5C06\u5728\u6807\u8BB0\u5316\u65F6\u4F7F\u7528\u8FD9\u4E9B\u53C2\u6570\u3002\u6211\u4EEC\u8FD8\u5C06\u6DFB\u52A0\u586B\u5145\uFF08\u5177\u6709\u76F8\u540C\u957F\u5EA6\u7684\u6837\u672C\uFF0C\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u6784\u5EFA\u5F20\u91CF\uFF09\u4EE5\u53CA\u8BF7\u6C42\u504F\u79FB\u91CF\uFF1A"),Ds.forEach(e),ya=_(s),k(wt.$$.fragment,s),qa=_(s),U=f(s,"P",{});var Js=c(U);Bo=i(Js,"\u90A3\u4E9B "),fn=f(Js,"STRONG",{});var El=c(fn);Yo=i(El,"inputs"),El.forEach(e),Vo=i(Js," \u5C06\u5305\u542B\u6A21\u578B\u671F\u671B\u7684\u8F93\u5165 ID \u548C\u6CE8\u610F\u529B\u63A9\u7801\uFF0C\u4EE5\u53CA\u504F\u79FB\u91CF\u548C "),cn=f(Js,"STRONG",{});var Sl=c(cn);Xo=i(Sl,"overflow_to_sample_mapping"),Sl.forEach(e),Zo=i(Js," \u6211\u4EEC\u521A\u521A\u8C08\u5230\u3002\u7531\u4E8E\u8FD9\u4E24\u4E2A\u4E0D\u662F\u6A21\u578B\u4F7F\u7528\u7684\u53C2\u6570\uFF0C\u6211\u4EEC\u5C06\u628A\u5B83\u4EEC\u4ECE "),un=f(Js,"STRONG",{});var Pl=c(un);si=i(Pl,"inputs"),Pl.forEach(e),ti=i(Js," \uFF08\u6211\u4EEC\u4E0D\u4F1A\u5B58\u50A8\u5730\u56FE\uFF0C\u56E0\u4E3A\u5B83\u5728\u8FD9\u91CC\u6CA1\u6709\u7528\uFF09\u5728\u5C06\u5176\u8F6C\u6362\u4E3A\u5F20\u91CF\u4E4B\u524D\uFF1A"),Js.forEach(e),Ta=_(s),os.l(s),ie=_(s),le=f(s,"P",{});var Nl=c(le);ei=i(Nl,"\u6211\u4EEC\u7684\u957F\u4E0A\u4E0B\u6587\u88AB\u5206\u6210\u4E24\u90E8\u5206\uFF0C\u8FD9\u610F\u5473\u7740\u5728\u5B83\u901A\u8FC7\u6211\u4EEC\u7684\u6A21\u578B\u540E\uFF0C\u6211\u4EEC\u5C06\u6709\u4E24\u7EC4\u5F00\u59CB\u548C\u7ED3\u675F logits\uFF1A"),Nl.forEach(e),Ea=_(s),k(xt.$$.fragment,s),Sa=_(s),ls.l(s),me=_(s),pe=f(s,"P",{});var zl=c(pe);ni=i(zl,"\u548C\u4EE5\u524D\u4E00\u6837\uFF0C\u6211\u4EEC\u5728\u91C7\u7528 softmax \u4E4B\u524D\u9996\u5148\u5C4F\u853D\u4E0D\u5C5E\u4E8E\u4E0A\u4E0B\u6587\u7684\u6807\u8BB0\u3002\u6211\u4EEC\u8FD8\u5C4F\u853D\u4E86\u6240\u6709\u586B\u5145\u6807\u8BB0\uFF08\u7531\u6CE8\u610F\u63A9\u7801\u6807\u8BB0\uFF09\uFF1A"),zl.forEach(e),Pa=_(s),ps.l(s),fe=_(s),ce=f(s,"P",{});var Al=c(ce);ai=i(Al,"\u7136\u540E\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528 softmax \u5C06\u6211\u4EEC\u7684 logits \u8F6C\u6362\u4E3A\u6982\u7387\uFF1A"),Al.forEach(e),Na=_(s),cs.l(s),ue=_(s),_e=f(s,"P",{});var Ll=c(_e);ri=i(Ll,"\u4E0B\u4E00\u6B65\u4E0E\u6211\u4EEC\u5BF9\u5C0F\u4E0A\u4E0B\u6587\u6240\u505A\u7684\u7C7B\u4F3C\uFF0C\u4F46\u6211\u4EEC\u5BF9\u4E24\u4E2A\u5757\u4E2D\u7684\u6BCF\u4E00\u4E2A\u90FD\u91CD\u590D\u5B83\u3002\u6211\u4EEC\u5C06\u5206\u6570\u5F52\u56E0\u4E8E\u6240\u6709\u53EF\u80FD\u7684\u7B54\u6848\u8DE8\u5EA6\uFF0C\u7136\u540E\u53D6\u5F97\u5206\u6700\u9AD8\u7684\u8DE8\u5EA6\uFF1A"),Ll.forEach(e),za=_(s),_s.l(s),he=_(s),k(vt.$$.fragment,s),Aa=_(s),de=f(s,"P",{});var Gl=c(de);oi=i(Gl,"\u8FD9\u4E24\u4E2A\u5019\u9009\u5BF9\u5E94\u4E8E\u6A21\u578B\u80FD\u591F\u5728\u6BCF\u4E2A\u5757\u4E2D\u627E\u5230\u7684\u6700\u4F73\u7B54\u6848\u3002\u8BE5\u6A21\u578B\u5BF9\u6B63\u786E\u7B54\u6848\u5728\u7B2C\u4E8C\u90E8\u5206\u66F4\u6709\u4FE1\u5FC3\uFF08\u8FD9\u662F\u4E00\u4E2A\u597D\u5146\u5934\uFF01\uFF09\u3002\u73B0\u5728\u6211\u4EEC\u53EA\u9700\u8981\u5C06\u8FD9\u4E24\u4E2A\u6807\u8BB0\u8DE8\u5EA6\u6620\u5C04\u5230\u4E0A\u4E0B\u6587\u4E2D\u7684\u5B57\u7B26\u8DE8\u5EA6\uFF08\u6211\u4EEC\u53EA\u9700\u8981\u6620\u5C04\u7B2C\u4E8C\u4E2A\u6807\u8BB0\u4EE5\u83B7\u5F97\u6211\u4EEC\u7684\u7B54\u6848\uFF0C\u4F46\u770B\u770B\u6A21\u578B\u5728\u7B2C\u4E00\u4E2A\u5757\u4E2D\u9009\u62E9\u4E86\u4EC0\u4E48\u5F88\u6709\u8DA3\uFF09\u3002"),Gl.forEach(e),La=_(s),k(Cs.$$.fragment,s),Ga=_(s),Rs=f(s,"P",{});var Ba=c(Rs);ii=i(Ba,"\u8FD9 "),_n=f(Ba,"STRONG",{});var Cl=c(_n);li=i(Cl,"offsets"),Cl.forEach(e),mi=i(Ba," \u6211\u4EEC\u4E4B\u524D\u6293\u53D6\u7684\u5B9E\u9645\u4E0A\u662F\u4E00\u4E2A\u504F\u79FB\u91CF\u5217\u8868\uFF0C\u6BCF\u4E2A\u6587\u672C\u5757\u6709\u4E00\u4E2A\u5217\u8868\uFF1A"),Ba.forEach(e),Ca=_(s),k(jt.$$.fragment,s),Ra=_(s),k(yt.$$.fragment,s),Oa=_(s),ge=f(s,"P",{});var Rl=c(ge);pi=i(Rl,"\u5982\u679C\u6211\u4EEC\u5FFD\u7565\u7B2C\u4E00\u4E2A\u7ED3\u679C\uFF0C\u6211\u4EEC\u4F1A\u5F97\u5230\u4E0E\u8FD9\u4E2A\u957F\u4E0A\u4E0B\u6587\u7684\u7BA1\u9053\u76F8\u540C\u7684\u7ED3\u679C\u2014\u2014\u662F\u7684\uFF01"),Rl.forEach(e),Fa=_(s),k(Os.$$.fragment,s),Ma=_(s),$e=f(s,"P",{});var Ol=c($e);fi=i(Ol,"\u6211\u4EEC\u5BF9\u5206\u8BCD\u5668\u529F\u80FD\u7684\u6DF1\u5165\u7814\u7A76\u5230\u6B64\u7ED3\u675F\u3002\u6211\u4EEC\u5C06\u5728\u4E0B\u4E00\u7AE0\u518D\u6B21\u5C06\u6240\u6709\u8FD9\u4E9B\u4ED8\u8BF8\u5B9E\u8DF5\uFF0C\u5C4A\u65F6\u6211\u4EEC\u5C06\u5411\u60A8\u5C55\u793A\u5982\u4F55\u5728\u4E00\u7CFB\u5217\u5E38\u89C1\u7684 NLP \u4EFB\u52A1\u4E0A\u5FAE\u8C03\u6A21\u578B\u3002"),Ol.forEach(e),this.h()},h(){N(n,"name","hf:doc:metadata"),N(n,"content",JSON.stringify(Em)),N(j,"id","qa"),N(j,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),N(j,"href","#qa"),N($,"class","relative group"),N(Ts,"id","questionanswering"),N(Ts,"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"),N(Ts,"href","#questionanswering"),N(ys,"class","relative group"),N(It,"href","/course/chapter1"),N(Vs,"id",""),N(Xs,"href","https://huggingface.co/distilbert-base-cased-distilled-squad"),N(Xs,"rel","nofollow"),N(Jt,"href","/course/chapter7/7"),N(Zs,"class","block dark:hidden"),Il(Zs.src,ci="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter6/question_tokens.svg")||N(Zs,"src",ci),N(Zs,"alt","An example of tokenization of question and context"),N(st,"class","hidden dark:block"),Il(st.src,ui="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter6/question_tokens-dark.svg")||N(st,"src",ui),N(st,"alt","An example of tokenization of question and context"),N(qs,"class","flex justify-center"),Rn.a=null,Fn.a=Mn,N(lt,"id","")},m(s,r){a(document.head,n),l(s,m,r),w(t,s,r),l(s,g,r),l(s,$,r),a($,j),a(j,q),w(S,q,null),a($,A),a($,O),a(O,W),l(s,G,r),qt[P].m(s,r),l(s,T,r),l(s,E,r),a(E,vs),a(E,Q),a(Q,js),a(E,Va),l(s,$n,r),Tt[H].m(s,r),l(s,Mt,r),l(s,ys,r),a(ys,Ts),a(Ts,Ne),w(Ws,Ne,null),a(ys,Xa),a(ys,Qs),a(Qs,Za),a(Qs,ze),a(ze,sr),a(Qs,tr),l(s,bn,r),l(s,ds,r),a(ds,er),a(ds,It),a(It,nr),a(ds,ar),a(ds,Ae),a(Ae,rr),a(ds,or),l(s,kn,r),w(Hs,s,r),l(s,wn,r),w(Ks,s,r),l(s,xn,r),l(s,Ut,r),a(Ut,ir),l(s,vn,r),w(Bs,s,r),l(s,jn,r),w(Ys,s,r),l(s,yn,r),l(s,Dt,r),a(Dt,lr),l(s,qn,r),l(s,Vs,r),a(Vs,mr),l(s,Tn,r),l(s,F,r),a(F,pr),a(F,Le),a(Le,fr),a(F,cr),a(F,Xs),a(Xs,ur),a(F,_r),a(F,Jt),a(Jt,hr),a(F,dr),l(s,En,r),Et[B].m(s,r),l(s,Wt,r),l(s,Qt,r),a(Qt,gr),l(s,Sn,r),l(s,qs,r),a(qs,Zs),a(qs,$r),a(qs,st),l(s,Pn,r),l(s,Ht,r),a(Ht,br),l(s,Nn,r),w(tt,s,r),l(s,zn,r),St[V].m(s,r),l(s,Kt,r),l(s,M,r),a(M,kr),a(M,Ge),a(Ge,wr),a(M,xr),a(M,Ce),a(Ce,vr),a(M,jr),a(M,Re),a(Re,yr),a(M,qr),l(s,An,r),l(s,Es,r),a(Es,Tr),a(Es,Oe),a(Oe,Er),a(Es,Sr),l(s,Ln,r),Pt[Z].m(s,r),l(s,Bt,r),l(s,Yt,r),a(Yt,Pr),l(s,Gn,r),Nt[ts].m(s,r),l(s,Vt,r),l(s,C,r),a(C,Nr),a(C,Fe),a(Fe,zr),a(C,Ar),a(C,Me),a(Me,Lr),a(C,Gr),a(C,Ie),a(Ie,Cr),a(C,Rr),a(C,Ue),a(Ue,Or),a(C,Fr),l(s,Cn,r),l(s,L,r),a(L,Mr),a(L,De),a(De,Ir),a(L,Ur),a(L,Je),a(Je,Dr),a(L,Jr),a(L,We),a(We,Wr),a(L,Qr),a(L,Qe),a(Qe,Hr),a(L,Kr),Rn.m(Wl,L),l(s,On,r),l(s,gs,r),a(gs,Br),Fn.m(Ql,gs),a(gs,Mn),a(gs,He),a(He,Yr),a(gs,Vr),l(s,In,r),l(s,Xt,r),a(Xt,Xr),l(s,Un,r),w(et,s,r),l(s,Dn,r),zt[ns].m(s,r),l(s,Zt,r),l(s,R,r),a(R,Zr),a(R,Ke),a(Ke,so),a(R,to),a(R,Be),a(Be,eo),a(R,no),a(R,Ye),a(Ye,ao),a(R,ro),a(R,Ve),a(Ve,oo),a(R,io),l(s,Jn,r),w(nt,s,r),l(s,Wn,r),l(s,se,r),a(se,lo),l(s,Qn,r),w(at,s,r),l(s,Hn,r),w(Ss,s,r),l(s,Kn,r),l(s,$s,r),a($s,mo),a($s,Xe),a(Xe,po),a($s,fo),a($s,Ze),a(Ze,co),a($s,uo),l(s,Bn,r),w(rt,s,r),l(s,Yn,r),l(s,te,r),a(te,_o),l(s,Vn,r),w(ot,s,r),l(s,Xn,r),w(it,s,r),l(s,Zn,r),l(s,ee,r),a(ee,ho),l(s,sa,r),w(Ps,s,r),l(s,ta,r),l(s,lt,r),a(lt,go),l(s,ea,r),l(s,Ns,r),a(Ns,$o),a(Ns,sn),a(sn,bo),a(Ns,ko),l(s,na,r),w(mt,s,r),l(s,aa,r),w(pt,s,r),l(s,ra,r),l(s,zs,r),a(zs,wo),a(zs,tn),a(tn,xo),a(zs,vo),l(s,oa,r),w(ft,s,r),l(s,ia,r),w(ct,s,r),l(s,la,r),l(s,As,r),a(As,jo),a(As,en),a(en,yo),a(As,qo),l(s,ma,r),l(s,bs,r),a(bs,To),a(bs,nn),a(nn,Eo),a(bs,So),a(bs,an),a(an,Po),a(bs,No),l(s,pa,r),w(ut,s,r),l(s,fa,r),w(_t,s,r),l(s,ca,r),l(s,Ls,r),a(Ls,zo),a(Ls,rn),a(rn,Ao),a(Ls,Lo),l(s,ua,r),l(s,ne,r),a(ne,Go),l(s,_a,r),w(ht,s,r),l(s,ha,r),w(dt,s,r),l(s,da,r),l(s,Gs,r),a(Gs,Co),a(Gs,on),a(on,Ro),a(Gs,Oo),l(s,ga,r),w(gt,s,r),l(s,$a,r),w($t,s,r),l(s,ba,r),l(s,ae,r),a(ae,Fo),l(s,ka,r),w(bt,s,r),l(s,wa,r),l(s,re,r),a(re,Mo),l(s,xa,r),w(kt,s,r),l(s,va,r),l(s,oe,r),a(oe,Io),l(s,ja,r),l(s,I,r),a(I,Uo),a(I,ln),a(ln,Do),a(I,Jo),a(I,mn),a(mn,Wo),a(I,Qo),a(I,pn),a(pn,Ho),a(I,Ko),l(s,ya,r),w(wt,s,r),l(s,qa,r),l(s,U,r),a(U,Bo),a(U,fn),a(fn,Yo),a(U,Vo),a(U,cn),a(cn,Xo),a(U,Zo),a(U,un),a(un,si),a(U,ti),l(s,Ta,r),At[rs].m(s,r),l(s,ie,r),l(s,le,r),a(le,ei),l(s,Ea,r),w(xt,s,r),l(s,Sa,r),Lt[is].m(s,r),l(s,me,r),l(s,pe,r),a(pe,ni),l(s,Pa,r),Gt[ms].m(s,r),l(s,fe,r),l(s,ce,r),a(ce,ai),l(s,Na,r),Ct[fs].m(s,r),l(s,ue,r),l(s,_e,r),a(_e,ri),l(s,za,r),Rt[us].m(s,r),l(s,he,r),w(vt,s,r),l(s,Aa,r),l(s,de,r),a(de,oi),l(s,La,r),w(Cs,s,r),l(s,Ga,r),l(s,Rs,r),a(Rs,ii),a(Rs,_n),a(_n,li),a(Rs,mi),l(s,Ca,r),w(jt,s,r),l(s,Ra,r),w(yt,s,r),l(s,Oa,r),l(s,ge,r),a(ge,pi),l(s,Fa,r),w(Os,s,r),l(s,Ma,r),l(s,$e,r),a($e,fi),Ia=!0},p(s,[r]){const Ot={};r&1&&(Ot.fw=s[0]),t.$set(Ot);let be=P;P=hi(s),P!==be&&(J(),h(qt[be],1,1,()=>{qt[be]=null}),D(),z=qt[P],z||(z=qt[P]=_i[P](s),z.c()),d(z,1),z.m(T.parentNode,T));let ke=H;H=gi(s),H!==ke&&(J(),h(Tt[ke],1,1,()=>{Tt[ke]=null}),D(),K=Tt[H],K||(K=Tt[H]=di[H](s),K.c()),d(K,1),K.m(Mt.parentNode,Mt));let we=B;B=bi(s),B!==we&&(J(),h(Et[we],1,1,()=>{Et[we]=null}),D(),Y=Et[B],Y||(Y=Et[B]=$i[B](s),Y.c()),d(Y,1),Y.m(Wt.parentNode,Wt));let Fs=V;V=wi(s),V!==Fs&&(J(),h(St[Fs],1,1,()=>{St[Fs]=null}),D(),X=St[V],X||(X=St[V]=ki[V](s),X.c()),d(X,1),X.m(Kt.parentNode,Kt));let xe=Z;Z=vi(s),Z!==xe&&(J(),h(Pt[xe],1,1,()=>{Pt[xe]=null}),D(),ss=Pt[Z],ss||(ss=Pt[Z]=xi[Z](s),ss.c()),d(ss,1),ss.m(Bt.parentNode,Bt));let Ms=ts;ts=yi(s),ts!==Ms&&(J(),h(Nt[Ms],1,1,()=>{Nt[Ms]=null}),D(),es=Nt[ts],es||(es=Nt[ts]=ji[ts](s),es.c()),d(es,1),es.m(Vt.parentNode,Vt));let ve=ns;ns=Ti(s),ns!==ve&&(J(),h(zt[ve],1,1,()=>{zt[ve]=null}),D(),as=zt[ns],as||(as=zt[ns]=qi[ns](s),as.c()),d(as,1),as.m(Zt.parentNode,Zt));const hn={};r&2&&(hn.$$scope={dirty:r,ctx:s}),Ss.$set(hn);const Ft={};r&2&&(Ft.$$scope={dirty:r,ctx:s}),Ps.$set(Ft);let je=rs;rs=Si(s),rs!==je&&(J(),h(At[je],1,1,()=>{At[je]=null}),D(),os=At[rs],os||(os=At[rs]=Ei[rs](s),os.c()),d(os,1),os.m(ie.parentNode,ie));let ks=is;is=Ni(s),is!==ks&&(J(),h(Lt[ks],1,1,()=>{Lt[ks]=null}),D(),ls=Lt[is],ls||(ls=Lt[is]=Pi[is](s),ls.c()),d(ls,1),ls.m(me.parentNode,me));let ye=ms;ms=Ai(s),ms!==ye&&(J(),h(Gt[ye],1,1,()=>{Gt[ye]=null}),D(),ps=Gt[ms],ps||(ps=Gt[ms]=zi[ms](s),ps.c()),d(ps,1),ps.m(fe.parentNode,fe));let qe=fs;fs=Gi(s),fs!==qe&&(J(),h(Ct[qe],1,1,()=>{Ct[qe]=null}),D(),cs=Ct[fs],cs||(cs=Ct[fs]=Li[fs](s),cs.c()),d(cs,1),cs.m(ue.parentNode,ue));let Te=us;us=Ri(s),us!==Te&&(J(),h(Rt[Te],1,1,()=>{Rt[Te]=null}),D(),_s=Rt[us],_s||(_s=Rt[us]=Ci[us](s),_s.c()),d(_s,1),_s.m(he.parentNode,he));const dn={};r&2&&(dn.$$scope={dirty:r,ctx:s}),Cs.$set(dn);const gn={};r&2&&(gn.$$scope={dirty:r,ctx:s}),Os.$set(gn)},i(s){Ia||(d(t.$$.fragment,s),d(S.$$.fragment,s),d(z),d(K),d(Ws.$$.fragment,s),d(Hs.$$.fragment,s),d(Ks.$$.fragment,s),d(Bs.$$.fragment,s),d(Ys.$$.fragment,s),d(Y),d(tt.$$.fragment,s),d(X),d(ss),d(es),d(et.$$.fragment,s),d(as),d(nt.$$.fragment,s),d(at.$$.fragment,s),d(Ss.$$.fragment,s),d(rt.$$.fragment,s),d(ot.$$.fragment,s),d(it.$$.fragment,s),d(Ps.$$.fragment,s),d(mt.$$.fragment,s),d(pt.$$.fragment,s),d(ft.$$.fragment,s),d(ct.$$.fragment,s),d(ut.$$.fragment,s),d(_t.$$.fragment,s),d(ht.$$.fragment,s),d(dt.$$.fragment,s),d(gt.$$.fragment,s),d($t.$$.fragment,s),d(bt.$$.fragment,s),d(kt.$$.fragment,s),d(wt.$$.fragment,s),d(os),d(xt.$$.fragment,s),d(ls),d(ps),d(cs),d(_s),d(vt.$$.fragment,s),d(Cs.$$.fragment,s),d(jt.$$.fragment,s),d(yt.$$.fragment,s),d(Os.$$.fragment,s),Ia=!0)},o(s){h(t.$$.fragment,s),h(S.$$.fragment,s),h(z),h(K),h(Ws.$$.fragment,s),h(Hs.$$.fragment,s),h(Ks.$$.fragment,s),h(Bs.$$.fragment,s),h(Ys.$$.fragment,s),h(Y),h(tt.$$.fragment,s),h(X),h(ss),h(es),h(et.$$.fragment,s),h(as),h(nt.$$.fragment,s),h(at.$$.fragment,s),h(Ss.$$.fragment,s),h(rt.$$.fragment,s),h(ot.$$.fragment,s),h(it.$$.fragment,s),h(Ps.$$.fragment,s),h(mt.$$.fragment,s),h(pt.$$.fragment,s),h(ft.$$.fragment,s),h(ct.$$.fragment,s),h(ut.$$.fragment,s),h(_t.$$.fragment,s),h(ht.$$.fragment,s),h(dt.$$.fragment,s),h(gt.$$.fragment,s),h($t.$$.fragment,s),h(bt.$$.fragment,s),h(kt.$$.fragment,s),h(wt.$$.fragment,s),h(os),h(xt.$$.fragment,s),h(ls),h(ps),h(cs),h(_s),h(vt.$$.fragment,s),h(Cs.$$.fragment,s),h(jt.$$.fragment,s),h(yt.$$.fragment,s),h(Os.$$.fragment,s),Ia=!1},d(s){e(n),s&&e(m),x(t,s),s&&e(g),s&&e($),x(S),s&&e(G),qt[P].d(s),s&&e(T),s&&e(E),s&&e($n),Tt[H].d(s),s&&e(Mt),s&&e(ys),x(Ws),s&&e(bn),s&&e(ds),s&&e(kn),x(Hs,s),s&&e(wn),x(Ks,s),s&&e(xn),s&&e(Ut),s&&e(vn),x(Bs,s),s&&e(jn),x(Ys,s),s&&e(yn),s&&e(Dt),s&&e(qn),s&&e(Vs),s&&e(Tn),s&&e(F),s&&e(En),Et[B].d(s),s&&e(Wt),s&&e(Qt),s&&e(Sn),s&&e(qs),s&&e(Pn),s&&e(Ht),s&&e(Nn),x(tt,s),s&&e(zn),St[V].d(s),s&&e(Kt),s&&e(M),s&&e(An),s&&e(Es),s&&e(Ln),Pt[Z].d(s),s&&e(Bt),s&&e(Yt),s&&e(Gn),Nt[ts].d(s),s&&e(Vt),s&&e(C),s&&e(Cn),s&&e(L),s&&e(On),s&&e(gs),s&&e(In),s&&e(Xt),s&&e(Un),x(et,s),s&&e(Dn),zt[ns].d(s),s&&e(Zt),s&&e(R),s&&e(Jn),x(nt,s),s&&e(Wn),s&&e(se),s&&e(Qn),x(at,s),s&&e(Hn),x(Ss,s),s&&e(Kn),s&&e($s),s&&e(Bn),x(rt,s),s&&e(Yn),s&&e(te),s&&e(Vn),x(ot,s),s&&e(Xn),x(it,s),s&&e(Zn),s&&e(ee),s&&e(sa),x(Ps,s),s&&e(ta),s&&e(lt),s&&e(ea),s&&e(Ns),s&&e(na),x(mt,s),s&&e(aa),x(pt,s),s&&e(ra),s&&e(zs),s&&e(oa),x(ft,s),s&&e(ia),x(ct,s),s&&e(la),s&&e(As),s&&e(ma),s&&e(bs),s&&e(pa),x(ut,s),s&&e(fa),x(_t,s),s&&e(ca),s&&e(Ls),s&&e(ua),s&&e(ne),s&&e(_a),x(ht,s),s&&e(ha),x(dt,s),s&&e(da),s&&e(Gs),s&&e(ga),x(gt,s),s&&e($a),x($t,s),s&&e(ba),s&&e(ae),s&&e(ka),x(bt,s),s&&e(wa),s&&e(re),s&&e(xa),x(kt,s),s&&e(va),s&&e(oe),s&&e(ja),s&&e(I),s&&e(ya),x(wt,s),s&&e(qa),s&&e(U),s&&e(Ta),At[rs].d(s),s&&e(ie),s&&e(le),s&&e(Ea),x(xt,s),s&&e(Sa),Lt[is].d(s),s&&e(me),s&&e(pe),s&&e(Pa),Gt[ms].d(s),s&&e(fe),s&&e(ce),s&&e(Na),Ct[fs].d(s),s&&e(ue),s&&e(_e),s&&e(za),Rt[us].d(s),s&&e(he),x(vt,s),s&&e(Aa),s&&e(de),s&&e(La),x(Cs,s),s&&e(Ga),s&&e(Rs),s&&e(Ca),x(jt,s),s&&e(Ra),x(yt,s),s&&e(Oa),s&&e(ge),s&&e(Fa),x(Os,s),s&&e(Ma),s&&e($e)}}}const Em={local:"qa",sections:[{local:"questionanswering",title:"\u4F7F\u7528 `question-answering` \u7BA1\u9053"},{local:"",title:"\u4F7F\u7528\u6A21\u578B\u8FDB\u884C\u95EE\u7B54"},{local:"",title:"\u5904\u7406\u957F\u4E0A\u4E0B\u6587"}],title:"QA \u7BA1\u9053\u4E2D\u7684\u5FEB\u901F\u6807\u8BB0\u5668"};function Sm(v,n,m){let t="pt";return Vl(()=>{const g=new URLSearchParams(window.location.search);m(0,t=g.get("fw")||"pt")}),[t]}class Om extends Hl{constructor(n){super();Kl(this,n,Sm,Tm,Bl,{})}}export{Om as default,Em as metadata};
