import{S as ka,i as va,s as Ea,e as a,k as u,t as r,w as c,M as qa,c as l,d as t,m as f,a as p,h as n,x as m,b as _,N as Mo,G as s,g as i,y as h,q as b,o as g,B as w,v as ya}from"../../chunks/vendor-hf-doc-builder.js";import{T as ri}from"../../chunks/Tip-hf-doc-builder.js";import{Y as ni}from"../../chunks/Youtube-hf-doc-builder.js";import{I as ja}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as k}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as xa}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";function Pa(B){let d,E;return{c(){d=a("p"),E=r("\u{1F6A8} \u770B\u5230Google Colab \u56DE\u6EAF\u4E2D \u201C6 \u5E27\u201D \u5468\u56F4\u7684\u84DD\u8272\u6846\u4E86\u5417? \u8FD9\u662F Colab \u7684\u4E00\u4E2A\u7279\u6B8A\u529F\u80FD, \u5B83\u5C06\u56DE\u6EAF\u538B\u7F29\u4E3A\u201D\u5E27\u201D\u3002\u5982\u679C\u4F60\u4F3C\u4E4E\u65E0\u6CD5\u627E\u5230\u9519\u8BEF\u7684\u6765\u6E90, \u8BF7\u786E\u4FDD\u901A\u8FC7\u5355\u51FB\u8FD9\u4E24\u4E2A\u5C0F\u7BAD\u5934\u6765\u5C55\u5F00\u5B8C\u6574\u7684\u56DE\u6EAF\u3002")},l($){d=l($,"P",{});var q=p(d);E=n(q,"\u{1F6A8} \u770B\u5230Google Colab \u56DE\u6EAF\u4E2D \u201C6 \u5E27\u201D \u5468\u56F4\u7684\u84DD\u8272\u6846\u4E86\u5417? \u8FD9\u662F Colab \u7684\u4E00\u4E2A\u7279\u6B8A\u529F\u80FD, \u5B83\u5C06\u56DE\u6EAF\u538B\u7F29\u4E3A\u201D\u5E27\u201D\u3002\u5982\u679C\u4F60\u4F3C\u4E4E\u65E0\u6CD5\u627E\u5230\u9519\u8BEF\u7684\u6765\u6E90, \u8BF7\u786E\u4FDD\u901A\u8FC7\u5355\u51FB\u8FD9\u4E24\u4E2A\u5C0F\u7BAD\u5934\u6765\u5C55\u5F00\u5B8C\u6574\u7684\u56DE\u6EAF\u3002"),q.forEach(t)},m($,q){i($,d,q),s(d,E)},d($){$&&t(d)}}}function Ca(B){let d,E,$,q,T,v,x,P,M,G,fe;return{c(){d=a("p"),E=r("\u{1F4A1} \u5982\u679C\u4F60\u9047\u5230\u96BE\u4EE5\u7406\u89E3\u7684\u9519\u8BEF\u6D88\u606F, \u53EA\u9700\u5C06\u8BE5\u6D88\u606F\u590D\u5236\u5E76\u7C98\u8D34\u5230 Google \u6216 "),$=a("a"),q=r("Stack Overflow"),T=r(" \u641C\u7D22\u680F\u4E2D (\u662F\u7684, \u771F\u7684!)\u3002\u4F60\u5F88\u53EF\u80FD\u4E0D\u662F\u7B2C\u4E00\u4E2A\u9047\u5230\u9519\u8BEF\u7684\u4EBA, \u8FD9\u662F\u627E\u5230\u793E\u533A\u4E2D\u5176\u4ED6\u4EBA\u53D1\u5E03\u7684\u89E3\u51B3\u65B9\u6848\u7684\u597D\u65B9\u6CD5\u3002\u4F8B\u5982, \u5728 Stack Overflow \u4E0A\u641C\u7D22 "),v=a("code"),x=r("OSError: Can't load config for"),P=r(" \u7ED9\u51FA\u4E86\u51E0\u4E2A"),M=a("a"),G=r("hits"),fe=r(", \u53EF\u80FD\u662F\u7528\u4F5C\u89E3\u51B3\u95EE\u9898\u7684\u8D77\u70B9\u3002"),this.h()},l(W){d=l(W,"P",{});var C=p(d);E=n(C,"\u{1F4A1} \u5982\u679C\u4F60\u9047\u5230\u96BE\u4EE5\u7406\u89E3\u7684\u9519\u8BEF\u6D88\u606F, \u53EA\u9700\u5C06\u8BE5\u6D88\u606F\u590D\u5236\u5E76\u7C98\u8D34\u5230 Google \u6216 "),$=l(C,"A",{href:!0,rel:!0});var N=p($);q=n(N,"Stack Overflow"),N.forEach(t),T=n(C," \u641C\u7D22\u680F\u4E2D (\u662F\u7684, \u771F\u7684!)\u3002\u4F60\u5F88\u53EF\u80FD\u4E0D\u662F\u7B2C\u4E00\u4E2A\u9047\u5230\u9519\u8BEF\u7684\u4EBA, \u8FD9\u662F\u627E\u5230\u793E\u533A\u4E2D\u5176\u4ED6\u4EBA\u53D1\u5E03\u7684\u89E3\u51B3\u65B9\u6848\u7684\u597D\u65B9\u6CD5\u3002\u4F8B\u5982, \u5728 Stack Overflow \u4E0A\u641C\u7D22 "),v=l(C,"CODE",{});var _e=p(v);x=n(_e,"OSError: Can't load config for"),_e.forEach(t),P=n(C," \u7ED9\u51FA\u4E86\u51E0\u4E2A"),M=l(C,"A",{href:!0,rel:!0});var O=p(M);G=n(O,"hits"),O.forEach(t),fe=n(C,", \u53EF\u80FD\u662F\u7528\u4F5C\u89E3\u51B3\u95EE\u9898\u7684\u8D77\u70B9\u3002"),C.forEach(t),this.h()},h(){_($,"href","https://stackoverflow.com/"),_($,"rel","nofollow"),_(M,"href","https://stackoverflow.com/search?q=OSError%3A+Can%27t+load+config+for+"),_(M,"rel","nofollow")},m(W,C){i(W,d,C),s(d,E),s(d,$),s($,q),s(d,T),s(d,v),s(v,x),s(d,P),s(d,M),s(M,G),s(d,fe)},d(W){W&&t(d)}}}function Da(B){let d,E,$,q,T;return{c(){d=a("p"),E=r("\u{1F6A8} \u6211\u4EEC\u5728\u8FD9\u91CC\u91C7\u7528\u7684\u65B9\u6CD5\u5E76\u4E0D\u662F\u4E07\u65E0\u4E00\u5931\u7684, \u56E0\u4E3A\u6211\u4EEC\u7684\u540C\u4E8B\u53EF\u80FD\u5728\u5FAE\u8C03\u6A21\u578B\u4E4B\u524D\u5DF2\u7ECF\u8C03\u6574\u4E86 "),$=a("code"),q=r("distilbert-base-uncased"),T=r(" \u914D\u7F6E\u3002\u5728\u73B0\u5B9E\u751F\u6D3B\u4E2D, \u6211\u4EEC\u60F3\u9996\u5148\u68C0\u67E5\u5B83\u4EEC, \u4F46\u51FA\u4E8E\u672C\u8282\u7684\u76EE\u7684, \u6211\u4EEC\u5047\u8BBE\u5B83\u4EEC\u4F7F\u7528\u9ED8\u8BA4\u914D\u7F6E\u3002")},l(v){d=l(v,"P",{});var x=p(d);E=n(x,"\u{1F6A8} \u6211\u4EEC\u5728\u8FD9\u91CC\u91C7\u7528\u7684\u65B9\u6CD5\u5E76\u4E0D\u662F\u4E07\u65E0\u4E00\u5931\u7684, \u56E0\u4E3A\u6211\u4EEC\u7684\u540C\u4E8B\u53EF\u80FD\u5728\u5FAE\u8C03\u6A21\u578B\u4E4B\u524D\u5DF2\u7ECF\u8C03\u6574\u4E86 "),$=l(x,"CODE",{});var P=p($);q=n(P,"distilbert-base-uncased"),P.forEach(t),T=n(x," \u914D\u7F6E\u3002\u5728\u73B0\u5B9E\u751F\u6D3B\u4E2D, \u6211\u4EEC\u60F3\u9996\u5148\u68C0\u67E5\u5B83\u4EEC, \u4F46\u51FA\u4E8E\u672C\u8282\u7684\u76EE\u7684, \u6211\u4EEC\u5047\u8BBE\u5B83\u4EEC\u4F7F\u7528\u9ED8\u8BA4\u914D\u7F6E\u3002"),x.forEach(t)},m(v,x){i(v,d,x),s(d,E),s(d,$),s($,q),s(d,T)},d(v){v&&t(d)}}}function Aa(B){let d,E,$,q,T,v,x,P,M,G,fe,W,C,N,_e,O,Go,de,No,Qo,ce,Fo,Ro,_s,me,ds,rt,Lo,cs,he,ms,X,Vo,jt,Jo,Wo,hs,be,bs,U,Yo,xt,Bo,Xo,gs,Y,K,Pt,ge,Uo,Ct,Ko,ws,nt,Zo,$s,it,we,er,at,tr,sr,ks,Z,or,Dt,rr,nr,vs,$e,Es,ke,qs,Q,ir,At,ar,lr,Ot,pr,ur,ys,ve,Ee,ii,js,D,fr,Tt,_r,dr,zt,cr,mr,lt,hr,br,St,gr,wr,xs,ee,Ps,F,$r,It,kr,vr,Ht,Er,qr,Cs,qe,Ds,te,As,pt,yr,Os,ye,je,ai,Ts,ut,jr,zs,xe,Pe,li,Ss,ft,xr,Is,Ce,Hs,De,Ms,R,Pr,Mt,Cr,Dr,Gt,Ar,Or,Gs,Ae,Ns,Oe,Qs,y,Tr,Nt,zr,Sr,Qt,Ir,Hr,Te,Ft,Mr,Gr,_t,Nr,Qr,Rt,Fr,Rr,Fs,ze,Rs,se,Ls,oe,Lr,Lt,Vr,Jr,Vs,Se,Js,re,Wr,Vt,Yr,Br,Ws,Ie,Ys,He,Bs,dt,Xr,Xs,z,Me,Ur,Jt,Kr,Zr,en,Wt,tn,sn,Yt,on,rn,ct,Bt,nn,an,Us,mt,ln,Ks,Ge,pn,Zs,L,un,Xt,fn,_n,Ut,dn,cn,eo,Ne,to,ht,mn,so,Qe,oo,ne,hn,bt,bn,gn,ro,Fe,no,Re,io,gt,wn,ao,Le,lo,wt,$n,po,Ve,uo,A,kn,Kt,vn,En,Zt,qn,yn,es,jn,xn,ts,Pn,Cn,fo,Je,_o,We,co,ie,Dn,ss,An,On,mo,Ye,ho,Be,bo,j,Tn,os,zn,Sn,$t,In,Hn,rs,Mn,Gn,ns,Nn,Qn,is,Fn,Rn,go,Xe,wo,S,Ln,as,Vn,Jn,ls,Wn,Yn,Ue,Bn,Xn,$o,Ke,Ze,pi,ko,ae,Un,ps,Kn,Zn,vo,et,Eo,tt,qo,le,ei,st,ti,si,yo;return v=new xa({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/chapter8/section2.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/chapter8/section2.ipynb"}]}}),N=new ni({props:{id:"DQ-CpJn6Rc4"}}),me=new k({props:{code:`from huggingface_hub import notebook_login

