import{s as I,n as K,o as N}from"../chunks/scheduler.25b97de1.js";import{S as F,i as W,g as i,s as n,r as k,A as J,h as s,f as a,c as o,j as S,u as U,x as T,k as D,y as Q,a as l,v as O,d as j,t as q,w as z}from"../chunks/index.d9030fc9.js";import{H as V,E as X}from"../chunks/EditOnGithub.91d95064.js";function Y(R){let r,d,b,x,p,y,h,B="当前，一个新兴的研究领域正致力于探索大规模 transformer 模型（如BERT）的内部工作机制，一些人称之为“BERTology”。以下是这个领域的一些典型示例：",E,m,C=`<li>BERT Rediscovers the Classical NLP Pipeline by Ian Tenney, Dipanjan Das, Ellie Pavlick:
<a href="https://arxiv.org/abs/1905.05950" rel="nofollow">https://arxiv.org/abs/1905.05950</a></li> <li>Are Sixteen Heads Really Better than One? by Paul Michel, Omer Levy, Graham Neubig: <a href="https://arxiv.org/abs/1905.10650" rel="nofollow">https://arxiv.org/abs/1905.10650</a></li> <li>What Does BERT Look At? An Analysis of BERT’s Attention by Kevin Clark, Urvashi Khandelwal, Omer Levy, Christopher D.
Manning: <a href="https://arxiv.org/abs/1906.04341" rel="nofollow">https://arxiv.org/abs/1906.04341</a></li> <li>CAT-probing: A Metric-based Approach to Interpret How Pre-trained Models for Programming Language Attend Code Structure: <a href="https://arxiv.org/abs/2210.04633" rel="nofollow">https://arxiv.org/abs/2210.04633</a></li>`,P,f,A='为了助力这一新兴领域的发展，我们在BERT/GPT/GPT-2模型中增加了一些附加功能，方便人们访问其内部表示，这些功能主要借鉴了Paul Michel的杰出工作(<a href="https://arxiv.org/abs/1905.10650)%EF%BC%9A" rel="nofollow">https://arxiv.org/abs/1905.10650)：</a>',_,u,H='<li>访问BERT/GPT/GPT-2的所有隐藏状态，</li> <li>访问BERT/GPT/GPT-2每个注意力头的所有注意力权重，</li> <li>检索注意力头的输出值和梯度，以便计算头的重要性得分并对头进行剪枝，详情可见论文：<a href="https://arxiv.org/abs/1905.10650%E3%80%82" rel="nofollow">https://arxiv.org/abs/1905.10650。</a></li>',w,c,G='为了帮助您理解和使用这些功能，我们添加了一个具体的示例脚本：<a href="https://github.com/huggingface/transformers-research-projects/tree/main/bertology/run_bertology.py" rel="nofollow">bertology.py</a>，该脚本可以对一个在 GLUE 数据集上预训练的模型进行信息提取与剪枝。',$,g,L,v,M;return p=new V({props:{title:"基于BERT进行的相关研究（BERTology）",local:"基于bert进行的相关研究bertology",headingTag:"h1"}}),g=new X({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/zh/bertology.md"}}),{c(){r=i("meta"),d=n(),b=i("p"),x=n(),k(p.$$.fragment),y=n(),h=i("p"),h.textContent=B,E=n(),m=i("ul"),m.innerHTML=C,P=n(),f=i("p"),f.innerHTML=A,_=n(),u=i("ul"),u.innerHTML=H,w=n(),c=i("p"),c.innerHTML=G,$=n(),k(g.$$.fragment),L=n(),v=i("p"),this.h()},l(t){const e=J("svelte-u9bgzb",document.head);r=s(e,"META",{name:!0,content:!0}),e.forEach(a),d=o(t),b=s(t,"P",{}),S(b).forEach(a),x=o(t),U(p.$$.fragment,t),y=o(t),h=s(t,"P",{"data-svelte-h":!0}),T(h)!=="svelte-122li14"&&(h.textContent=B),E=o(t),m=s(t,"UL",{"data-svelte-h":!0}),T(m)!=="svelte-1e34lw"&&(m.innerHTML=C),P=o(t),f=s(t,"P",{"data-svelte-h":!0}),T(f)!=="svelte-kha6wh"&&(f.innerHTML=A),_=o(t),u=s(t,"UL",{"data-svelte-h":!0}),T(u)!=="svelte-1dvlo65"&&(u.innerHTML=H),w=o(t),c=s(t,"P",{"data-svelte-h":!0}),T(c)!=="svelte-q2ub0c"&&(c.innerHTML=G),$=o(t),U(g.$$.fragment,t),L=o(t),v=s(t,"P",{}),S(v).forEach(a),this.h()},h(){D(r,"name","hf:doc:metadata"),D(r,"content",Z)},m(t,e){Q(document.head,r),l(t,d,e),l(t,b,e),l(t,x,e),O(p,t,e),l(t,y,e),l(t,h,e),l(t,E,e),l(t,m,e),l(t,P,e),l(t,f,e),l(t,_,e),l(t,u,e),l(t,w,e),l(t,c,e),l(t,$,e),O(g,t,e),l(t,L,e),l(t,v,e),M=!0},p:K,i(t){M||(j(p.$$.fragment,t),j(g.$$.fragment,t),M=!0)},o(t){q(p.$$.fragment,t),q(g.$$.fragment,t),M=!1},d(t){t&&(a(d),a(b),a(x),a(y),a(h),a(E),a(m),a(P),a(f),a(_),a(u),a(w),a(c),a($),a(L),a(v)),a(r),z(p,t),z(g,t)}}}const Z='{"title":"基于BERT进行的相关研究（BERTology）","local":"基于bert进行的相关研究bertology","sections":[],"depth":1}';function tt(R){return N(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class rt extends F{constructor(r){super(),W(this,r,tt,Y,I,{})}}export{rt as component};
