mirror of
				https://github.com/labmlai/annotated_deep_learning_paper_implementations.git
				synced 2025-10-31 18:58:43 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			172 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			172 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE html>
 | ||
| <html lang="ja">
 | ||
| <head>
 | ||
|     <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
 | ||
|     <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
 | ||
|     <meta name="description" content="これは、トランスフォーマーと関連技術の PyTorch 実装/チュートリアルのコレクションです。"/>
 | ||
| 
 | ||
|     <meta name="twitter:card" content="summary"/>
 | ||
|     <meta name="twitter:image:src" content="https://avatars1.githubusercontent.com/u/64068543?s=400&v=4"/>
 | ||
|     <meta name="twitter:title" content="トランスフォーマー"/>
 | ||
|     <meta name="twitter:description" content="これは、トランスフォーマーと関連技術の PyTorch 実装/チュートリアルのコレクションです。"/>
 | ||
|     <meta name="twitter:site" content="@labmlai"/>
 | ||
|     <meta name="twitter:creator" content="@labmlai"/>
 | ||
| 
 | ||
|     <meta property="og:url" content="https://nn.labml.ai/transformers/index.html"/>
 | ||
|     <meta property="og:title" content="トランスフォーマー"/>
 | ||
|     <meta property="og:image" content="https://avatars1.githubusercontent.com/u/64068543?s=400&v=4"/>
 | ||
|     <meta property="og:site_name" content="トランスフォーマー"/>
 | ||
|     <meta property="og:type" content="object"/>
 | ||
|     <meta property="og:title" content="トランスフォーマー"/>
 | ||
|     <meta property="og:description" content="これは、トランスフォーマーと関連技術の PyTorch 実装/チュートリアルのコレクションです。"/>
 | ||
| 
 | ||
|     <title>トランスフォーマー</title>
 | ||
|     <link rel="shortcut icon" href="/icon.png"/>
 | ||
|     <link rel="stylesheet" href="../pylit.css?v=1">
 | ||
|     <link rel="canonical" href="https://nn.labml.ai/transformers/index.html"/>
 | ||
|     <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.18/dist/katex.min.css" integrity="sha384-zTROYFVGOfTw7JV7KUu8udsvW2fx4lWOsCEDqhBreBwlHI4ioVRtmIvEThzJHGET" crossorigin="anonymous">
 | ||
| 
 | ||
|     <!-- Global site tag (gtag.js) - Google Analytics -->
 | ||
|     <script async src="https://www.googletagmanager.com/gtag/js?id=G-4V3HC8HBLH"></script>
 | ||
|     <script>
 | ||
|         window.dataLayer = window.dataLayer || [];
 | ||
| 
 | ||
|         function gtag() {
 | ||
|             dataLayer.push(arguments);
 | ||
|         }
 | ||
| 
 | ||
|         gtag('js', new Date());
 | ||
| 
 | ||
|         gtag('config', 'G-4V3HC8HBLH');
 | ||
|     </script>
 | ||
| </head>
 | ||
| <body>
 | ||
| <div id='container'>
 | ||
|     <div id="background"></div>
 | ||
|     <div class='section'>
 | ||
|         <div class='docs'>
 | ||
|             <p>
 | ||
|                 <a class="parent" href="/">home</a>
 | ||
|                 <a class="parent" href="index.html">transformers</a>
 | ||
|             </p>
 | ||
|             <p>
 | ||
|                 <a href="https://github.com/labmlai/annotated_deep_learning_paper_implementations" target="_blank">
 | ||
|                     <img alt="Github"
 | ||
|                          src="https://img.shields.io/github/stars/labmlai/annotated_deep_learning_paper_implementations?style=social"
 | ||
|                          style="max-width:100%;"/></a>
 | ||
|                 <a href="https://twitter.com/labmlai" rel="nofollow" target="_blank">
 | ||
|                     <img alt="Twitter"
 | ||
|                          src="https://img.shields.io/twitter/follow/labmlai?style=social"
 | ||
|                          style="max-width:100%;"/></a>
 | ||
|             </p>
 | ||
|             <p>
 | ||
|                 <a href="https://github.com/labmlai/annotated_deep_learning_paper_implementations/tree/master/labml_nn/transformers/__init__.py" target="_blank">
 | ||
|                     View code on Github</a>
 | ||
|             </p>
 | ||
|         </div>
 | ||
|     </div>
 | ||
|     <div class='section' id='section-0'>
 | ||
|         <div class='docs doc-strings'>
 | ||
|             <div class='section-link'>
 | ||
|                 <a href='#section-0'>#</a>
 | ||
|             </div>
 | ||
