gchhablani commited on
Commit
208aaa2
1 Parent(s): 72ca60f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +10 -3
README.md CHANGED
@@ -17,7 +17,7 @@ Disclaimer: This model card has been written by [gchhablani](https://huggingface
17
 
18
  ## Model description
19
 
20
- FNet is a transformers model with attention replaced with fourier transforms. It is pretrained on a large corpus of
21
  English data in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling
22
  them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and
23
  labels from those texts. More precisely, it was pretrained with two objectives:
@@ -53,6 +53,8 @@ generation you should look at model like GPT2.
53
 
54
  You can use this model directly with a pipeline for masked language modeling:
55
 
 
 
56
  ```python
57
  >>> from transformers import FNetForMaskedLM, FNetTokenizer, pipeline
58
  >>> tokenizer = FNetTokenizer.from_pretrained("google/fnet-large")
@@ -72,12 +74,14 @@ You can use this model directly with a pipeline for masked language modeling:
72
 
73
  Here is how to use this model to get the features of a given text in PyTorch:
74
 
 
 
75
  ```python
76
  from transformers import FNetTokenizer, FNetModel
77
  tokenizer = FNetTokenizer.from_pretrained("google/fnet-large")
78
  model = FNetModel.from_pretrained("google/fnet-large")
79
  text = "Replace me by any text you'd like."
80
- encoded_input = tokenizer(text, return_tensors='pt')
81
  output = model(**encoded_input)
82
  ```
83
 
@@ -176,4 +180,7 @@ Glue test results:
176
  biburl = {https://dblp.org/rec/journals/corr/abs-2105-03824.bib},
177
  bibsource = {dblp computer science bibliography, https://dblp.org}
178
  }
179
- ```
 
 
 
 
17
 
18
  ## Model description
19
 
20
+ FNet is a transformers model with attention replaced with fourier transforms. Hence, the inputs do not contain an `attention_mask`. It is pretrained on a large corpus of
21
  English data in a self-supervised fashion. This means it was pretrained on the raw texts only, with no humans labelling
22
  them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and
23
  labels from those texts. More precisely, it was pretrained with two objectives:
 
53
 
54
  You can use this model directly with a pipeline for masked language modeling:
55
 
56
+ **Note: The mask filling pipeline doesn't work exactly as the original model performs masking after converting to tokens. In masking pipeline an additional space is added after the [MASK].**
57
+
58
  ```python
59
  >>> from transformers import FNetForMaskedLM, FNetTokenizer, pipeline
60
  >>> tokenizer = FNetTokenizer.from_pretrained("google/fnet-large")
 
74
 
75
  Here is how to use this model to get the features of a given text in PyTorch:
76
 
77
+ **Note: You must specify the maximum sequence length to be 512 and truncate/pad to the same length because the original model has no attention mask and considers all the hidden states during forward pass.**
78
+
79
  ```python
80
  from transformers import FNetTokenizer, FNetModel
81
  tokenizer = FNetTokenizer.from_pretrained("google/fnet-large")
82
  model = FNetModel.from_pretrained("google/fnet-large")
83
  text = "Replace me by any text you'd like."
84
+ encoded_input = tokenizer(text, return_tensors='pt', padding='max_length', truncation=True, max_length=512)
85
  output = model(**encoded_input)
86
  ```
87
 
 
180
  biburl = {https://dblp.org/rec/journals/corr/abs-2105-03824.bib},
181
  bibsource = {dblp computer science bibliography, https://dblp.org}
182
  }
183
+ ```
184
+
185
+ ## Contributions
186
+ Thanks to [@gchhablani](https://huggingface.co/gchhablani). for adding this model.