novice03 commited on
Commit
405ccb8
1 Parent(s): b5fda90

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +40 -1
README.md CHANGED
@@ -1 +1,40 @@
1
- Nystromformer for sequence length 512
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Nyströmformer
2
+
3
+ Nyströmformer model for masked language modeling (MLM) pretrained on BookCorpus and English Wikipedia for sequence length 512.
4
+
5
+ ## About Nyströmformer
6
+
7
+ The Nyströmformer model was proposed in [Nyströmformer: A Nyström-Based Algorithm for Approximating Self-Attention](https://arxiv.org/abs/2102.03902) by Yunyang Xiong, Zhanpeng Zeng, Rudrasis Chakraborty, Mingxing Tan, Glenn Fung, Yin Li, and Vikas Singh.
8
+
9
+ The abstract from the paper is the following:
10
+
11
+ Transformers have emerged as a powerful tool for a broad range of natural language processing tasks. A key component that drives the impressive performance of Transformers is the self-attention mechanism that encodes the influence or dependence of other tokens on each specific token. While beneficial, the quadratic complexity of self-attention on the input sequence length has limited its application to longer sequences — a topic being actively studied in the community. To address this limitation, we propose Nyströmformer — a model that exhibits favorable scalability as a function of sequence length. Our idea is based on adapting the Nyström method to approximate standard self-attention with O(n) complexity. The scalability of Nyströmformer enables application to longer sequences with thousands of tokens. We perform evaluations on multiple downstream tasks on the GLUE benchmark and IMDB reviews with standard sequence length, and find that our Nyströmformer performs comparably, or in a few cases, even slightly better, than standard self-attention. On longer sequence tasks in the Long Range Arena (LRA) benchmark, Nyströmformer performs favorably relative to other efficient self-attention methods. Our code is available at this https URL.
12
+
13
+ ## Usage
14
+
15
+ ```python
16
+ >>> from transformers import pipeline
17
+ >>> unmasker = pipeline('fill-mask', model='uw-madison/nystromformer-512')
18
+ >>> unmasker("Paris is the [MASK] of France.")
19
+
20
+ [{'score': 0.829957902431488,
21
+ 'token': 1030,
22
+ 'token_str': 'capital',
23
+ 'sequence': 'paris is the capital of france.'},
24
+ {'score': 0.022157637402415276,
25
+ 'token': 16081,
26
+ 'token_str': 'birthplace',
27
+ 'sequence': 'paris is the birthplace of france.'},
28
+ {'score': 0.01904447190463543,
29
+ 'token': 197,
30
+ 'token_str': 'name',
31
+ 'sequence': 'paris is the name of france.'},
32
+ {'score': 0.017583081498742104,
33
+ 'token': 1107,
34
+ 'token_str': 'kingdom',
35
+ 'sequence': 'paris is the kingdom of france.'},
36
+ {'score': 0.005948934704065323,
37
+ 'token': 148,
38
+ 'token_str': 'city',
39
+ 'sequence': 'paris is the city of france.'}]
40
+ ```