|             <h1>トランスフォーマー</h1>
 | ||
| </a><p>このモジュールには、<a href="https://pytorch.org/">PyTorchの実装と、論文「<a href="https://papers.labml.ai/paper/1706.03762">Attention IsAll You Need</a>」に掲載されたオリジナルのトランスフォーマーの説明、およびその派生品と拡張機能が含まれています。</p>
 | ||
| <ul><li><a href="mha.html">マルチヘッドアテンション</a></li>
 | ||
| <li><a href="models.html">トランスエンコーダおよびデコーダモデル</a></li>
 | ||
| <li><a href="feed_forward.html">位置別フィードフォワードネットワーク (FFN)</a></li>
 | ||
| <li><a href="positional_encoding.html">固定位置エンコーディング</a></li></ul>
 | ||
| <h2><a href="xl/index.html">トランスフォーマー XL</a></h2>
 | ||
| <p>これは、<a href="xl/relative_mha.html">相対的なマルチヘッドアテンションを使用したトランスフォーマーXLモデルを実装しています</a>。</p>
 | ||
| <h2><a href="rope/index.html">ロータリーポジショナルエンベディング</a></h2>
 | ||
| <p>これはロータリー・ポジショナル・エンベディング (RoPE) を実装しています。</p>
 | ||
| <h2><a href="alibi/index.html">線形バイアスによる注意</a></h2>
 | ||
| <p>これは、線形バイアス(AliBi)によるアテンションを実装したものです。</p>
 | ||
| <h2><a href="retro/index.html">レトロ</a></h2>
 | ||
| <p>これは検索強化トランスフォーマー (RETRO) を実装しています。</p>
 | ||
| <h2><a href="compressive/index.html">圧縮変圧器</a></h2>
 | ||
| <p>これは圧縮トランスフォーマーの実装で、<a href="xl/index.html">Transformer XLを拡張したもので</a>、最も古いメモリを圧縮してアテンションスパンを長くします。</p>
 | ||
| <h2><a href="gpt/index.html">GPT アーキテクチャ</a></h2>
 | ||
| <p>これは GPT-2 アーキテクチャの実装です。</p>
 | ||
| <h2><a href="glu_variants/simple.html">GLU バリアント</a></h2>
 | ||
| <p>これは論文「<a href="https://papers.labml.ai/paper/2002.05202">GLUバリアント改良トランスフォーマー</a>」の実装です。</p>
 | ||
| <h2><a href="knn/index.html">KNN-LM</a></h2>
 | ||
| <p>これは、「<a href="https://papers.labml.ai/paper/1911.00172">記憶による一般化:最近傍言語モデル</a>」という論文の実装です。</p>
 | ||
| <h2><a href="feedback/index.html">フィードバック変圧器</a></h2>
 | ||
| <p>これは、「<a href="https://papers.labml.ai/paper/2002.09402">フィードバックメモリを用いたシーケンシャル・トランスフォーマーの高位表現へのアクセス」という論文の実装です</a>。</p>
 | ||
| <h2><a href="switch/index.html">スイッチトランス</a></h2>
 | ||
| <p>これは、論文の「<a href="https://papers.labml.ai/paper/2101.03961">スイッチトランスフォーマー:シンプルで効率的なスパース性を備えた1兆パラメータモデルへのスケーリング</a>」のミニチュア実装です。私たちの実装には数百万のパラメーターしかなく、モデルの並列分散トレーニングは行いません。シングルGPUトレーニングを行いますが、論文で説明されているようにスイッチングの概念を実装しています</p>。
 | ||
| <h2><a href="fast_weights/index.html">高速ウェイトトランス</a></h2>
 | ||
| <p>これは、PyTorchの論文「<a href="https://papers.labml.ai/paper/2102.11174">リニアトランスフォーマーは密かに高速ウェイトメモリシステム」の実装です</a>。</p>
 | ||
| <h2><a href="fnet/index.html">FNet: フーリエ変換によるトークンの混合</a></h2>
 | ||
| <p>これは論文「<a href="https://papers.labml.ai/paper/2105.03824">FNet: トークンをフーリエ変換と混合する</a>」の実装です。</p>
 | ||
| <h2><a href="aft/index.html">アテンションフリー変圧器</a></h2>
 | ||
| <p>これは論文「<a href="https://papers.labml.ai/paper/2105.14103">アテンション・フリー・トランスフォーマー</a>」の実装です。</p>
 | ||
| <h2><a href="mlm/index.html">マスク言語モデル</a></h2>
 | ||
| <p>これは、論文「<a href="https://papers.labml.ai/paper/1810.04805">BERT:言語理解のためのディープ双方向トランスフォーマーの事前トレーニング」の事前トレーニングに使用されたマスク言語モデルの実装です</a>。</p>
 | ||