notebook_login()`,highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

notebook_login()`}}),he=new k({props:{code:"huggingface-cli login",highlighted:"huggingface-cli login"}}),be=new k({props:{code:`from distutils.dir_util import copy_tree
from huggingface_hub import Repository, snapshot_download, create_repo, get_full_repo_name


def copy_repository_template():
    # Clone the repo and extract the local path
    template_repo_id = "lewtun/distilbert-base-uncased-finetuned-squad-d5716d28"
    commit_hash = "be3eaffc28669d7932492681cd5f3e8905e358b4"
    template_repo_dir = snapshot_download(template_repo_id, revision=commit_hash)
    # Create an empty repo on the Hub
    model_name = template_repo_id.split("/")[1]
    create_repo(model_name, exist_ok=True)
    # Clone the empty repo
    new_repo_id = get_full_repo_name(model_name)
    new_repo_dir = model_name
    repo = Repository(local_dir=new_repo_dir, clone_from=new_repo_id)
    # Copy files
    copy_tree(template_repo_dir, new_repo_dir)
    # Push to Hub
    repo.push_to_hub()`,highlighted:`<span class="hljs-keyword">from</span> distutils.dir_util <span class="hljs-keyword">import</span> copy_tree
<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> Repository, snapshot_download, create_repo, get_full_repo_name


<span class="hljs-keyword">def</span> <span class="hljs-title function_">copy_repository_template</span>():
    <span class="hljs-comment"># Clone the repo and extract the local path</span>
    template_repo_id = <span class="hljs-string">&quot;lewtun/distilbert-base-uncased-finetuned-squad-d5716d28&quot;</span>
    commit_hash = <span class="hljs-string">&quot;be3eaffc28669d7932492681cd5f3e8905e358b4&quot;</span>
    template_repo_dir = snapshot_download(template_repo_id, revision=commit_hash)
    <span class="hljs-comment"># Create an empty repo on the Hub</span>
    model_name = template_repo_id.split(<span class="hljs-string">&quot;/&quot;</span>)[<span class="hljs-number">1</span>]
    create_repo(model_name, exist_ok=<span class="hljs-literal">True</span>)
    <span class="hljs-comment"># Clone the empty repo</span>
    new_repo_id = get_full_repo_name(model_name)
    new_repo_dir = model_name
    repo = Repository(local_dir=new_repo_dir, clone_from=new_repo_id)
    <span class="hljs-comment"># Copy files</span>
    copy_tree(template_repo_dir, new_repo_dir)
    <span class="hljs-comment"># Push to Hub</span>
    repo.push_to_hub()`}}),ge=new ja({}),$e=new k({props:{code:`from transformers import pipeline

model_checkpoint = get_full_repo_name("distillbert-base-uncased-finetuned-squad-d5716d28")
reader = pipeline("question-answering", model=model_checkpoint)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

model_checkpoint = get_full_repo_name(<span class="hljs-string">&quot;distillbert-base-uncased-finetuned-squad-d5716d28&quot;</span>)
reader = pipeline(<span class="hljs-string">&quot;question-answering&quot;</span>, model=model_checkpoint)`}}),ke=new k({props:{code:`"""
OSError: Can't load config for 'lewtun/distillbert-base-uncased-finetuned-squad-d5716d28'. Make sure that:

- 'lewtun/distillbert-base-uncased-finetuned-squad-d5716d28' is a correct model identifier listed on 'https://huggingface.co/models'

- or 'lewtun/distillbert-base-uncased-finetuned-squad-d5716d28' is the correct path to a directory containing a config.json file
"""`,highlighted:`<span class="hljs-string">&quot;&quot;&quot;
OSError: Can&#x27;t load config for &#x27;lewtun/distillbert-base-uncased-finetuned-squad-d5716d28&#x27;. Make sure that:

- &#x27;lewtun/distillbert-base-uncased-finetuned-squad-d5716d28&#x27; is a correct model identifier listed on &#x27;https://huggingface.co/models&#x27;

- or &#x27;lewtun/distillbert-base-uncased-finetuned-squad-d5716d28&#x27; is the correct path to a directory containing a config.json file
&quot;&quot;&quot;</span>`}}),ee=new ri({props:{$$slots:{default:[Pa]},$$scope:{ctx:B}}}),qe=new k({props:{code:`"""
Make sure that:

- 'lewtun/distillbert-base-uncased-finetuned-squad-d5716d28' is a correct model identifier listed on 'https://huggingface.co/models'

- or 'lewtun/distillbert-base-uncased-finetuned-squad-d5716d28' is the correct path to a directory containing a config.json file
"""`,highlighted:`<span class="hljs-string">&quot;&quot;&quot;
Make sure that:

- &#x27;lewtun/distillbert-base-uncased-finetuned-squad-d5716d28&#x27; is a correct model identifier listed on &#x27;https://huggingface.co/models&#x27;

- or &#x27;lewtun/distillbert-base-uncased-finetuned-squad-d5716d28&#x27; is the correct path to a directory containing a config.json file
&quot;&quot;&quot;</span>`}}),te=new ri({props:{$$slots:{default:[Ca]},$$scope:{ctx:B}}}),Ce=new k({props:{code:`model_checkpoint = get_full_repo_name("distilbert-base-uncased-finetuned-squad-d5716d28")
reader = pipeline("question-answering", model=model_checkpoint)`,highlighted:`model_checkpoint = get_full_repo_name(<span class="hljs-string">&quot;distilbert-base-uncased-finetuned-squad-d5716d28&quot;</span>)
reader = pipeline(<span class="hljs-string">&quot;question-answering&quot;</span>, model=model_checkpoint)`}}),De=new k({props:{code:`"""
OSError: Can't load config for 'lewtun/distilbert-base-uncased-finetuned-squad-d5716d28'. Make sure that:

- 'lewtun/distilbert-base-uncased-finetuned-squad-d5716d28' is a correct model identifier listed on 'https://huggingface.co/models'

- or 'lewtun/distilbert-base-uncased-finetuned-squad-d5716d28' is the correct path to a directory containing a config.json file
"""`,highlighted:`<span class="hljs-string">&quot;&quot;&quot;
OSError: Can&#x27;t load config for &#x27;lewtun/distilbert-base-uncased-finetuned-squad-d5716d28&#x27;. Make sure that:

- &#x27;lewtun/distilbert-base-uncased-finetuned-squad-d5716d28&#x27; is a correct model identifier listed on &#x27;https://huggingface.co/models&#x27;

- or &#x27;lewtun/distilbert-base-uncased-finetuned-squad-d5716d28&#x27; is the correct path to a directory containing a config.json file
&quot;&quot;&quot;</span>`}}),Ae=new k({props:{code:`from huggingface_hub import list_repo_files

list_repo_files(repo_id=model_checkpoint)`,highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> list_repo_files

list_repo_files(repo_id=model_checkpoint)`}}),Oe=new k({props:{code:"['.gitattributes', 'README.md', 'pytorch_model.bin', 'special_tokens_map.json', 'tokenizer_config.json', 'training_args.bin', 'vocab.txt']",highlighted:'[<span class="hljs-string">&#x27;.gitattributes&#x27;</span>, <span class="hljs-string">&#x27;README.md&#x27;</span>, <span class="hljs-string">&#x27;pytorch_model.bin&#x27;</span>, <span class="hljs-string">&#x27;special_tokens_map.json&#x27;</span>, <span class="hljs-string">&#x27;tokenizer_config.json&#x27;</span>, <span class="hljs-string">&#x27;training_args.bin&#x27;</span>, <span class="hljs-string">&#x27;vocab.txt&#x27;</span>]'}}),ze=new k({props:{code:`from transformers import AutoConfig

pretrained_checkpoint = "distilbert-base-uncased"
config = AutoConfig.from_pretrained(pretrained_checkpoint)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoConfig

pretrained_checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>
config = AutoConfig.from_pretrained(pretrained_checkpoint)`}}),se=new ri({props:{warning:!0,$$slots:{default:[Da]},$$scope:{ctx:B}}}),Se=new k({props:{code:'config.push_to_hub(model_checkpoint, commit_message="Add config.json")',highlighted:'config.push_to_hub(model_checkpoint, commit_message=<span class="hljs-string">&quot;Add config.json&quot;</span>)'}}),Ie=new k({props:{code:`reader = pipeline("question-answering", model=model_checkpoint, revision="main")

context = r"""
Extractive Question Answering is the task of extracting an answer from a text
given a question. An example of a question answering dataset is the SQuAD
dataset, which is entirely based on that task. If you would like to fine-tune a
model on a SQuAD task, you may leverage the
examples/pytorch/question-answering/run_squad.py script.

\u{1F917} Transformers is interoperable with the PyTorch, TensorFlow, and JAX
frameworks, so you can use your favourite tools for a wide variety of tasks!
"""

question = "What is extractive question answering?"
reader(question=question, context=context)`,highlighted:`reader = pipeline(<span class="hljs-string">&quot;question-answering&quot;</span>, model=model_checkpoint, revision=<span class="hljs-string">&quot;main&quot;</span>)

context = <span class="hljs-string">r&quot;&quot;&quot;
Extractive Question Answering is the task of extracting an answer from a text
given a question. An example of a question answering dataset is the SQuAD
dataset, which is entirely based on that task. If you would like to fine-tune a
model on a SQuAD task, you may leverage the
examples/pytorch/question-answering/run_squad.py script.

\u{1F917} Transformers is interoperable with the PyTorch, TensorFlow, and JAX
frameworks, so you can use your favourite tools for a wide variety of tasks!
&quot;&quot;&quot;</span>

question = <span class="hljs-string">&quot;What is extractive question answering?&quot;</span>
reader(question=question, context=context)`}}),He=new k({props:{code:`{'score': 0.38669535517692566,
 'start': 34,
 'end': 95,
 'answer': 'the task of extracting an answer from a text given a question'}`,highlighted:`{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.38669535517692566</span>,
 <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">34</span>,
 <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">95</span>,
 <span class="hljs-string">&#x27;answer&#x27;</span>: <span class="hljs-string">&#x27;the task of extracting an answer from a text given a question&#x27;</span>}`}}),Ne=new k({props:{code:`tokenizer = reader.tokenizer
model = reader.model`,highlighted:`tokenizer = reader.tokenizer
model = reader.model`}}),Qe=new k({props:{code:'question = "Which frameworks can I use?"',highlighted:'question = <span class="hljs-string">&quot;Which frameworks can I use?&quot;</span>'}}),Fe=new k({props:{code:`import torch

inputs = tokenizer(question, context, add_special_tokens=True)
input_ids = inputs["input_ids"][0]
outputs = model(**inputs)
answer_start_scores = outputs.start_logits
answer_end_scores = outputs.end_logits
# Get the most likely beginning of answer with the argmax of the score
answer_start = torch.argmax(answer_start_scores)
# Get the most likely end of answer with the argmax of the score
answer_end = torch.argmax(answer_end_scores) + 1
answer = tokenizer.convert_tokens_to_string(
    tokenizer.convert_ids_to_tokens(input_ids[answer_start:answer_end])
)
print(f"Question: {question}")
print(f"Answer: {answer}")`,highlighted:`<span class="hljs-keyword">import</span> torch

inputs = tokenizer(question, context, add_special_tokens=<span class="hljs-literal">True</span>)
input_ids = inputs[<span class="hljs-string">&quot;input_ids&quot;</span>][<span class="hljs-number">0</span>]
outputs = model(**inputs)
answer_start_scores = outputs.start_logits
answer_end_scores = outputs.end_logits
<span class="hljs-comment"># Get the most likely beginning of answer with the argmax of the score</span>
answer_start = torch.argmax(answer_start_scores)
<span class="hljs-comment"># Get the most likely end of answer with the argmax of the score</span>
answer_end = torch.argmax(answer_end_scores) + <span class="hljs-number">1</span>
answer = tokenizer.convert_tokens_to_string(
    tokenizer.convert_ids_to_tokens(input_ids[answer_start:answer_end])
)
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Question: <span class="hljs-subst">{question}</span>&quot;</span>)
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Answer: <span class="hljs-subst">{answer}</span>&quot;</span>)`}}),Re=new k({props:{code:`"""
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/var/folders/28/k4cy5q7s2hs92xq7_h89_vgm0000gn/T/ipykernel_75743/2725838073.py in <module>
      1 inputs = tokenizer(question, text, add_special_tokens=True)
      2 input_ids = inputs["input_ids"]
----> 3 outputs = model(**inputs)
      4 answer_start_scores = outputs.start_logits
      5 answer_end_scores = outputs.end_logits

~/miniconda3/envs/huggingface/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
   1049         if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
   1050                 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1051             return forward_call(*input, **kwargs)
   1052         # Do not call functions when jit is used
   1053         full_backward_hooks, non_full_backward_hooks = [], []

~/miniconda3/envs/huggingface/lib/python3.8/site-packages/transformers/models/distilbert/modeling_distilbert.py in forward(self, input_ids, attention_mask, head_mask, inputs_embeds, start_positions, end_positions, output_attentions, output_hidden_states, return_dict)
    723         return_dict = return_dict if return_dict is not None else self.config.use_return_dict
    724
--> 725         distilbert_output = self.distilbert(
    726             input_ids=input_ids,
    727             attention_mask=attention_mask,

~/miniconda3/envs/huggingface/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
   1049         if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
   1050                 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1051             return forward_call(*input, **kwargs)
   1052         # Do not call functions when jit is used
   1053         full_backward_hooks, non_full_backward_hooks = [], []

~/miniconda3/envs/huggingface/lib/python3.8/site-packages/transformers/models/distilbert/modeling_distilbert.py in forward(self, input_ids, attention_mask, head_mask, inputs_embeds, output_attentions, output_hidden_states, return_dict)
    471             raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
    472         elif input_ids is not None:
--> 473             input_shape = input_ids.size()
    474         elif inputs_embeds is not None:
    475             input_shape = inputs_embeds.size()[:-1]

AttributeError: 'list' object has no attribute 'size'
"""`,highlighted:`<span class="hljs-string">&quot;&quot;&quot;
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/var/folders/28/k4cy5q7s2hs92xq7_h89_vgm0000gn/T/ipykernel_75743/2725838073.py in &lt;module&gt;
      1 inputs = tokenizer(question, text, add_special_tokens=True)
      2 input_ids = inputs[&quot;input_ids&quot;]
----&gt; 3 outputs = model(**inputs)
      4 answer_start_scores = outputs.start_logits
      5 answer_end_scores = outputs.end_logits

~/miniconda3/envs/huggingface/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
   1049         if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
   1050                 or _global_forward_hooks or _global_forward_pre_hooks):
-&gt; 1051             return forward_call(*input, **kwargs)
   1052         # Do not call functions when jit is used
   1053         full_backward_hooks, non_full_backward_hooks = [], []

~/miniconda3/envs/huggingface/lib/python3.8/site-packages/transformers/models/distilbert/modeling_distilbert.py in forward(self, input_ids, attention_mask, head_mask, inputs_embeds, start_positions, end_positions, output_attentions, output_hidden_states, return_dict)
    723         return_dict = return_dict if return_dict is not None else self.config.use_return_dict
    724
--&gt; 725         distilbert_output = self.distilbert(
    726             input_ids=input_ids,
    727             attention_mask=attention_mask,

~/miniconda3/envs/huggingface/lib/python3.8/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
   1049         if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
   1050                 or _global_forward_hooks or _global_forward_pre_hooks):
-&gt; 1051             return forward_call(*input, **kwargs)
   1052         # Do not call functions when jit is used
   1053         full_backward_hooks, non_full_backward_hooks = [], []

~/miniconda3/envs/huggingface/lib/python3.8/site-packages/transformers/models/distilbert/modeling_distilbert.py in forward(self, input_ids, attention_mask, head_mask, inputs_embeds, output_attentions, output_hidden_states, return_dict)
    471             raise ValueError(&quot;You cannot specify both input_ids and inputs_embeds at the same time&quot;)
    472         elif input_ids is not None:
--&gt; 473             input_shape = input_ids.size()
    474         elif inputs_embeds is not None:
    475             input_shape = inputs_embeds.size()[:-1]

AttributeError: &#x27;list&#x27; object has no attribute &#x27;size&#x27;
&quot;&quot;&quot;</span>`}}),Le=new ni({props:{id:"rSPyvPw0p9k"}}),Ve=new ni({props:{id:"5PkZ4rbHL6c"}}),Je=new k({props:{code:'inputs["input_ids"][:5]',highlighted:'inputs[<span class="hljs-string">&quot;input_ids&quot;</span>][:<span class="hljs-number">5</span>]'}}),We=new k({props:{code:"[101, 2029, 7705, 2015, 2064]",highlighted:'[<span class="hljs-number">101</span>, <span class="hljs-number">2029</span>, <span class="hljs-number">7705</span>, <span class="hljs-number">2015</span>, <span class="hljs-number">2064</span>]'}}),Ye=new k({props:{code:'type(inputs["input_ids"])',highlighted:'<span class="hljs-built_in">type</span>(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>])'}}),Be=new k({props:{code:"list",highlighted:'<span class="hljs-built_in">list</span>'}}),Xe=new k({props:{code:`~/miniconda3/envs/huggingface/lib/python3.8/site-packages/transformers/models/distilbert/modeling_distilbert.py in forward(self, input_ids, attention_mask, head_mask, inputs_embeds, output_attentions, output_hidden_states, return_dict)
    471             raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
    472         elif input_ids is not None:
--> 473             input_shape = input_ids.size()
    474         elif inputs_embeds is not None:
    475             input_shape = inputs_embeds.size()[:-1]

AttributeError: 'list' object has no attribute 'size'`,highlighted:`~<span class="hljs-regexp">/miniconda3/</span>envs<span class="hljs-regexp">/huggingface/</span>lib<span class="hljs-regexp">/python3.8/</span>site-packages<span class="hljs-regexp">/transformers/m</span>odels<span class="hljs-regexp">/distilbert/m</span>odeling_distilbert.py in forward(self, input_ids, attention_mask, head_mask, inputs_embeds, output_attentions, output_hidden_states, return_dict)
    <span class="hljs-number">471</span>             raise ValueError(<span class="hljs-string">&quot;You cannot specify both input_ids and inputs_embeds at the same time&quot;</span>)
    <span class="hljs-number">472</span>         elif input_ids is not None:
--&gt; <span class="hljs-number">473</span>             input_shape = input_ids.<span class="hljs-keyword">size</span>()
    <span class="hljs-number">474</span>         elif inputs_embeds is not None:
    <span class="hljs-number">475</span>             input_shape = inputs_embeds.<span class="hljs-keyword">size</span>()[:-<span class="hljs-number">1</span>]

AttributeError: <span class="hljs-string">&#x27;list&#x27;</span> object has no attribute <span class="hljs-string">&#x27;size&#x27;</span>`}}),et=new k({props:{code:`inputs = tokenizer(question, context, add_special_tokens=True, return_tensors="pt")
input_ids = inputs["input_ids"][0]
outputs = model(**inputs)
answer_start_scores = outputs.start_logits
answer_end_scores = outputs.end_logits
# Get the most likely beginning of answer with the argmax of the score
answer_start = torch.argmax(answer_start_scores)
# Get the most likely end of answer with the argmax of the score
answer_end = torch.argmax(answer_end_scores) + 1
answer = tokenizer.convert_tokens_to_string(
    tokenizer.convert_ids_to_tokens(input_ids[answer_start:answer_end])
)
print(f"Question: {question}")
print(f"Answer: {answer}")`,highlighted:`inputs = tokenizer(question, context, add_special_tokens=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
input_ids = inputs[<span class="hljs-string">&quot;input_ids&quot;</span>][<span class="hljs-number">0</span>]
outputs = model(**inputs)
answer_start_scores = outputs.start_logits
answer_end_scores = outputs.end_logits
<span class="hljs-comment"># Get the most likely beginning of answer with the argmax of the score</span>
answer_start = torch.argmax(answer_start_scores)
<span class="hljs-comment"># Get the most likely end of answer with the argmax of the score</span>
answer_end = torch.argmax(answer_end_scores) + <span class="hljs-number">1</span>
answer = tokenizer.convert_tokens_to_string(
    tokenizer.convert_ids_to_tokens(input_ids[answer_start:answer_end])
)
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Question: <span class="hljs-subst">{question}</span>&quot;</span>)
<span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Answer: <span class="hljs-subst">{answer}</span>&quot;</span>)`}}),tt=new k({props:{code:`"""
Question: Which frameworks can I use?
Answer: pytorch, tensorflow, and jax
"""`,highlighted:`<span class="hljs-string">&quot;&quot;&quot;
Question: Which frameworks can I use?
Answer: pytorch, tensorflow, and jax
&quot;&quot;&quot;</span>`}}),{c(){d=a("meta"),E=u(),$=a("h1"),q=r("\u51FA\u73B0\u9519\u8BEF\u65F6\u8BE5\u600E\u4E48\u529E"),T=u(),c(v.$$.fragment),x=u(),P=a("p"),M=r("\u5728\u672C\u8282\u4E2D, \u6211\u4EEC\u5C06\u7814\u7A76\u5F53\u4F60\u5C1D\u8BD5\u4ECE\u65B0\u8C03\u6574\u7684 Transformer \u6A21\u578B\u751F\u6210\u9884\u6D4B\u65F6\u53EF\u80FD\u53D1\u751F\u7684\u4E00\u4E9B\u5E38\u89C1\u9519\u8BEF\u3002\u8FD9\u5C06\u4E3A "),G=a("a"),fe=r("\u7B2C\u56DB\u8282"),W=r(" \u505A\u51C6\u5907, \u6211\u4EEC\u5C06\u63A2\u7D22\u5982\u4F55\u8C03\u8BD5\u8BAD\u7EC3\u9636\u6BB5\u672C\u8EAB\u3002"),C=u(),c(N.$$.fragment),_e=u(),O=a("p"),Go=r("\u6211\u4EEC\u4E3A\u8FD9\u4E00\u8282\u51C6\u5907\u4E86\u4E00\u4E2A "),de=a("a"),No=r("\u6A21\u677F\u6A21\u578B\u5E93"),Qo=r(", \u5982\u679C\u4F60\u60F3\u8FD0\u884C\u672C\u7AE0\u4E2D\u7684\u4EE3\u7801, \u4F60\u9996\u5148\u9700\u8981\u5C06\u6A21\u578B\u590D\u5236\u5230\u4F60\u7684 "),ce=a("a"),Fo=r("Hugging Face Hub"),Ro=r(" \u8D26\u53F7\u3002\u4E3A\u6B64, \u9996\u5148\u901A\u8FC7\u5728 Jupyter \u7B14\u8BB0\u672C\u4E2D\u8FD0\u884C\u4EE5\u4E0B\u4EFB\u4E00\u547D\u4EE4\u6765\u767B\u5F55:"),_s=u(),c(me.$$.fragment),ds=u(),rt=a("p"),Lo=r("\u6216\u5728\u4F60\u6700\u559C\u6B22\u7684\u7EC8\u7AEF\u4E2D\u6267\u884C\u4EE5\u4E0B\u64CD\u4F5C:"),cs=u(),c(he.$$.fragment),ms=u(),X=a("p"),Vo=r("\u8FD9\u5C06\u63D0\u793A\u4F60\u8F93\u5165\u7528\u6237\u540D\u548C\u5BC6\u7801, \u5E76\u5C06\u5728\u4E0B\u9762\u4FDD\u5B58\u4E00\u4E2A\u4EE4\u724C "),jt=a("em"),Jo=r("~/.cache/huggingface/"),Wo=r("\u3002\u767B\u5F55\u540E, \u4F60\u53EF\u4EE5\u4F7F\u7528\u4EE5\u4E0B\u529F\u80FD\u590D\u5236\u6A21\u677F\u5B58\u50A8\u5E93:"),hs=u(),c(be.$$.fragment),bs=u(),U=a("p"),Yo=r("\u73B0\u5728, \u5F53\u4F60\u8C03\u7528 "),xt=a("code"),Bo=r("copy_repository_template()"),Xo=r(" \u65F6, \u5B83\u5C06\u5728\u4F60\u7684\u5E10\u6237\u4E0B\u521B\u5EFA\u6A21\u677F\u5B58\u50A8\u5E93\u7684\u526F\u672C\u3002"),gs=u(),Y=a("h2"),K=a("a"),Pt=a("span"),c(ge.$$.fragment),Uo=u(),Ct=a("span"),Ko=r("\u4ECE \u{1F917} Transformers \u8C03\u8BD5\u7BA1\u9053"),ws=u(),nt=a("p"),Zo=r("\u8981\u5F00\u59CB\u6211\u4EEC\u8C03\u8BD5 Transformer \u6A21\u578B\u7684\u5947\u5999\u4E16\u754C\u4E4B\u65C5, \u8BF7\u8003\u8651\u4EE5\u4E0B\u573A\u666F: \u4F60\u6B63\u5728\u4E0E\u4E00\u4F4D\u540C\u4E8B\u5408\u4F5C\u8FDB\u884C\u95EE\u7B54\u9879\u76EE, \u4EE5\u5E2E\u52A9\u7535\u5B50\u5546\u52A1\u7F51\u7AD9\u7684\u5BA2\u6237\u627E\u5230\u6709\u5173\u6D88\u8D39\u54C1\u7684\u7B54\u6848\u3002\u4F60\u7684\u540C\u4E8B\u7ED9\u4F60\u53D1\u4E86\u4E00\u6761\u6D88\u606F, \u6BD4\u5982:"),$s=u(),it=a("blockquote"),we=a("p"),er=r("\u55E8! \u6211\u521A\u521A\u4F7F\u7528\u4E86\u62B1\u62B1\u8138\u8BFE\u7A0B\u7684 "),at=a("a"),tr=r("\u7B2C\u4E03\u7AE0"),sr=r(" \u4E2D\u7684\u6280\u672F\u8FDB\u884C\u4E86\u4E00\u4E2A\u5B9E\u9A8C, \u5E76\u5728 SQuAD \u4E0A\u83B7\u5F97\u4E86\u4E00\u4E9B\u5F88\u68D2\u7684\u7ED3\u679C! \u6211\u8BA4\u4E3A\u6211\u4EEC\u53EF\u4EE5\u7528\u8FD9\u4E2A\u6A21\u578B\u4F5C\u4E3A\u6211\u4EEC\u9879\u76EE\u7684\u8D77\u70B9\u3002Hub\u4E0A\u7684\u6A21\u578BID\u662F \u201Clewtun/distillbert-base-uncased-finetuned-squad-d5716d28\u201D\u3002\u8BF7\u968F\u610F\u6D4B\u8BD5\u4E00\u4E0B :)"),ks=u(),Z=a("p"),or=r("\u4F60\u9996\u5148\u60F3\u5230\u7684\u662F\u4F7F\u7528 \u{1F917} Transformers \u4E2D\u7684 "),Dt=a("code"),rr=r("\u7BA1\u9053"),nr=r(":"),vs=u(),c($e.$$.fragment),Es=u(),c(ke.$$.fragment),qs=u(),Q=a("p"),ir=r("\u54E6\u4E0D\u5BF9, \u597D\u50CF\u51FA\u4E86\u4EC0\u4E48\u95EE\u9898! \u5982\u679C\u4F60\u662F\u7F16\u7A0B\u65B0\u624B, \u8FD9\u4E9B\u7C7B\u578B\u7684\u9519\u8BEF\u4E00\u5F00\u59CB\u770B\u8D77\u6765\u6709\u70B9\u795E\u79D8 (\u751A\u81F3\u662F\u4E00\u4E2A "),At=a("code"),ar=r("OSError"),lr=r("?!)\u3002\u8FD9\u91CC\u663E\u793A\u7684\u9519\u8BEF\u53EA\u662F\u4E00\u4E2A\u66F4\u5927\u7684\u9519\u8BEF\u62A5\u544A\u7684\u6700\u540E\u4E00\u90E8\u5206, \u79F0\u4E3A "),Ot=a("em"),pr=r("Python traceback"),ur=r(" (\u53C8\u540D\u5806\u6808\u8DDF\u8E2A)\u3002\u4F8B\u5982, \u5982\u679C\u4F60\u5728 Google Colab \u4E0A\u8FD0\u884C\u6B64\u4EE3\u7801, \u4F60\u5E94\u8BE5\u4F1A\u770B\u5230\u7C7B\u4F3C\u4E8E\u4EE5\u4E0B\u5C4F\u5E55\u622A\u56FE\u7684\u5185\u5BB9:"),ys=u(),ve=a("div"),Ee=a("img"),js=u(),D=a("p"),fr=r("\u8FD9\u4E9B\u62A5\u544A\u4E2D\u5305\u542B\u5F88\u591A\u4FE1\u606F, \u6240\u4EE5\u8BA9\u6211\u4EEC\u4E00\u8D77\u6765\u770B\u770B\u5173\u952E\u90E8\u5206\u3002\u9996\u5148\u8981\u6CE8\u610F\u7684\u662F, \u5E94\u8BE5\u4ECE "),Tt=a("em"),_r=r("\u4ECE\u5E95\u90E8\u5230\u9876\u90E8"),dr=r(" \u8BFB\u53D6\u56DE\u6EAF\u3002\u5982\u679C\u4F60\u4E60\u60EF\u4E8E\u4ECE\u4E0A\u5230\u4E0B\u9605\u8BFB\u82F1\u6587\u6587\u672C, \u8FD9\u53EF\u80FD\u542C\u8D77\u6765\u5F88\u5947\u602A,\u4F46\u5B83\u53CD\u6620\u4E86\u8FD9\u6837\u4E00\u4E2A\u4E8B\u5B9E,\u5373\u56DE\u6EAF\u663E\u793A\u4E86\u5728\u4E0B\u8F7D\u6A21\u578B\u548C\u6807\u8BB0\u5668\u65F6 "),zt=a("code"),cr=r("\u7BA1\u9053"),mr=r(" \u8FDB\u884C\u7684\u51FD\u6570\u8C03\u7528\u5E8F\u5217\u3002(\u67E5\u770B "),lt=a("a"),hr=r("\u7B2C\u4E8C\u7AE0"),br=r(" \u4E86\u89E3\u6709\u5173 "),St=a("code"),gr=r("pipeline"),wr=r(" \u5982\u4F55\u5728\u540E\u53F0\u5DE5\u4F5C\u7684\u66F4\u591A\u8BE6\u7EC6\u4FE1\u606F\u3002)"),xs=u(),c(ee.$$.fragment),Ps=u(),F=a("p"),$r=r("\u8FD9\u610F\u5473\u7740\u56DE\u6EAF\u7684\u6700\u540E\u4E00\u884C\u6307\u793A\u6700\u540E\u4E00\u6761\u9519\u8BEF\u6D88\u606F\u5E76\u7ED9\u51FA\u5F15\u53D1\u7684\u5F02\u5E38\u7684\u540D\u79F0\u3002\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B, \u5F02\u5E38\u7C7B\u578B\u662F"),It=a("code"),kr=r("OSError"),vr=r(", \u8868\u793A\u4E0E\u7CFB\u7EDF\u76F8\u5173\u7684\u9519\u8BEF\u3002\u5982\u679C\u6211\u4EEC\u9605\u8BFB\u968F\u9644\u7684\u9519\u8BEF\u6D88\u606F, \u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u6A21\u578B\u7684 "),Ht=a("em"),Er=r("config.json"),qr=r(" \u6587\u4EF6\u4F3C\u4E4E\u6709\u95EE\u9898, \u6211\u4EEC\u7ED9\u51FA\u4E86\u4E24\u4E2A\u4FEE\u590D\u5B83\u7684\u5EFA\u8BAE:"),Cs=u(),c(qe.$$.fragment),Ds=u(),c(te.$$.fragment),As=u(),pt=a("p"),yr=r("\u7B2C\u4E00\u4E2A\u5EFA\u8BAE\u662F\u8981\u6C42\u6211\u4EEC\u68C0\u67E5\u6A21\u578BID\u662F\u5426\u771F\u7684\u6B63\u786E, \u6240\u4EE5\u9996\u5148\u8981\u505A\u7684\u5C31\u662F\u590D\u5236\u6807\u8BC6\u7B26\u5E76\u5C06\u5176\u7C98\u8D34\u5230Hub\u7684\u641C\u7D22\u680F\u4E2D:"),Os=u(),ye=a("div"),je=a("img"),Ts=u(),ut=a("p"),jr=r("\u55EF, \u770B\u8D77\u6765\u6211\u4EEC\u540C\u4E8B\u7684\u6A21\u578B\u786E\u5B9E\u4E0D\u5728 Hub \u4E0A\u2026 \u554A\u54C8, \u4F46\u662F\u6A21\u578B\u540D\u79F0\u4E2D\u6709\u4E00\u4E2A\u9519\u5B57! DistilBERT \u7684\u540D\u79F0\u4E2D\u53EA\u6709\u4E00\u4E2A \u201Cl\u201D, \u6240\u4EE5\u8BA9\u6211\u4EEC\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\u5E76\u5BFB\u627E \u201Clewtun/distilbert-base-uncased-finetuned-squad-d5716d28\u201D:"),zs=u(),xe=a("div"),Pe=a("img"),Ss=u(),ft=a("p"),xr=r("\u597D\u7684, \u8FD9\u5F88\u53D7\u6B22\u8FCE\u3002\u73B0\u5728\u8BA9\u6211\u4EEC\u5C1D\u8BD5\u4F7F\u7528\u6B63\u786E\u7684\u6A21\u578B ID \u518D\u6B21\u4E0B\u8F7D\u6A21\u578B:"),Is=u(),c(Ce.$$.fragment),Hs=u(),c(De.$$.fragment),Ms=u(),R=a("p"),Pr=r("\u554A, \u518D\u6B21\u632B\u8D25 \u2014 \u6B22\u8FCE\u6765\u5230\u673A\u5668\u5B66\u4E60\u5DE5\u7A0B\u5E08\u7684\u65E5\u5E38\u751F\u6D3B! \u56E0\u4E3A\u6211\u4EEC\u5DF2\u7ECF\u4FEE\u590D\u4E86\u6A21\u578B ID, \u6240\u4EE5\u95EE\u9898\u4E00\u5B9A\u51FA\u5728\u5B58\u50A8\u5E93\u672C\u8EAB\u3002\u8BBF\u95EE \u{1F917} Hub \u4E0A\u5B58\u50A8\u5E93\u5185\u5BB9\u7684\u4E00\u79CD\u5FEB\u901F\u65B9\u6CD5\u662F\u901A\u8FC7 "),Mt=a("code"),Cr=r("huggingface_hub"),Dr=r(" \u5E93\u7684 "),Gt=a("code"),Ar=r("list_repo_files()"),Or=r(" \u65B9\u6CD5:"),Gs=u(),c(Ae.$$.fragment),Ns=u(),c(Oe.$$.fragment),Qs=u(),y=a("p"),Tr=r("\u6709\u8DA3 \u2014 \u4F3C\u4E4E\u6CA1\u6709\u914D\u7F6E\u6587\u4EF6\u5B58\u50A8\u5E93\u4E2D\u7684 "),Nt=a("em"),zr=r("config.json"),Sr=r(" \u6587\u4EF6! \u96BE\u602A\u6211\u4EEC\u7684 "),Qt=a("code"),Ir=r("pipeline"),Hr=r(" \u65E0\u6CD5\u52A0\u8F7D\u6A21\u578B; \u6211\u4EEC\u7684\u540C\u4E8B\u4E00\u5B9A\u662F\u5728\u5FAE\u8C03\u540E\u5FD8\u8BB0\u5C06\u8FD9\u4E2A\u6587\u4EF6\u63A8\u9001\u5230 Hub\u3002\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B, \u95EE\u9898\u4F3C\u4E4E\u5F88\u5BB9\u6613\u89E3\u51B3: \u6211\u4EEC\u53EF\u4EE5\u8981\u6C42\u4ED6\u4EEC\u6DFB\u52A0\u6587\u4EF6, \u6216\u8005, \u56E0\u4E3A\u6211\u4EEC\u53EF\u4EE5\u4ECE\u6A21\u578B ID \u4E2D\u770B\u5230\u4F7F\u7528\u7684\u9884\u8BAD\u7EC3\u6A21\u578B\u662F "),Te=a("a"),Ft=a("code"),Mr=r("distilbert-base-uncased"),Gr=r(", \u6211\u4EEC\u53EF\u4EE5\u4E0B\u8F7D\u6B64\u6A21\u578B\u7684\u914D\u7F6E\u5E76\u5C06\u5176\u63A8\u9001\u5230\u6211\u4EEC\u7684\u5B58\u50A8\u5E93\u4EE5\u67E5\u770B\u662F\u5426\u53EF\u4EE5\u89E3\u51B3\u95EE\u9898\u3002\u8BA9\u6211\u4EEC\u8BD5\u8BD5\u770B\u3002\u4F7F\u7528\u6211\u4EEC\u5728 "),_t=a("a"),Nr=r("\u7B2C\u4E8C\u7AE0"),Qr=r(" \u4E2D\u5B66\u4E60\u7684\u6280\u672F, \u6211\u4EEC\u4F7F\u7528 "),Rt=a("code"),Fr=r("AutoConfig"),Rr=r(" \u7C7B\u4E0B\u8F7D\u6A21\u578B\u7684\u914D\u7F6E:"),Fs=u(),c(ze.$$.fragment),Rs=u(),c(se.$$.fragment),Ls=u(),oe=a("p"),Lr=r("\u7136\u540E\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u914D\u7F6E\u7684 "),Lt=a("code"),Vr=r("push_to_hub()"),Jr=r(" \u65B9\u6CD5\u5C06\u5176\u63A8\u9001\u5230\u6211\u4EEC\u7684\u6A21\u578B\u5B58\u50A8\u5E93:"),Vs=u(),c(Se.$$.fragment),Js=u(),re=a("p"),Wr=r("\u73B0\u5728\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7\u4ECE\u6700\u65B0\u63D0\u4EA4\u7684 "),Vt=a("code"),Yr=r("main"),Br=r(" \u5206\u652F\u4E2D\u52A0\u8F7D\u6A21\u578B\u6765\u6D4B\u8BD5\u8FD9\u662F\u5426\u6709\u6548:"),Ws=u(),c(Ie.$$.fragment),Ys=u(),c(He.$$.fragment),Bs=u(),dt=a("p"),Xr=r("\u54C7\u54E6, \u6210\u529F\u4E86!\u8BA9\u6211\u4EEC\u56DE\u987E\u4E00\u4E0B\u4F60\u521A\u521A\u5B66\u5230\u7684\u4E1C\u897F:"),Xs=u(),z=a("ul"),Me=a("li"),Ur=r("Python \u4E2D\u7684\u9519\u8BEF\u6D88\u606F\u79F0\u4E3A "),Jt=a("em"),Kr=r("tracebacks"),Zr=r(" , \u5E76\u4ECE\u4E0B\u5230\u4E0A\u9605\u8BFB\u3002\u9519\u8BEF\u6D88\u606F\u7684\u6700\u540E\u4E00\u884C\u901A\u5E38\u5305\u542B\u5B9A\u4F4D\u95EE\u9898\u6839\u6E90\u6240\u9700\u7684\u4FE1\u606F\u3002"),en=u(),Wt=a("li"),tn=r("\u5982\u679C\u6700\u540E\u4E00\u884C\u6CA1\u6709\u5305\u542B\u8DB3\u591F\u7684\u4FE1\u606F, \u8BF7\u6309\u7167\u60A8\u7684\u65B9\u5F0F\u8FDB\u884C\u56DE\u6EAF, \u770B\u770B\u60A8\u662F\u5426\u53EF\u4EE5\u786E\u5B9A\u6E90\u4EE3\u7801\u4E2D\u53D1\u751F\u9519\u8BEF\u7684\u4F4D\u7F6E\u3002"),sn=u(),Yt=a("li"),on=r("\u5982\u679C\u6CA1\u6709\u4EFB\u4F55\u9519\u8BEF\u6D88\u606F\u53EF\u4EE5\u5E2E\u52A9\u60A8\u8C03\u8BD5\u95EE\u9898, \u8BF7\u5C1D\u8BD5\u5728\u7EBF\u641C\u7D22\u7C7B\u4F3C\u95EE\u9898\u7684\u89E3\u51B3\u65B9\u6848\u3002"),rn=u(),ct=a("li"),Bt=a("code"),nn=r("huggingface_hub"),an=r(`
// \u{1F917} Hub?
\u5E93\u63D0\u4F9B\u4E86\u4E00\u5957\u5DE5\u5177, \u4F60\u53EF\u4EE5\u4F7F\u7528\u8FD9\u4E9B\u5DE5\u5177\u4E0E Hub \u4E0A\u7684\u5B58\u50A8\u5E93\u8FDB\u884C\u4EA4\u4E92\u548C\u8C03\u8BD5\u3002`),Us=u(),mt=a("p"),ln=r("\u73B0\u5728\u4F60\u77E5\u9053\u5982\u4F55\u8C03\u8BD5\u7BA1\u9053, \u8BA9\u6211\u4EEC\u770B\u4E00\u4E0B\u6A21\u578B\u672C\u8EAB\u524D\u5411\u4F20\u9012\u4E2D\u7684\u4E00\u4E2A\u66F4\u68D8\u624B\u7684\u793A\u4F8B\u3002"),Ks=u(),Ge=a("h2"),pn=r("\u8C03\u8BD5\u6A21\u578B\u7684\u524D\u5411\u4F20\u9012"),Zs=u(),L=a("p"),un=r("\u5C3D\u7BA1 "),Xt=a("code"),fn=r("pipeline"),_n=r(" \u5BF9\u4E8E\u5927\u591A\u6570\u9700\u8981\u5FEB\u901F\u751F\u6210\u9884\u6D4B\u7684\u5E94\u7528\u7A0B\u5E8F\u6765\u8BF4\u975E\u5E38\u6709\u7528, \u6709\u65F6\u60A8\u9700\u8981\u8BBF\u95EE\u6A21\u578B\u7684 logits (\u4F8B\u5982, \u5982\u679C\u60A8\u6709\u4E00\u4E9B\u60F3\u8981\u5E94\u7528\u7684\u81EA\u5B9A\u4E49\u540E\u5904\u7406)\u3002\u4E3A\u4E86\u770B\u770B\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\u4F1A\u51FA\u73B0\u4EC0\u4E48\u95EE\u9898, \u8BA9\u6211\u4EEC\u9996\u5148\u4ECE "),Ut=a("code"),dn=r("pipeline"),cn=r(" \u4E2D\u83B7\u53D6\u6A21\u578B\u548C\u6807\u8BB0\u5668:"),eo=u(),c(Ne.$$.fragment),to=u(),ht=a("p"),mn=r("\u63A5\u4E0B\u6765\u6211\u4EEC\u9700\u8981\u4E00\u4E2A\u95EE\u9898, \u90A3\u4E48\u8BA9\u6211\u4EEC\u770B\u770B\u662F\u5426\u652F\u6301\u6211\u4EEC\u6700\u559C\u6B22\u7684\u6846\u67B6:"),so=u(),c(Qe.$$.fragment),oo=u(),ne=a("p"),hn=r("\u6B63\u5982\u6211\u4EEC\u5728 "),bt=a("a"),bn=r("\u7B2C\u4E03\u7AE0"),gn=r(" \u4E2D\u5B66\u4E60\u7684, \u6211\u4EEC\u9700\u8981\u91C7\u53D6\u7684\u901A\u5E38\u6B65\u9AA4\u662F\u5BF9\u8F93\u5165\u8FDB\u884C\u6807\u8BB0\u5316, \u63D0\u53D6\u5F00\u59CB\u548C\u7ED3\u675F\u6807\u8BB0\u7684\u5BF9\u6570, \u7136\u540E\u89E3\u7801\u7B54\u6848\u8303\u56F4:"),ro=u(),c(Fe.$$.fragment),no=u(),c(Re.$$.fragment),io=u(),gt=a("p"),wn=r("\u5662, \u770B\u8D77\u6765\u6211\u4EEC\u7684\u4EE3\u7801\u4E2D\u6709\u4E00\u4E2A\u9519\u8BEF!\u4F46\u6211\u4EEC\u4E0D\u6015\u4E00\u70B9\u8C03\u8BD5\u3002\u60A8\u53EF\u4EE5\u5728\u7B14\u8BB0\u672C\u4E2D\u4F7F\u7528 Python \u8C03\u8BD5\u5668:"),ao=u(),c(Le.$$.fragment),lo=u(),wt=a("p"),$n=r("\u6216\u5728\u7EC8\u7AEF\u4E2D:"),po=u(),c(Ve.$$.fragment),uo=u(),A=a("p"),kn=r("\u5728\u8FD9\u91CC, \u9605\u8BFB\u9519\u8BEF\u6D88\u606F\u544A\u8BC9\u6211\u4EEC "),Kt=a("code"),vn=r("'list' object has no attribute 'size'"),En=r(", \u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u4E00\u4E2A "),Zt=a("code"),qn=r("-->"),yn=r(" \u7BAD\u5934\u6307\u5411 "),es=a("code"),jn=r("model(**inputs)"),xn=r(" \u4E2D\u51FA\u73B0\u95EE\u9898\u7684\u884C\u3002\u4F60\u53EF\u4EE5\u4F7F\u7528 Python \u8C03\u8BD5\u5668\u4EE5\u4EA4\u4E92\u65B9\u5F0F\u8C03\u8BD5\u5B83, \u4F46\u73B0\u5728\u6211\u4EEC\u53EA\u9700\u6253\u5370\u51FA\u4E00\u90E8\u5206 "),ts=a("code"),Pn=r("inputs"),Cn=r(", \u770B\u770B\u6211\u4EEC\u6709\u4EC0\u4E48:"),fo=u(),c(Je.$$.fragment),_o=u(),c(We.$$.fragment),co=u(),ie=a("p"),Dn=r("\u8FD9\u5F53\u7136\u770B\u8D77\u6765\u50CF\u4E00\u4E2A\u666E\u901A\u7684 Python "),ss=a("code"),An=r("list"),On=r(", \u4F46\u8BA9\u6211\u4EEC\u4ED4\u7EC6\u68C0\u67E5\u4E00\u4E0B\u7C7B\u578B:"),mo=u(),c(Ye.$$.fragment),ho=u(),c(Be.$$.fragment),bo=u(),j=a("p"),Tn=r("\u662F\u7684, \u8FD9\u80AF\u5B9A\u662F\u4E00\u4E2A Python "),os=a("code"),zn=r("list"),Sn=r("\u3002\u90A3\u4E48\u51FA\u4E86\u4EC0\u4E48\u95EE\u9898\u5462? \u56DE\u5FC6 "),$t=a("a"),In=r("\u7B2C\u4E8C\u7AE0"),Hn=r(" \u{1F917} Transformers \u4E2D\u7684 "),rs=a("code"),Mn=r("AutoModelForXxx"),Gn=r(" \u7C7B\u5728 "),ns=a("em"),Nn=r("tensors"),Qn=r(" \u4E0A\u8FD0\u884C(PyTorch\u6216\u8005or TensorFlow), \u4E00\u4E2A\u5E38\u89C1\u7684\u64CD\u4F5C\u662F\u4F7F\u7528 "),is=a("code"),Fn=r("Tensor.size()"),Rn=r(" \u65B9\u6CD5\u63D0\u53D6\u5F20\u91CF\u7684\u7EF4\u5EA6, \u4F8B\u5982, \u5728 PyTorch \u4E2D\u3002\u8BA9\u6211\u4EEC\u518D\u770B\u770B\u56DE\u6EAF, \u770B\u770B\u54EA\u4E00\u884C\u89E6\u53D1\u4E86\u5F02\u5E38:"),go=u(),c(Xe.$$.fragment),wo=u(),S=a("p"),Ln=r("\u770B\u8D77\u6765\u6211\u4EEC\u7684\u4EE3\u7801\u8BD5\u56FE\u8C03\u7528 "),as=a("code"),Vn=r("input_ids.size()"),Jn=r(", \u4F46\u8FD9\u663E\u7136\u4E0D\u9002\u7528\u4E8E Python "),ls=a("code"),Wn=r("list"),Yn=r(", \u8FD9\u53EA\u662F\u4E00\u4E2A\u5BB9\u5668\u3002\u6211\u4EEC\u5982\u4F55\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898? \u5728 Stack Overflow \u4E0A\u641C\u7D22\u9519\u8BEF\u6D88\u606F\u7ED9\u51FA\u4E86\u5F88\u591A\u76F8\u5173\u7684 "),Ue=a("a"),Bn=r("hits"),Xn=r("\u3002\u5355\u51FB\u7B2C\u4E00\u4E2A\u4F1A\u663E\u793A\u4E0E\u6211\u4EEC\u7C7B\u4F3C\u7684\u95EE\u9898, \u7B54\u6848\u5982\u4E0B\u9762\u7684\u5C4F\u5E55\u622A\u56FE\u6240\u793A:"),$o=u(),Ke=a("div"),Ze=a("img"),ko=u(),ae=a("p"),Un=r("\u7B54\u6848\u5EFA\u8BAE\u6211\u4EEC\u6DFB\u52A0 "),ps=a("code"),Kn=r("return_tensors='pt'"),Zn=r(" \u5230\u6807\u8BB0\u5668, \u6240\u4EE5\u8BA9\u6211\u4EEC\u770B\u770B\u8FD9\u662F\u5426\u9002\u5408\u6211\u4EEC:"),vo=u(),c(et.$$.fragment),Eo=u(),c(tt.$$.fragment),qo=u(),le=a("p"),ei=r("\u4E0D\u9519, \u6210\u529F\u4E86! \u8FD9\u662F Stack Overflow \u975E\u5E38\u6709\u7528\u7684\u4E00\u4E2A\u5F88\u597D\u7684\u4F8B\u5B50: \u901A\u8FC7\u8BC6\u522B\u7C7B\u4F3C\u7684\u95EE\u9898, \u6211\u4EEC\u80FD\u591F\u4ECE\u793E\u533A\u4E2D\u5176\u4ED6\u4EBA\u7684\u7ECF\u9A8C\u4E2D\u53D7\u76CA\u3002\u7136\u800C, \u50CF\u8FD9\u6837\u7684\u641C\u7D22\u5E76\u4E0D\u603B\u662F\u4F1A\u4EA7\u751F\u76F8\u5173\u7684\u7B54\u6848, \u90A3\u4E48\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\u4F60\u80FD\u505A\u4EC0\u4E48\u5462? \u5E78\u8FD0\u7684\u662F, \u6709\u4E00\u4E2A\u53D7\u6B22\u8FCE\u7684\u5F00\u53D1\u8005\u793E\u533A "),st=a("a"),ti=r("Hugging Face forums"),si=r(" \u53EF\u4EE5\u5E2E\u52A9\u4F60! \u5728\u4E0B\u4E00\u8282\u4E2D, \u6211\u4EEC\u5C06\u770B\u770B\u5982\u4F55\u8BBE\u8BA1\u53EF\u80FD\u5F97\u5230\u56DE\u7B54\u7684\u4F18\u79C0\u8BBA\u575B\u95EE\u9898\u3002"),this.h()},l(e){const o=qa('[data-svelte="svelte-1phssyn"]',document.head);d=l(o,"META",{name:!0,content:!0}),o.forEach(t),E=f(e),$=l(e,"H1",{id:!0});var us=p($);q=n(us,"\u51FA\u73B0\u9519\u8BEF\u65F6\u8BE5\u600E\u4E48\u529E"),us.forEach(t),T=f(e),m(v.$$.fragment,e),x=f(e),P=l(e,"P",{});var ot=p(P);M=n(ot,"\u5728\u672C\u8282\u4E2D, \u6211\u4EEC\u5C06\u7814\u7A76\u5F53\u4F60\u5C1D\u8BD5\u4ECE\u65B0\u8C03\u6574\u7684 Transformer \u6A21\u578B\u751F\u6210\u9884\u6D4B\u65F6\u53EF\u80FD\u53D1\u751F\u7684\u4E00\u4E9B\u5E38\u89C1\u9519\u8BEF\u3002\u8FD9\u5C06\u4E3A "),G=l(ot,"A",{href:!0});var fs=p(G);fe=n(fs,"\u7B2C\u56DB\u8282"),fs.forEach(t),W=n(ot," \u505A\u51C6\u5907, \u6211\u4EEC\u5C06\u63A2\u7D22\u5982\u4F55\u8C03\u8BD5\u8BAD\u7EC3\u9636\u6BB5\u672C\u8EAB\u3002"),ot.forEach(t),C=f(e),m(N.$$.fragment,e),_e=f(e),O=l(e,"P",{});var kt=p(O);Go=n(kt,"\u6211\u4EEC\u4E3A\u8FD9\u4E00\u8282\u51C6\u5907\u4E86\u4E00\u4E2A "),de=l(kt,"A",{href:!0,rel:!0});var ui=p(de);No=n(ui,"\u6A21\u677F\u6A21\u578B\u5E93"),ui.forEach(t),Qo=n(kt,", \u5982\u679C\u4F60\u60F3\u8FD0\u884C\u672C\u7AE0\u4E2D\u7684\u4EE3\u7801, \u4F60\u9996\u5148\u9700\u8981\u5C06\u6A21\u578B\u590D\u5236\u5230\u4F60\u7684 "),ce=l(kt,"A",{href:!0,rel:!0});var fi=p(ce);Fo=n(fi,"Hugging Face Hub"),fi.forEach(t),Ro=n(kt," \u8D26\u53F7\u3002\u4E3A\u6B64, \u9996\u5148\u901A\u8FC7\u5728 Jupyter \u7B14\u8BB0\u672C\u4E2D\u8FD0\u884C\u4EE5\u4E0B\u4EFB\u4E00\u547D\u4EE4\u6765\u767B\u5F55:"),kt.forEach(t),_s=f(e),m(me.$$.fragment,e),ds=f(e),rt=l(e,"P",{});var _i=p(rt);Lo=n(_i,"\u6216\u5728\u4F60\u6700\u559C\u6B22\u7684\u7EC8\u7AEF\u4E2D\u6267\u884C\u4EE5\u4E0B\u64CD\u4F5C:"),_i.forEach(t),cs=f(e),m(he.$$.fragment,e),ms=f(e),X=l(e,"P",{});var jo=p(X);Vo=n(jo,"\u8FD9\u5C06\u63D0\u793A\u4F60\u8F93\u5165\u7528\u6237\u540D\u548C\u5BC6\u7801, \u5E76\u5C06\u5728\u4E0B\u9762\u4FDD\u5B58\u4E00\u4E2A\u4EE4\u724C "),jt=l(jo,"EM",{});var di=p(jt);Jo=n(di,"~/.cache/huggingface/"),di.forEach(t),Wo=n(jo,"\u3002\u767B\u5F55\u540E, \u4F60\u53EF\u4EE5\u4F7F\u7528\u4EE5\u4E0B\u529F\u80FD\u590D\u5236\u6A21\u677F\u5B58\u50A8\u5E93:"),jo.forEach(t),hs=f(e),m(be.$$.fragment,e),bs=f(e),U=l(e,"P",{});var xo=p(U);Yo=n(xo,"\u73B0\u5728, \u5F53\u4F60\u8C03\u7528 "),xt=l(xo,"CODE",{});var ci=p(xt);Bo=n(ci,"copy_repository_template()"),ci.forEach(t),Xo=n(xo," \u65F6, \u5B83\u5C06\u5728\u4F60\u7684\u5E10\u6237\u4E0B\u521B\u5EFA\u6A21\u677F\u5B58\u50A8\u5E93\u7684\u526F\u672C\u3002"),xo.forEach(t),gs=f(e),Y=l(e,"H2",{class:!0});var Po=p(Y);K=l(Po,"A",{id:!0,class:!0,href:!0});var mi=p(K);Pt=l(mi,"SPAN",{});var hi=p(Pt);m(ge.$$.fragment,hi),hi.forEach(t),mi.forEach(t),Uo=f(Po),Ct=l(Po,"SPAN",{});var bi=p(Ct);Ko=n(bi,"\u4ECE \u{1F917} Transformers \u8C03\u8BD5\u7BA1\u9053"),bi.forEach(t),Po.forEach(t),ws=f(e),nt=l(e,"P",{});var gi=p(nt);Zo=n(gi,"\u8981\u5F00\u59CB\u6211\u4EEC\u8C03\u8BD5 Transformer \u6A21\u578B\u7684\u5947\u5999\u4E16\u754C\u4E4B\u65C5, \u8BF7\u8003\u8651\u4EE5\u4E0B\u573A\u666F: \u4F60\u6B63\u5728\u4E0E\u4E00\u4F4D\u540C\u4E8B\u5408\u4F5C\u8FDB\u884C\u95EE\u7B54\u9879\u76EE, \u4EE5\u5E2E\u52A9\u7535\u5B50\u5546\u52A1\u7F51\u7AD9\u7684\u5BA2\u6237\u627E\u5230\u6709\u5173\u6D88\u8D39\u54C1\u7684\u7B54\u6848\u3002\u4F60\u7684\u540C\u4E8B\u7ED9\u4F60\u53D1\u4E86\u4E00\u6761\u6D88\u606F, \u6BD4\u5982:"),gi.forEach(t),$s=f(e),it=l(e,"BLOCKQUOTE",{});var wi=p(it);we=l(wi,"P",{});var Co=p(we);er=n(Co,"\u55E8! \u6211\u521A\u521A\u4F7F\u7528\u4E86\u62B1\u62B1\u8138\u8BFE\u7A0B\u7684 "),at=l(Co,"A",{href:!0});var $i=p(at);tr=n($i,"\u7B2C\u4E03\u7AE0"),$i.forEach(t),sr=n(Co," \u4E2D\u7684\u6280\u672F\u8FDB\u884C\u4E86\u4E00\u4E2A\u5B9E\u9A8C, \u5E76\u5728 SQuAD \u4E0A\u83B7\u5F97\u4E86\u4E00\u4E9B\u5F88\u68D2\u7684\u7ED3\u679C! \u6211\u8BA4\u4E3A\u6211\u4EEC\u53EF\u4EE5\u7528\u8FD9\u4E2A\u6A21\u578B\u4F5C\u4E3A\u6211\u4EEC\u9879\u76EE\u7684\u8D77\u70B9\u3002Hub\u4E0A\u7684\u6A21\u578BID\u662F \u201Clewtun/distillbert-base-uncased-finetuned-squad-d5716d28\u201D\u3002\u8BF7\u968F\u610F\u6D4B\u8BD5\u4E00\u4E0B :)"),Co.forEach(t),wi.forEach(t),ks=f(e),Z=l(e,"P",{});var Do=p(Z);or=n(Do,"\u4F60\u9996\u5148\u60F3\u5230\u7684\u662F\u4F7F\u7528 \u{1F917} Transformers \u4E2D\u7684 "),Dt=l(Do,"CODE",{});var ki=p(Dt);rr=n(ki,"\u7BA1\u9053"),ki.forEach(t),nr=n(Do,":"),Do.forEach(t),vs=f(e),m($e.$$.fragment,e),Es=f(e),m(ke.$$.fragment,e),qs=f(e),Q=l(e,"P",{});var vt=p(Q);ir=n(vt,"\u54E6\u4E0D\u5BF9, \u597D\u50CF\u51FA\u4E86\u4EC0\u4E48\u95EE\u9898! \u5982\u679C\u4F60\u662F\u7F16\u7A0B\u65B0\u624B, \u8FD9\u4E9B\u7C7B\u578B\u7684\u9519\u8BEF\u4E00\u5F00\u59CB\u770B\u8D77\u6765\u6709\u70B9\u795E\u79D8 (\u751A\u81F3\u662F\u4E00\u4E2A "),At=l(vt,"CODE",{});var vi=p(At);ar=n(vi,"OSError"),vi.forEach(t),lr=n(vt,"?!)\u3002\u8FD9\u91CC\u663E\u793A\u7684\u9519\u8BEF\u53EA\u662F\u4E00\u4E2A\u66F4\u5927\u7684\u9519\u8BEF\u62A5\u544A\u7684\u6700\u540E\u4E00\u90E8\u5206, \u79F0\u4E3A "),Ot=l(vt,"EM",{});var Ei=p(Ot);pr=n(Ei,"Python traceback"),Ei.forEach(t),ur=n(vt," (\u53C8\u540D\u5806\u6808\u8DDF\u8E2A)\u3002\u4F8B\u5982, \u5982\u679C\u4F60\u5728 Google Colab \u4E0A\u8FD0\u884C\u6B64\u4EE3\u7801, \u4F60\u5E94\u8BE5\u4F1A\u770B\u5230\u7C7B\u4F3C\u4E8E\u4EE5\u4E0B\u5C4F\u5E55\u622A\u56FE\u7684\u5185\u5BB9:"),vt.forEach(t),ys=f(e),ve=l(e,"DIV",{class:!0});var qi=p(ve);Ee=l(qi,"IMG",{src:!0,alt:!0,width:!0}),qi.forEach(t),js=f(e),D=l(e,"P",{});var V=p(D);fr=n(V,"\u8FD9\u4E9B\u62A5\u544A\u4E2D\u5305\u542B\u5F88\u591A\u4FE1\u606F, \u6240\u4EE5\u8BA9\u6211\u4EEC\u4E00\u8D77\u6765\u770B\u770B\u5173\u952E\u90E8\u5206\u3002\u9996\u5148\u8981\u6CE8\u610F\u7684\u662F, \u5E94\u8BE5\u4ECE "),Tt=l(V,"EM",{});var yi=p(Tt);_r=n(yi,"\u4ECE\u5E95\u90E8\u5230\u9876\u90E8"),yi.forEach(t),dr=n(V," \u8BFB\u53D6\u56DE\u6EAF\u3002\u5982\u679C\u4F60\u4E60\u60EF\u4E8E\u4ECE\u4E0A\u5230\u4E0B\u9605\u8BFB\u82F1\u6587\u6587\u672C, \u8FD9\u53EF\u80FD\u542C\u8D77\u6765\u5F88\u5947\u602A,\u4F46\u5B83\u53CD\u6620\u4E86\u8FD9\u6837\u4E00\u4E2A\u4E8B\u5B9E,\u5373\u56DE\u6EAF\u663E\u793A\u4E86\u5728\u4E0B\u8F7D\u6A21\u578B\u548C\u6807\u8BB0\u5668\u65F6 "),zt=l(V,"CODE",{});var ji=p(zt);cr=n(ji,"\u7BA1\u9053"),ji.forEach(t),mr=n(V," \u8FDB\u884C\u7684\u51FD\u6570\u8C03\u7528\u5E8F\u5217\u3002(\u67E5\u770B "),lt=l(V,"A",{href:!0});var xi=p(lt);hr=n(xi,"\u7B2C\u4E8C\u7AE0"),xi.forEach(t),br=n(V," \u4E86\u89E3\u6709\u5173 "),St=l(V,"CODE",{});var Pi=p(St);gr=n(Pi,"pipeline"),Pi.forEach(t),wr=n(V," \u5982\u4F55\u5728\u540E\u53F0\u5DE5\u4F5C\u7684\u66F4\u591A\u8BE6\u7EC6\u4FE1\u606F\u3002)"),V.forEach(t),xs=f(e),m(ee.$$.fragment,e),Ps=f(e),F=l(e,"P",{});var Et=p(F);$r=n(Et,"\u8FD9\u610F\u5473\u7740\u56DE\u6EAF\u7684\u6700\u540E\u4E00\u884C\u6307\u793A\u6700\u540E\u4E00\u6761\u9519\u8BEF\u6D88\u606F\u5E76\u7ED9\u51FA\u5F15\u53D1\u7684\u5F02\u5E38\u7684\u540D\u79F0\u3002\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B, \u5F02\u5E38\u7C7B\u578B\u662F"),It=l(Et,"CODE",{});var Ci=p(It);kr=n(Ci,"OSError"),Ci.forEach(t),vr=n(Et,", \u8868\u793A\u4E0E\u7CFB\u7EDF\u76F8\u5173\u7684\u9519\u8BEF\u3002\u5982\u679C\u6211\u4EEC\u9605\u8BFB\u968F\u9644\u7684\u9519\u8BEF\u6D88\u606F, \u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u6A21\u578B\u7684 "),Ht=l(Et,"EM",{});var Di=p(Ht);Er=n(Di,"config.json"),Di.forEach(t),qr=n(Et," \u6587\u4EF6\u4F3C\u4E4E\u6709\u95EE\u9898, \u6211\u4EEC\u7ED9\u51FA\u4E86\u4E24\u4E2A\u4FEE\u590D\u5B83\u7684\u5EFA\u8BAE:"),Et.forEach(t),Cs=f(e),m(qe.$$.fragment,e),Ds=f(e),m(te.$$.fragment,e),As=f(e),pt=l(e,"P",{});var Ai=p(pt);yr=n(Ai,"\u7B2C\u4E00\u4E2A\u5EFA\u8BAE\u662F\u8981\u6C42\u6211\u4EEC\u68C0\u67E5\u6A21\u578BID\u662F\u5426\u771F\u7684\u6B63\u786E, \u6240\u4EE5\u9996\u5148\u8981\u505A\u7684\u5C31\u662F\u590D\u5236\u6807\u8BC6\u7B26\u5E76\u5C06\u5176\u7C98\u8D34\u5230Hub\u7684\u641C\u7D22\u680F\u4E2D:"),Ai.forEach(t),Os=f(e),ye=l(e,"DIV",{class:!0});var Oi=p(ye);je=l(Oi,"IMG",{src:!0,alt:!0,width:!0}),Oi.forEach(t),Ts=f(e),ut=l(e,"P",{});var Ti=p(ut);jr=n(Ti,"\u55EF, \u770B\u8D77\u6765\u6211\u4EEC\u540C\u4E8B\u7684\u6A21\u578B\u786E\u5B9E\u4E0D\u5728 Hub \u4E0A\u2026 \u554A\u54C8, \u4F46\u662F\u6A21\u578B\u540D\u79F0\u4E2D\u6709\u4E00\u4E2A\u9519\u5B57! DistilBERT \u7684\u540D\u79F0\u4E2D\u53EA\u6709\u4E00\u4E2A \u201Cl\u201D, \u6240\u4EE5\u8BA9\u6211\u4EEC\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\u5E76\u5BFB\u627E \u201Clewtun/distilbert-base-uncased-finetuned-squad-d5716d28\u201D:"),Ti.forEach(t),zs=f(e),xe=l(e,"DIV",{class:!0});var zi=p(xe);Pe=l(zi,"IMG",{src:!0,alt:!0,width:!0}),zi.forEach(t),Ss=f(e),ft=l(e,"P",{});var Si=p(ft);xr=n(Si,"\u597D\u7684, \u8FD9\u5F88\u53D7\u6B22\u8FCE\u3002\u73B0\u5728\u8BA9\u6211\u4EEC\u5C1D\u8BD5\u4F7F\u7528\u6B63\u786E\u7684\u6A21\u578B ID \u518D\u6B21\u4E0B\u8F7D\u6A21\u578B:"),Si.forEach(t),Is=f(e),m(Ce.$$.fragment,e),Hs=f(e),m(De.$$.fragment,e),Ms=f(e),R=l(e,"P",{});var qt=p(R);Pr=n(qt,"\u554A, \u518D\u6B21\u632B\u8D25 \u2014 \u6B22\u8FCE\u6765\u5230\u673A\u5668\u5B66\u4E60\u5DE5\u7A0B\u5E08\u7684\u65E5\u5E38\u751F\u6D3B! \u56E0\u4E3A\u6211\u4EEC\u5DF2\u7ECF\u4FEE\u590D\u4E86\u6A21\u578B ID, \u6240\u4EE5\u95EE\u9898\u4E00\u5B9A\u51FA\u5728\u5B58\u50A8\u5E93\u672C\u8EAB\u3002\u8BBF\u95EE \u{1F917} Hub \u4E0A\u5B58\u50A8\u5E93\u5185\u5BB9\u7684\u4E00\u79CD\u5FEB\u901F\u65B9\u6CD5\u662F\u901A\u8FC7 "),Mt=l(qt,"CODE",{});var Ii=p(Mt);Cr=n(Ii,"huggingface_hub"),Ii.forEach(t),Dr=n(qt," \u5E93\u7684 "),Gt=l(qt,"CODE",{});var Hi=p(Gt);Ar=n(Hi,"list_repo_files()"),Hi.forEach(t),Or=n(qt," \u65B9\u6CD5:"),qt.forEach(t),Gs=f(e),m(Ae.$$.fragment,e),Ns=f(e),m(Oe.$$.fragment,e),Qs=f(e),y=l(e,"P",{});var I=p(y);Tr=n(I,"\u6709\u8DA3 \u2014 \u4F3C\u4E4E\u6CA1\u6709\u914D\u7F6E\u6587\u4EF6\u5B58\u50A8\u5E93\u4E2D\u7684 "),Nt=l(I,"EM",{});var Mi=p(Nt);zr=n(Mi,"config.json"),Mi.forEach(t),Sr=n(I," \u6587\u4EF6! \u96BE\u602A\u6211\u4EEC\u7684 "),Qt=l(I,"CODE",{});var Gi=p(Qt);Ir=n(Gi,"pipeline"),Gi.forEach(t),Hr=n(I," \u65E0\u6CD5\u52A0\u8F7D\u6A21\u578B; \u6211\u4EEC\u7684\u540C\u4E8B\u4E00\u5B9A\u662F\u5728\u5FAE\u8C03\u540E\u5FD8\u8BB0\u5C06\u8FD9\u4E2A\u6587\u4EF6\u63A8\u9001\u5230 Hub\u3002\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B, \u95EE\u9898\u4F3C\u4E4E\u5F88\u5BB9\u6613\u89E3\u51B3: \u6211\u4EEC\u53EF\u4EE5\u8981\u6C42\u4ED6\u4EEC\u6DFB\u52A0\u6587\u4EF6, \u6216\u8005, \u56E0\u4E3A\u6211\u4EEC\u53EF\u4EE5\u4ECE\u6A21\u578B ID \u4E2D\u770B\u5230\u4F7F\u7528\u7684\u9884\u8BAD\u7EC3\u6A21\u578B\u662F "),Te=l(I,"A",{href:!0,rel:!0});var Ni=p(Te);Ft=l(Ni,"CODE",{});var Qi=p(Ft);Mr=n(Qi,"distilbert-base-uncased"),Qi.forEach(t),Ni.forEach(t),Gr=n(I,", \u6211\u4EEC\u53EF\u4EE5\u4E0B\u8F7D\u6B64\u6A21\u578B\u7684\u914D\u7F6E\u5E76\u5C06\u5176\u63A8\u9001\u5230\u6211\u4EEC\u7684\u5B58\u50A8\u5E93\u4EE5\u67E5\u770B\u662F\u5426\u53EF\u4EE5\u89E3\u51B3\u95EE\u9898\u3002\u8BA9\u6211\u4EEC\u8BD5\u8BD5\u770B\u3002\u4F7F\u7528\u6211\u4EEC\u5728 "),_t=l(I,"A",{href:!0});var Fi=p(_t);Nr=n(Fi,"\u7B2C\u4E8C\u7AE0"),Fi.forEach(t),Qr=n(I," \u4E2D\u5B66\u4E60\u7684\u6280\u672F, \u6211\u4EEC\u4F7F\u7528 "),Rt=l(I,"CODE",{});var Ri=p(Rt);Fr=n(Ri,"AutoConfig"),Ri.forEach(t),Rr=n(I," \u7C7B\u4E0B\u8F7D\u6A21\u578B\u7684\u914D\u7F6E:"),I.forEach(t),Fs=f(e),m(ze.$$.fragment,e),Rs=f(e),m(se.$$.fragment,e),Ls=f(e),oe=l(e,"P",{});var Ao=p(oe);Lr=n(Ao,"\u7136\u540E\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u914D\u7F6E\u7684 "),Lt=l(Ao,"CODE",{});var Li=p(Lt);Vr=n(Li,"push_to_hub()"),Li.forEach(t),Jr=n(Ao," \u65B9\u6CD5\u5C06\u5176\u63A8\u9001\u5230\u6211\u4EEC\u7684\u6A21\u578B\u5B58\u50A8\u5E93:"),Ao.forEach(t),Vs=f(e),m(Se.$$.fragment,e),Js=f(e),re=l(e,"P",{});var Oo=p(re);Wr=n(Oo,"\u73B0\u5728\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7\u4ECE\u6700\u65B0\u63D0\u4EA4\u7684 "),Vt=l(Oo,"CODE",{});var Vi=p(Vt);Yr=n(Vi,"main"),Vi.forEach(t),Br=n(Oo," \u5206\u652F\u4E2D\u52A0\u8F7D\u6A21\u578B\u6765\u6D4B\u8BD5\u8FD9\u662F\u5426\u6709\u6548:"),Oo.forEach(t),Ws=f(e),m(Ie.$$.fragment,e),Ys=f(e),m(He.$$.fragment,e),Bs=f(e),dt=l(e,"P",{});var Ji=p(dt);Xr=n(Ji,"\u54C7\u54E6, \u6210\u529F\u4E86!\u8BA9\u6211\u4EEC\u56DE\u987E\u4E00\u4E0B\u4F60\u521A\u521A\u5B66\u5230\u7684\u4E1C\u897F:"),Ji.forEach(t),Xs=f(e),z=l(e,"UL",{});var pe=p(z);Me=l(pe,"LI",{});var To=p(Me);Ur=n(To,"Python \u4E2D\u7684\u9519\u8BEF\u6D88\u606F\u79F0\u4E3A "),Jt=l(To,"EM",{});var Wi=p(Jt);Kr=n(Wi,"tracebacks"),Wi.forEach(t),Zr=n(To," , \u5E76\u4ECE\u4E0B\u5230\u4E0A\u9605\u8BFB\u3002\u9519\u8BEF\u6D88\u606F\u7684\u6700\u540E\u4E00\u884C\u901A\u5E38\u5305\u542B\u5B9A\u4F4D\u95EE\u9898\u6839\u6E90\u6240\u9700\u7684\u4FE1\u606F\u3002"),To.forEach(t),en=f(pe),Wt=l(pe,"LI",{});var Yi=p(Wt);tn=n(Yi,"\u5982\u679C\u6700\u540E\u4E00\u884C\u6CA1\u6709\u5305\u542B\u8DB3\u591F\u7684\u4FE1\u606F, \u8BF7\u6309\u7167\u60A8\u7684\u65B9\u5F0F\u8FDB\u884C\u56DE\u6EAF, \u770B\u770B\u60A8\u662F\u5426\u53EF\u4EE5\u786E\u5B9A\u6E90\u4EE3\u7801\u4E2D\u53D1\u751F\u9519\u8BEF\u7684\u4F4D\u7F6E\u3002"),Yi.forEach(t),sn=f(pe),Yt=l(pe,"LI",{});var Bi=p(Yt);on=n(Bi,"\u5982\u679C\u6CA1\u6709\u4EFB\u4F55\u9519\u8BEF\u6D88\u606F\u53EF\u4EE5\u5E2E\u52A9\u60A8\u8C03\u8BD5\u95EE\u9898, \u8BF7\u5C1D\u8BD5\u5728\u7EBF\u641C\u7D22\u7C7B\u4F3C\u95EE\u9898\u7684\u89E3\u51B3\u65B9\u6848\u3002"),Bi.forEach(t),rn=f(pe),ct=l(pe,"LI",{});var oi=p(ct);Bt=l(oi,"CODE",{});var Xi=p(Bt);nn=n(Xi,"huggingface_hub"),Xi.forEach(t),an=n(oi,`
// \u{1F917} Hub?
\u5E93\u63D0\u4F9B\u4E86\u4E00\u5957\u5DE5\u5177, \u4F60\u53EF\u4EE5\u4F7F\u7528\u8FD9\u4E9B\u5DE5\u5177\u4E0E Hub \u4E0A\u7684\u5B58\u50A8\u5E93\u8FDB\u884C\u4EA4\u4E92\u548C\u8C03\u8BD5\u3002`),oi.forEach(t),pe.forEach(t),Us=f(e),mt=l(e,"P",{});var Ui=p(mt);ln=n(Ui,"\u73B0\u5728\u4F60\u77E5\u9053\u5982\u4F55\u8C03\u8BD5\u7BA1\u9053, \u8BA9\u6211\u4EEC\u770B\u4E00\u4E0B\u6A21\u578B\u672C\u8EAB\u524D\u5411\u4F20\u9012\u4E2D\u7684\u4E00\u4E2A\u66F4\u68D8\u624B\u7684\u793A\u4F8B\u3002"),Ui.forEach(t),Ks=f(e),Ge=l(e,"H2",{id:!0});var Ki=p(Ge);pn=n(Ki,"\u8C03\u8BD5\u6A21\u578B\u7684\u524D\u5411\u4F20\u9012"),Ki.forEach(t),Zs=f(e),L=l(e,"P",{});var yt=p(L);un=n(yt,"\u5C3D\u7BA1 "),Xt=l(yt,"CODE",{});var Zi=p(Xt);fn=n(Zi,"pipeline"),Zi.forEach(t),_n=n(yt," \u5BF9\u4E8E\u5927\u591A\u6570\u9700\u8981\u5FEB\u901F\u751F\u6210\u9884\u6D4B\u7684\u5E94\u7528\u7A0B\u5E8F\u6765\u8BF4\u975E\u5E38\u6709\u7528, \u6709\u65F6\u60A8\u9700\u8981\u8BBF\u95EE\u6A21\u578B\u7684 logits (\u4F8B\u5982, \u5982\u679C\u60A8\u6709\u4E00\u4E9B\u60F3\u8981\u5E94\u7528\u7684\u81EA\u5B9A\u4E49\u540E\u5904\u7406)\u3002\u4E3A\u4E86\u770B\u770B\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\u4F1A\u51FA\u73B0\u4EC0\u4E48\u95EE\u9898, \u8BA9\u6211\u4EEC\u9996\u5148\u4ECE "),Ut=l(yt,"CODE",{});var ea=p(Ut);dn=n(ea,"pipeline"),ea.forEach(t),cn=n(yt," \u4E2D\u83B7\u53D6\u6A21\u578B\u548C\u6807\u8BB0\u5668:"),yt.forEach(t),eo=f(e),m(Ne.$$.fragment,e),to=f(e),ht=l(e,"P",{});var ta=p(ht);mn=n(ta,"\u63A5\u4E0B\u6765\u6211\u4EEC\u9700\u8981\u4E00\u4E2A\u95EE\u9898, \u90A3\u4E48\u8BA9\u6211\u4EEC\u770B\u770B\u662F\u5426\u652F\u6301\u6211\u4EEC\u6700\u559C\u6B22\u7684\u6846\u67B6:"),ta.forEach(t),so=f(e),m(Qe.$$.fragment,e),oo=f(e),ne=l(e,"P",{});var zo=p(ne);hn=n(zo,"\u6B63\u5982\u6211\u4EEC\u5728 "),bt=l(zo,"A",{href:!0});var sa=p(bt);bn=n(sa,"\u7B2C\u4E03\u7AE0"),sa.forEach(t),gn=n(zo," \u4E2D\u5B66\u4E60\u7684, \u6211\u4EEC\u9700\u8981\u91C7\u53D6\u7684\u901A\u5E38\u6B65\u9AA4\u662F\u5BF9\u8F93\u5165\u8FDB\u884C\u6807\u8BB0\u5316, \u63D0\u53D6\u5F00\u59CB\u548C\u7ED3\u675F\u6807\u8BB0\u7684\u5BF9\u6570, \u7136\u540E\u89E3\u7801\u7B54\u6848\u8303\u56F4:"),zo.forEach(t),ro=f(e),m(Fe.$$.fragment,e),no=f(e),m(Re.$$.fragment,e),io=f(e),gt=l(e,"P",{});var oa=p(gt);wn=n(oa,"\u5662, \u770B\u8D77\u6765\u6211\u4EEC\u7684\u4EE3\u7801\u4E2D\u6709\u4E00\u4E2A\u9519\u8BEF!\u4F46\u6211\u4EEC\u4E0D\u6015\u4E00\u70B9\u8C03\u8BD5\u3002\u60A8\u53EF\u4EE5\u5728\u7B14\u8BB0\u672C\u4E2D\u4F7F\u7528 Python \u8C03\u8BD5\u5668:"),oa.forEach(t),ao=f(e),m(Le.$$.fragment,e),lo=f(e),wt=l(e,"P",{});var ra=p(wt);$n=n(ra,"\u6216\u5728\u7EC8\u7AEF\u4E2D:"),ra.forEach(t),po=f(e),m(Ve.$$.fragment,e),uo=f(e),A=l(e,"P",{});var J=p(A);kn=n(J,"\u5728\u8FD9\u91CC, \u9605\u8BFB\u9519\u8BEF\u6D88\u606F\u544A\u8BC9\u6211\u4EEC "),Kt=l(J,"CODE",{});var na=p(Kt);vn=n(na,"'list' object has no attribute 'size'"),na.forEach(t),En=n(J,", \u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u4E00\u4E2A "),Zt=l(J,"CODE",{});var ia=p(Zt);qn=n(ia,"-->"),ia.forEach(t),yn=n(J," \u7BAD\u5934\u6307\u5411 "),es=l(J,"CODE",{});var aa=p(es);jn=n(aa,"model(**inputs)"),aa.forEach(t),xn=n(J," \u4E2D\u51FA\u73B0\u95EE\u9898\u7684\u884C\u3002\u4F60\u53EF\u4EE5\u4F7F\u7528 Python \u8C03\u8BD5\u5668\u4EE5\u4EA4\u4E92\u65B9\u5F0F\u8C03\u8BD5\u5B83, \u4F46\u73B0\u5728\u6211\u4EEC\u53EA\u9700\u6253\u5370\u51FA\u4E00\u90E8\u5206 "),ts=l(J,"CODE",{});var la=p(ts);Pn=n(la,"inputs"),la.forEach(t),Cn=n(J,", \u770B\u770B\u6211\u4EEC\u6709\u4EC0\u4E48:"),J.forEach(t),fo=f(e),m(Je.$$.fragment,e),_o=f(e),m(We.$$.fragment,e),co=f(e),ie=l(e,"P",{});var So=p(ie);Dn=n(So,"\u8FD9\u5F53\u7136\u770B\u8D77\u6765\u50CF\u4E00\u4E2A\u666E\u901A\u7684 Python "),ss=l(So,"CODE",{});var pa=p(ss);An=n(pa,"list"),pa.forEach(t),On=n(So,", \u4F46\u8BA9\u6211\u4EEC\u4ED4\u7EC6\u68C0\u67E5\u4E00\u4E0B\u7C7B\u578B:"),So.forEach(t),mo=f(e),m(Ye.$$.fragment,e),ho=f(e),m(Be.$$.fragment,e),bo=f(e),j=l(e,"P",{});var H=p(j);Tn=n(H,"\u662F\u7684, \u8FD9\u80AF\u5B9A\u662F\u4E00\u4E2A Python "),os=l(H,"CODE",{});var ua=p(os);zn=n(ua,"list"),ua.forEach(t),Sn=n(H,"\u3002\u90A3\u4E48\u51FA\u4E86\u4EC0\u4E48\u95EE\u9898\u5462? \u56DE\u5FC6 "),$t=l(H,"A",{href:!0});var fa=p($t);In=n(fa,"\u7B2C\u4E8C\u7AE0"),fa.forEach(t),Hn=n(H," \u{1F917} Transformers \u4E2D\u7684 "),rs=l(H,"CODE",{});var _a=p(rs);Mn=n(_a,"AutoModelForXxx"),_a.forEach(t),Gn=n(H," \u7C7B\u5728 "),ns=l(H,"EM",{});var da=p(ns);Nn=n(da,"tensors"),da.forEach(t),Qn=n(H," \u4E0A\u8FD0\u884C(PyTorch\u6216\u8005or TensorFlow), \u4E00\u4E2A\u5E38\u89C1\u7684\u64CD\u4F5C\u662F\u4F7F\u7528 "),is=l(H,"CODE",{});var ca=p(is);Fn=n(ca,"Tensor.size()"),ca.forEach(t),Rn=n(H," \u65B9\u6CD5\u63D0\u53D6\u5F20\u91CF\u7684\u7EF4\u5EA6, \u4F8B\u5982, \u5728 PyTorch \u4E2D\u3002\u8BA9\u6211\u4EEC\u518D\u770B\u770B\u56DE\u6EAF, \u770B\u770B\u54EA\u4E00\u884C\u89E6\u53D1\u4E86\u5F02\u5E38:"),H.forEach(t),go=f(e),m(Xe.$$.fragment,e),wo=f(e),S=l(e,"P",{});var ue=p(S);Ln=n(ue,"\u770B\u8D77\u6765\u6211\u4EEC\u7684\u4EE3\u7801\u8BD5\u56FE\u8C03\u7528 "),as=l(ue,"CODE",{});var ma=p(as);Vn=n(ma,"input_ids.size()"),ma.forEach(t),Jn=n(ue,", \u4F46\u8FD9\u663E\u7136\u4E0D\u9002\u7528\u4E8E Python "),ls=l(ue,"CODE",{});var ha=p(ls);Wn=n(ha,"list"),ha.forEach(t),Yn=n(ue,", \u8FD9\u53EA\u662F\u4E00\u4E2A\u5BB9\u5668\u3002\u6211\u4EEC\u5982\u4F55\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898? \u5728 Stack Overflow \u4E0A\u641C\u7D22\u9519\u8BEF\u6D88\u606F\u7ED9\u51FA\u4E86\u5F88\u591A\u76F8\u5173\u7684 "),Ue=l(ue,"A",{href:!0,rel:!0});var ba=p(Ue);Bn=n(ba,"hits"),ba.forEach(t),Xn=n(ue,"\u3002\u5355\u51FB\u7B2C\u4E00\u4E2A\u4F1A\u663E\u793A\u4E0E\u6211\u4EEC\u7C7B\u4F3C\u7684\u95EE\u9898, \u7B54\u6848\u5982\u4E0B\u9762\u7684\u5C4F\u5E55\u622A\u56FE\u6240\u793A:"),ue.forEach(t),$o=f(e),Ke=l(e,"DIV",{class:!0});var ga=p(Ke);Ze=l(ga,"IMG",{src:!0,alt:!0,width:!0}),ga.forEach(t),ko=f(e),ae=l(e,"P",{});var Io=p(ae);Un=n(Io,"\u7B54\u6848\u5EFA\u8BAE\u6211\u4EEC\u6DFB\u52A0 "),ps=l(Io,"CODE",{});var wa=p(ps);Kn=n(wa,"return_tensors='pt'"),wa.forEach(t),Zn=n(Io," \u5230\u6807\u8BB0\u5668, \u6240\u4EE5\u8BA9\u6211\u4EEC\u770B\u770B\u8FD9\u662F\u5426\u9002\u5408\u6211\u4EEC:"),Io.forEach(t),vo=f(e),m(et.$$.fragment,e),Eo=f(e),m(tt.$$.fragment,e),qo=f(e),le=l(e,"P",{});var Ho=p(le);ei=n(Ho,"\u4E0D\u9519, \u6210\u529F\u4E86! \u8FD9\u662F Stack Overflow \u975E\u5E38\u6709\u7528\u7684\u4E00\u4E2A\u5F88\u597D\u7684\u4F8B\u5B50: \u901A\u8FC7\u8BC6\u522B\u7C7B\u4F3C\u7684\u95EE\u9898, \u6211\u4EEC\u80FD\u591F\u4ECE\u793E\u533A\u4E2D\u5176\u4ED6\u4EBA\u7684\u7ECF\u9A8C\u4E2D\u53D7\u76CA\u3002\u7136\u800C, \u50CF\u8FD9\u6837\u7684\u641C\u7D22\u5E76\u4E0D\u603B\u662F\u4F1A\u4EA7\u751F\u76F8\u5173\u7684\u7B54\u6848, \u90A3\u4E48\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\u4F60\u80FD\u505A\u4EC0\u4E48\u5462? \u5E78\u8FD0\u7684\u662F, \u6709\u4E00\u4E2A\u53D7\u6B22\u8FCE\u7684\u5F00\u53D1\u8005\u793E\u533A "),st=l(Ho,"A",{href:!0,rel:!0});var $a=p(st);ti=n($a,"Hugging Face forums"),$a.forEach(t),si=n(Ho," \u53EF\u4EE5\u5E2E\u52A9\u4F60! \u5728\u4E0B\u4E00\u8282\u4E2D, \u6211\u4EEC\u5C06\u770B\u770B\u5982\u4F55\u8BBE\u8BA1\u53EF\u80FD\u5F97\u5230\u56DE\u7B54\u7684\u4F18\u79C0\u8BBA\u575B\u95EE\u9898\u3002"),Ho.forEach(t),this.h()},h(){_(d,"name","hf:doc:metadata"),_(d,"content",JSON.stringify(Oa)),_($,"id",""),_(G,"href","/course/chapter8/section4"),_(de,"href","https://huggingface.co/lewtun/distilbert-base-uncased-finetuned-squad-d5716d28"),_(de,"rel","nofollow"),_(ce,"href","https://huggingface.co"),_(ce,"rel","nofollow"),_(K,"id","transformers"),_(K,"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"),_(K,"href","#transformers"),_(Y,"class","relative group"),_(at,"href","/course/chapter7/7"),Mo(Ee.src,ii="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/traceback.png")||_(Ee,"src",ii),_(Ee,"alt","A Python traceback."),_(Ee,"width","100%"),_(ve,"class","flex justify-center"),_(lt,"href","/course/chapter2"),Mo(je.src,ai="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/wrong-model-id.png")||_(je,"src",ai),_(je,"alt","The wrong model name."),_(je,"width","100%"),_(ye,"class","flex justify-center"),Mo(Pe.src,li="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/true-model-id.png")||_(Pe,"src",li),_(Pe,"alt","The right model name."),_(Pe,"width","100%"),_(xe,"class","flex justify-center"),_(Te,"href","https://huggingface.co/distilbert-base-uncased"),_(Te,"rel","nofollow"),_(_t,"href","/course/chapter2"),_(Ge,"id",""),_(bt,"href","/course/chapter7"),_($t,"href","/course/chapter2"),_(Ue,"href","https://stackoverflow.com/search?q=AttributeError%3A+%27list%27+object+has+no+attribute+%27size%27&s=c15ec54c-63cb-481d-a749-408920073e8f"),_(Ue,"rel","nofollow"),Mo(Ze.src,pi="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter8/stack-overflow.png")||_(Ze,"src",pi),_(Ze,"alt","An answer from Stack Overflow."),_(Ze,"width","100%"),_(Ke,"class","flex justify-center"),_(st,"href","https://discuss.huggingface.co/"),_(st,"rel","nofollow")},m(e,o){s(document.head,d),i(e,E,o),i(e,$,o),s($,q),i(e,T,o),h(v,e,o),i(e,x,o),i(e,P,o),s(P,M),s(P,G),s(G,fe),s(P,W),i(e,C,o),h(N,e,o),i(e,_e,o),i(e,O,o),s(O,Go),s(O,de),s(de,No),s(O,Qo),s(O,ce),s(ce,Fo),s(O,Ro),i(e,_s,o),h(me,e,o),i(e,ds,o),i(e,rt,o),s(rt,Lo),i(e,cs,o),h(he,e,o),i(e,ms,o),i(e,X,o),s(X,Vo),s(X,jt),s(jt,Jo),s(X,Wo),i(e,hs,o),h(be,e,o),i(e,bs,o),i(e,U,o),s(U,Yo),s(U,xt),s(xt,Bo),s(U,Xo),i(e,gs,o),i(e,Y,o),s(Y,K),s(K,Pt),h(ge,Pt,null),s(Y,Uo),s(Y,Ct),s(Ct,Ko),i(e,ws,o),i(e,nt,o),s(nt,Zo),i(e,$s,o),i(e,it,o),s(it,we),s(we,er),s(we,at),s(at,tr),s(we,sr),i(e,ks,o),i(e,Z,o),s(Z,or),s(Z,Dt),s(Dt,rr),s(Z,nr),i(e,vs,o),h($e,e,o),i(e,Es,o),h(ke,e,o),i(e,qs,o),i(e,Q,o),s(Q,ir),s(Q,At),s(At,ar),s(Q,lr),s(Q,Ot),s(Ot,pr),s(Q,ur),i(e,ys,o),i(e,ve,o),s(ve,Ee),i(e,js,o),i(e,D,o),s(D,fr),s(D,Tt),s(Tt,_r),s(D,dr),s(D,zt),s(zt,cr),s(D,mr),s(D,lt),s(lt,hr),s(D,br),s(D,St),s(St,gr),s(D,wr),i(e,xs,o),h(ee,e,o),i(e,Ps,o),i(e,F,o),s(F,$r),s(F,It),s(It,kr),s(F,vr),s(F,Ht),s(Ht,Er),s(F,qr),i(e,Cs,o),h(qe,e,o),i(e,Ds,o),h(te,e,o),i(e,As,o),i(e,pt,o),s(pt,yr),i(e,Os,o),i(e,ye,o),s(ye,je),i(e,Ts,o),i(e,ut,o),s(ut,jr),i(e,zs,o),i(e,xe,o),s(xe,Pe),i(e,Ss,o),i(e,ft,o),s(ft,xr),i(e,Is,o),h(Ce,e,o),i(e,Hs,o),h(De,e,o),i(e,Ms,o),i(e,R,o),s(R,Pr),s(R,Mt),s(Mt,Cr),s(R,Dr),s(R,Gt),s(Gt,Ar),s(R,Or),i(e,Gs,o),h(Ae,e,o),i(e,Ns,o),h(Oe,e,o),i(e,Qs,o),i(e,y,o),s(y,Tr),s(y,Nt),s(Nt,zr),s(y,Sr),s(y,Qt),s(Qt,Ir),s(y,Hr),s(y,Te),s(Te,Ft),s(Ft,Mr),s(y,Gr),s(y,_t),s(_t,Nr),s(y,Qr),s(y,Rt),s(Rt,Fr),s(y,Rr),i(e,Fs,o),h(ze,e,o),i(e,Rs,o),h(se,e,o),i(e,Ls,o),i(e,oe,o),s(oe,Lr),s(oe,Lt),s(Lt,Vr),s(oe,Jr),i(e,Vs,o),h(Se,e,o),i(e,Js,o),i(e,re,o),s(re,Wr),s(re,Vt),s(Vt,Yr),s(re,Br),i(e,Ws,o),h(Ie,e,o),i(e,Ys,o),h(He,e,o),i(e,Bs,o),i(e,dt,o),s(dt,Xr),i(e,Xs,o),i(e,z,o),s(z,Me),s(Me,Ur),s(Me,Jt),s(Jt,Kr),s(Me,Zr),s(z,en),s(z,Wt),s(Wt,tn),s(z,sn),s(z,Yt),s(Yt,on),s(z,rn),s(z,ct),s(ct,Bt),s(Bt,nn),s(ct,an),i(e,Us,o),i(e,mt,o),s(mt,ln),i(e,Ks,o),i(e,Ge,o),s(Ge,pn),i(e,Zs,o),i(e,L,o),s(L,un),s(L,Xt),s(Xt,fn),s(L,_n),s(L,Ut),s(Ut,dn),s(L,cn),i(e,eo,o),h(Ne,e,o),i(e,to,o),i(e,ht,o),s(ht,mn),i(e,so,o),h(Qe,e,o),i(e,oo,o),i(e,ne,o),s(ne,hn),s(ne,bt),s(bt,bn),s(ne,gn),i(e,ro,o),h(Fe,e,o),i(e,no,o),h(Re,e,o),i(e,io,o),i(e,gt,o),s(gt,wn),i(e,ao,o),h(Le,e,o),i(e,lo,o),i(e,wt,o),s(wt,$n),i(e,po,o),h(Ve,e,o),i(e,uo,o),i(e,A,o),s(A,kn),s(A,Kt),s(Kt,vn),s(A,En),s(A,Zt),s(Zt,qn),s(A,yn),s(A,es),s(es,jn),s(A,xn),s(A,ts),s(ts,Pn),s(A,Cn),i(e,fo,o),h(Je,e,o),i(e,_o,o),h(We,e,o),i(e,co,o),i(e,ie,o),s(ie,Dn),s(ie,ss),s(ss,An),s(ie,On),i(e,mo,o),h(Ye,e,o),i(e,ho,o),h(Be,e,o),i(e,bo,o),i(e,j,o),s(j,Tn),s(j,os),s(os,zn),s(j,Sn),s(j,$t),s($t,In),s(j,Hn),s(j,rs),s(rs,Mn),s(j,Gn),s(j,ns),s(ns,Nn),s(j,Qn),s(j,is),s(is,Fn),s(j,Rn),i(e,go,o),h(Xe,e,o),i(e,wo,o),i(e,S,o),s(S,Ln),s(S,as),s(as,Vn),s(S,Jn),s(S,ls),s(ls,Wn),s(S,Yn),s(S,Ue),s(Ue,Bn),s(S,Xn),i(e,$o,o),i(e,Ke,o),s(Ke,Ze),i(e,ko,o),i(e,ae,o),s(ae,Un),s(ae,ps),s(ps,Kn),s(ae,Zn),i(e,vo,o),h(et,e,o),i(e,Eo,o),h(tt,e,o),i(e,qo,o),i(e,le,o),s(le,ei),s(le,st),s(st,ti),s(le,si),yo=!0},p(e,[o]){const us={};o&2&&(us.$$scope={dirty:o,ctx:e}),ee.$set(us);const ot={};o&2&&(ot.$$scope={dirty:o,ctx:e}),te.$set(ot);const fs={};o&2&&(fs.$$scope={dirty:o,ctx:e}),se.$set(fs)},i(e){yo||(b(v.$$.fragment,e),b(N.$$.fragment,e),b(me.$$.fragment,e),b(he.$$.fragment,e),b(be.$$.fragment,e),b(ge.$$.fragment,e),b($e.$$.fragment,e),b(ke.$$.fragment,e),b(ee.$$.fragment,e),b(qe.$$.fragment,e),b(te.$$.fragment,e),b(Ce.$$.fragment,e),b(De.$$.fragment,e),b(Ae.$$.fragment,e),b(Oe.$$.fragment,e),b(ze.$$.fragment,e),b(se.$$.fragment,e),b(Se.$$.fragment,e),b(Ie.$$.fragment,e),b(He.$$.fragment,e),b(Ne.$$.fragment,e),b(Qe.$$.fragment,e),b(Fe.$$.fragment,e),b(Re.$$.fragment,e),b(Le.$$.fragment,e),b(Ve.$$.fragment,e),b(Je.$$.fragment,e),b(We.$$.fragment,e),b(Ye.$$.fragment,e),b(Be.$$.fragment,e),b(Xe.$$.fragment,e),b(et.$$.fragment,e),b(tt.$$.fragment,e),yo=!0)},o(e){g(v.$$.fragment,e),g(N.$$.fragment,e),g(me.$$.fragment,e),g(he.$$.fragment,e),g(be.$$.fragment,e),g(ge.$$.fragment,e),g($e.$$.fragment,e),g(ke.$$.fragment,e),g(ee.$$.fragment,e),g(qe.$$.fragment,e),g(te.$$.fragment,e),g(Ce.$$.fragment,e),g(De.$$.fragment,e),g(Ae.$$.fragment,e),g(Oe.$$.fragment,e),g(ze.$$.fragment,e),g(se.$$.fragment,e),g(Se.$$.fragment,e),g(Ie.$$.fragment,e),g(He.$$.fragment,e),g(Ne.$$.fragment,e),g(Qe.$$.fragment,e),g(Fe.$$.fragment,e),g(Re.$$.fragment,e),g(Le.$$.fragment,e),g(Ve.$$.fragment,e),g(Je.$$.fragment,e),g(We.$$.fragment,e),g(Ye.$$.fragment,e),g(Be.$$.fragment,e),g(Xe.$$.fragment,e),g(et.$$.fragment,e),g(tt.$$.fragment,e),yo=!1},d(e){t(d),e&&t(E),e&&t($),e&&t(T),w(v,e),e&&t(x),e&&t(P),e&&t(C),w(N,e),e&&t(_e),e&&t(O),e&&t(_s),w(me,e),e&&t(ds),e&&t(rt),e&&t(cs),w(he,e),e&&t(ms),e&&t(X),e&&t(hs),w(be,e),e&&t(bs),e&&t(U),e&&t(gs),e&&t(Y),w(ge),e&&t(ws),e&&t(nt),e&&t($s),e&&t(it),e&&t(ks),e&&t(Z),e&&t(vs),w($e,e),e&&t(Es),w(ke,e),e&&t(qs),e&&t(Q),e&&t(ys),e&&t(ve),e&&t(js),e&&t(D),e&&t(xs),w(ee,e),e&&t(Ps),e&&t(F),e&&t(Cs),w(qe,e),e&&t(Ds),w(te,e),e&&t(As),e&&t(pt),e&&t(Os),e&&t(ye),e&&t(Ts),e&&t(ut),e&&t(zs),e&&t(xe),e&&t(Ss),e&&t(ft),e&&t(Is),w(Ce,e),e&&t(Hs),w(De,e),e&&t(Ms),e&&t(R),e&&t(Gs),w(Ae,e),e&&t(Ns),w(Oe,e),e&&t(Qs),e&&t(y),e&&t(Fs),w(ze,e),e&&t(Rs),w(se,e),e&&t(Ls),e&&t(oe),e&&t(Vs),w(Se,e),e&&t(Js),e&&t(re),e&&t(Ws),w(Ie,e),e&&t(Ys),w(He,e),e&&t(Bs),e&&t(dt),e&&t(Xs),e&&t(z),e&&t(Us),e&&t(mt),e&&t(Ks),e&&t(Ge),e&&t(Zs),e&&t(L),e&&t(eo),w(Ne,e),e&&t(to),e&&t(ht),e&&t(so),w(Qe,e),e&&t(oo),e&&t(ne),e&&t(ro),w(Fe,e),e&&t(no),w(Re,e),e&&t(io),e&&t(gt),e&&t(ao),w(Le,e),e&&t(lo),e&&t(wt),e&&t(po),w(Ve,e),e&&t(uo),e&&t(A),e&&t(fo),w(Je,e),e&&t(_o),w(We,e),e&&t(co),e&&t(ie),e&&t(mo),w(Ye,e),e&&t(ho),w(Be,e),e&&t(bo),e&&t(j),e&&t(go),w(Xe,e),e&&t(wo),e&&t(S),e&&t($o),e&&t(Ke),e&&t(ko),e&&t(ae),e&&t(vo),w(et,e),e&&t(Eo),w(tt,e),e&&t(qo),e&&t(le)}}}const Oa={local:"",sections:[{local:"transformers",title:"\u4ECE \u{1F917} Transformers \u8C03\u8BD5\u7BA1\u9053"},{local:"",title:"\u8C03\u8BD5\u6A21\u578B\u7684\u524D\u5411\u4F20\u9012"}],title:"\u51FA\u73B0\u9519\u8BEF\u65F6\u8BE5\u600E\u4E48\u529E"};function Ta(B){return ya(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Na extends ka{constructor(d){super();va(this,d,Ta,Aa,Ea,{})}}export{Na as default,Oa as metadata};