| <h2><a href="mlp_mixer/index.html">MLPミキサー:ビジョン用のオールMLPアーキテクチャ</a></h2>
 | ||
| <p>これは、論文「<a href="https://papers.labml.ai/paper/2105.01601">MLPミキサー:ビジョン用のオールMLPアーキテクチャ</a>」の実装です。</p>
 | ||
| <h2><a href="gmlp/index.html">MLP (GMLP) にご注意ください</a></h2>
 | ||
| <p>これは、論文「<a href="https://papers.labml.ai/paper/2105.08050">MLPに注意を払う</a>」の実装です。</p>
 | ||
| <h2><a href="vit/index.html">ビジョントランスフォーマー (ViT)</a></h2>
 | ||
| <p>これは、「<a href="https://papers.labml.ai/paper/2010.11929">画像は16x16の言葉に値する」という論文「大規模画像認識のためのトランスフォーマー」の実装です。</a></p>
 | ||
| <h2><a href="primer_ez/index.html">プライマー EZ</a></h2>
 | ||
| <p>これは、「<a href="https://papers.labml.ai/paper/2109.08668">入門書:言語モデリングのための効率的なトランスフォーマーの探求」という論文の実装です</a>。</p>
 | ||
| <h2><a href="hour_glass/index.html">砂時計</a></h2>
 | ||
| <p>これは、「<a href="https://papers.labml.ai/paper/2110.13711">階層型トランスフォーマーはより効率的な言語モデル</a>」という論文の実装です。</p>
 | ||
| 
 | ||
|         </div>
 | ||
|         <div class='code'>
 | ||
|             <div class="highlight"><pre><span class="lineno">112</span><span></span><span class="kn">from</span> <span class="nn">.configs</span> <span class="kn">import</span> <span class="n">TransformerConfigs</span>
 | ||
| <span class="lineno">113</span><span class="kn">from</span> <span class="nn">.models</span> <span class="kn">import</span> <span class="n">TransformerLayer</span><span class="p">,</span> <span class="n">Encoder</span><span class="p">,</span> <span class="n">Decoder</span><span class="p">,</span> <span class="n">Generator</span><span class="p">,</span> <span class="n">EncoderDecoder</span>
 | ||
| <span class="lineno">114</span><span class="kn">from</span> <span class="nn">.mha</span> <span class="kn">import</span> <span class="n">MultiHeadAttention</span>
 | ||
| <span class="lineno">115</span><span class="kn">from</span> <span class="nn">labml_nn.transformers.xl.relative_mha</span> <span class="kn">import</span> <span class="n">RelativeMultiHeadAttention</span></pre></div>
 | ||
|         </div>
 | ||
|     </div>
 | ||
|     <div class='footer'>
 | ||
|         <a href="https://papers.labml.ai">Trending Research Papers</a>
 | ||
|         <a href="https://labml.ai">labml.ai</a>
 | ||
|     </div>
 | ||
| </div>
 | ||
| <script src=../interactive.js?v=1"></script>
 | ||
| <script>
 | ||
|     function handleImages() {
 | ||
|         var images = document.querySelectorAll('p>img')
 | ||
| 
 | ||
|         for (var i = 0; i < images.length; ++i) {
 | ||
|             handleImage(images[i])
 | ||
|         }
 | ||
|     }
 | ||
| 
 | ||
|     function handleImage(img) {
 | ||
|         img.parentElement.style.textAlign = 'center'
 | ||
| 
 | ||
|         var modal = document.createElement('div')
 | ||
|         modal.id = 'modal'
 | ||
| 
 | ||
|         var modalContent = document.createElement('div')
 | ||
|         modal.appendChild(modalContent)
 | ||
| 
 | ||
|         var modalImage = document.createElement('img')
 | ||
|         modalContent.appendChild(modalImage)
 | ||
| 
 | ||
|         var span = document.createElement('span')
 | ||
|         span.classList.add('close')
 | ||
|         span.textContent = 'x'
 | ||
|         modal.appendChild(span)
 | ||
| 
 | ||
|         img.onclick = function () {
 | ||
|             console.log('clicked')
 | ||
|             document.body.appendChild(modal)
 | ||
|             modalImage.src = img.src
 | ||
|         }
 | ||
| 
 | ||
|         span.onclick = function () {
 | ||
|             document.body.removeChild(modal)
 | ||
|         }
 | ||
|     }
 | ||
| 
 | ||
|     handleImages()
 | ||
| </script>
 | ||
| </body>
 | ||
| </html> | 
