README.md
16.8 KB · 289 lines · markdown Raw
1 ---
2 language:
3 - en
4 license: apache-2.0
5 library_name: transformers
6 tags:
7 - lay summaries
8 - paper summaries
9 - biology
10 - medical
11 datasets:
12 - pszemraj/scientific_lay_summarisation-plos-norm
13 widget:
14 - text: large earthquakes along a given fault segment do not occur at random intervals
15 because it takes time to accumulate the strain energy for the rupture. The rates
16 at which tectonic plates move and accumulate strain at their boundaries are approximately
17 uniform. Therefore, in first approximation, one may expect that large ruptures
18 of the same fault segment will occur at approximately constant time intervals.
19 If subsequent main shocks have different amounts of slip across the fault, then
20 the recurrence time may vary, and the basic idea of periodic mainshocks must be
21 modified. For great plate boundary ruptures the length and slip often vary by
22 a factor of 2. Along the southern segment of the San Andreas fault the recurrence
23 interval is 145 years with variations of several decades. The smaller the standard
24 deviation of the average recurrence interval, the more specific could be the long
25 term prediction of a future mainshock.
26 example_title: earthquakes
27 - text: ' A typical feed-forward neural field algorithm. Spatiotemporal coordinates
28 are fed into a neural network that predicts values in the reconstructed domain.
29 Then, this domain is mapped to the sensor domain where sensor measurements are
30 available as supervision. Class and Section Problems Addressed Generalization
31 (Section 2) Inverse problems, ill-posed problems, editability; symmetries. Hybrid
32 Representations (Section 3) Computation & memory efficiency, representation capacity,
33 editability: Forward Maps (Section 4) Inverse problems Network Architecture (Section
34 5) Spectral bias, integration & derivatives. Manipulating Neural Fields (Section
35 6) Edit ability, constraints, regularization. Table 2: The five classes of techniques
36 in the neural field toolbox each addresses problems that arise in learning, inference,
37 and control. (Section 3). We can supervise reconstruction via differentiable forward
38 maps that transform Or project our domain (e.g, 3D reconstruction via 2D images;
39 Section 4) With appropriate network architecture choices, we can overcome neural
40 network spectral biases (blurriness) and efficiently compute derivatives and integrals
41 (Section 5). Finally, we can manipulate neural fields to add constraints and regularizations,
42 and to achieve editable representations (Section 6). Collectively, these classes
43 constitute a ''toolbox'' of techniques to help solve problems with neural fields
44 There are three components in a conditional neural field: (1) An encoder or inference
45 function € that outputs the conditioning latent variable 2 given an observation
46 0 E(0) =2. 2 is typically a low-dimensional vector, and is often referred to aS
47 a latent code Or feature code_ (2) A mapping function 4 between Z and neural field
48 parameters O: Y(z) = O; (3) The neural field itself $. The encoder € finds the
49 most probable z given the observations O: argmaxz P(2/0). The decoder maximizes
50 the inverse conditional probability to find the most probable 0 given Z: arg-
51 max P(Olz). We discuss different encoding schemes with different optimality guarantees
52 (Section 2.1.1), both global and local conditioning (Section 2.1.2), and different
53 mapping functions Y (Section 2.1.3) 2. Generalization Suppose we wish to estimate
54 a plausible 3D surface shape given a partial or noisy point cloud. We need a suitable
55 prior over the sur- face in its reconstruction domain to generalize to the partial
56 observations. A neural network expresses a prior via the function space of its
57 architecture and parameters 0, and generalization is influenced by the inductive
58 bias of this function space (Section 5).'
59 example_title: scientific paper
60 - text: 'Is a else or outside the cob and tree written being of early client rope
61 and you have is for good reasons. On to the ocean in Orange for time. By''s the
62 aggregate we can bed it yet. Why this please pick up on a sort is do and also
63 M Getoi''s nerocos and do rain become you to let so is his brother is made in
64 use and Mjulia''s''s the lay major is aging Masastup coin present sea only of
65 Oosii rooms set to you We do er do we easy this private oliiishs lonthen might
66 be okay. Good afternoon everybody. Welcome to this lecture of Computational Statistics.
67 As you can see, I''m not socially my name is Michael Zelinger. I''m one of the
68 task for this class and you might have already seen me in the first lecture where
69 I made a quick appearance. I''m also going to give the tortillas in the last third
70 of this course. So to give you a little bit about me, I''m a old student here
71 with better Bulman and my research centres on casual inference applied to biomedical
72 disasters, so that could be genomics or that could be hospital data. If any of
73 you is interested in writing a bachelor thesis, a semester paper may be mastathesis
74 about this topic feel for reach out to me. you have my name on models and my email
75 address you can find in the directory I''d Be very happy to talk about it. you
76 do not need to be sure about it, we can just have a chat. So with that said, let''s
77 get on with the lecture. There''s an exciting topic today I''m going to start
78 by sharing some slides with you and later on during the lecture we''ll move to
79 the paper. So bear with me for a few seconds. Well, the projector is starting
80 up. Okay, so let''s get started. Today''s topic is a very important one. It''s
81 about a technique which really forms one of the fundamentals of data science,
82 machine learning, and any sort of modern statistics. It''s called cross validation.
83 I know you really want to understand this topic I Want you to understand this
84 and frankly, nobody''s gonna leave Professor Mineshousen''s class without understanding
85 cross validation. So to set the stage for this, I Want to introduce you to the
86 validation problem in computational statistics. So the problem is the following:
87 You trained a model on available data. You fitted your model, but you know the
88 training data you got could always have been different and some data from the
89 environment. Maybe it''s a random process. You do not really know what it is,
90 but you know that somebody else who gets a different batch of data from the same
91 environment they would get slightly different training data and you do not care
92 that your method performs as well. On this training data. you want to to perform
93 well on other data that you have not seen other data from the same environment.
94 So in other words, the validation problem is you want to quantify the performance
95 of your model on data that you have not seen. So how is this even possible? How
96 could you possibly measure the performance on data that you do not know The solution
97 to? This is the following realization is that given that you have a bunch of data,
98 you were in charge. You get to control how much that your model sees. It works
99 in the following way: You can hide data firms model. Let''s say you have a training
100 data set which is a bunch of doubtless so X eyes are the features those are typically
101 hide and national vector. It''s got more than one dimension for sure. And the
102 why why eyes. Those are the labels for supervised learning. As you''ve seen before,
103 it''s the same set up as we have in regression. And so you have this training
104 data and now you choose that you only use some of those data to fit your model.
105 You''re not going to use everything, you only use some of it the other part you
106 hide from your model. And then you can use this hidden data to do validation from
107 the point of you of your model. This hidden data is complete by unseen. In other
108 words, we solve our problem of validation.'
109 example_title: transcribed audio - lecture
110 - text: 'Transformer-based models have shown to be very useful for many NLP tasks.
111 However, a major limitation of transformers-based models is its O(n^2)O(n 2) time
112 & memory complexity (where nn is sequence length). Hence, it''s computationally
113 very expensive to apply transformer-based models on long sequences n > 512n>512.
114 Several recent papers, e.g. Longformer, Performer, Reformer, Clustered attention
115 try to remedy this problem by approximating the full attention matrix. You can
116 checkout 🤗''s recent blog post in case you are unfamiliar with these models.
117
118 BigBird (introduced in paper) is one of such recent models to address this issue.
119 BigBird relies on block sparse attention instead of normal attention (i.e. BERT''s
120 attention) and can handle sequences up to a length of 4096 at a much lower computational
121 cost compared to BERT. It has achieved SOTA on various tasks involving very long
122 sequences such as long documents summarization, question-answering with long contexts.
123
124 BigBird RoBERTa-like model is now available in 🤗Transformers. The goal of this
125 post is to give the reader an in-depth understanding of big bird implementation
126 & ease one''s life in using BigBird with 🤗Transformers. But, before going into
127 more depth, it is important to remember that the BigBird''s attention is an approximation
128 of BERT''s full attention and therefore does not strive to be better than BERT''s
129 full attention, but rather to be more efficient. It simply allows to apply transformer-based
130 models to much longer sequences since BERT''s quadratic memory requirement quickly
131 becomes unbearable. Simply put, if we would have ∞ compute & ∞ time, BERT''s attention
132 would be preferred over block sparse attention (which we are going to discuss
133 in this post).
134
135 If you wonder why we need more compute when working with longer sequences, this
136 blog post is just right for you!
137
138 Some of the main questions one might have when working with standard BERT-like
139 attention include:
140
141 Do all tokens really have to attend to all other tokens? Why not compute attention
142 only over important tokens? How to decide what tokens are important? How to attend
143 to just a few tokens in a very efficient way? In this blog post, we will try to
144 answer those questions.
145
146 What tokens should be attended to? We will give a practical example of how attention
147 works by considering the sentence ''BigBird is now available in HuggingFace for
148 extractive question answering''. In BERT-like attention, every word would simply
149 attend to all other tokens.
150
151 Let''s think about a sensible choice of key tokens that a queried token actually
152 only should attend to by writing some pseudo-code. Will will assume that the token
153 available is queried and build a sensible list of key tokens to attend to.
154
155 >>> # let''s consider following sentence as an example >>> example = [''BigBird'',
156 ''is'', ''now'', ''available'', ''in'', ''HuggingFace'', ''for'', ''extractive'',
157 ''question'', ''answering'']
158
159 >>> # further let''s assume, we''re trying to understand the representation of
160 ''available'' i.e. >>> query_token = ''available'' >>> # We will initialize an
161 empty `set` and fill up the tokens of our interest as we proceed in this section.
162 >>> key_tokens = [] # => currently ''available'' token doesn''t have anything
163 to attend Nearby tokens should be important because, in a sentence (sequence of
164 words), the current word is highly dependent on neighboring past & future tokens.
165 This intuition is the idea behind the concept of sliding attention.'
166 example_title: bigbird blog intro
167 - text: 'To be fair, you have to have a very high IQ to understand Rick and Morty.
168 The humour is extremely subtle, and without a solid grasp of theoretical physics
169 most of the jokes will go over a typical viewer''s head. There''s also Rick''s
170 nihilistic outlook, which is deftly woven into his characterisation- his personal
171 philosophy draws heavily from Narodnaya Volya literature, for instance. The fans
172 understand this stuff; they have the intellectual capacity to truly appreciate
173 the depths of these jokes, to realise that they''re not just funny- they say something
174 deep about LIFE. As a consequence people who dislike Rick & Morty truly ARE idiots-
175 of course they wouldn''t appreciate, for instance, the humour in Rick''s existential
176 catchphrase ''Wubba Lubba Dub Dub,'' which itself is a cryptic reference to Turgenev''s
177 Russian epic Fathers and Sons. I''m smirking right now just imagining one of those
178 addlepated simpletons scratching their heads in confusion as Dan Harmon''s genius
179 wit unfolds itself on their television screens. What fools.. how I pity them.
180 😂
181
182 And yes, by the way, i DO have a Rick & Morty tattoo. And no, you cannot see it.
183 It''s for the ladies'' eyes only- and even then they have to demonstrate that
184 they''re within 5 IQ points of my own (preferably lower) beforehand. Nothin personnel
185 kid 😎'
186 example_title: Richard & Mortimer
187 - text: The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey
188 building, and the tallest structure in Paris. Its base is square, measuring 125
189 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed
190 the Washington Monument to become the tallest man-made structure in the world,
191 a title it held for 41 years until the Chrysler Building in New York City was
192 finished in 1930. It was the first structure to reach a height of 300 metres.
193 Due to the addition of a broadcasting aerial at the top of the tower in 1957,
194 it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters,
195 the Eiffel Tower is the second tallest free-standing structure in France after
196 the Millau Viaduct.
197 example_title: eiffel
198 parameters:
199 max_length: 64
200 min_length: 8
201 no_repeat_ngram_size: 3
202 early_stopping: true
203 repetition_penalty: 3.5
204 encoder_no_repeat_ngram_size: 4
205 length_penalty: 0.4
206 num_beams: 4
207 pipeline_tag: summarization
208 base_model: google/long-t5-tglobal-base
209 ---
210
211 # long-t5-tglobal-base-sci-simplify
212
213 <a href="https://colab.research.google.com/gist/pszemraj/f0dc02c4d4a5c7ad1d5bf3953251145d/long-t5-tglobal-base-sci-simplify-plos-example-with-textsum.ipynb">
214 <img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/>
215 </a>
216
217 Exploring how well long-document models trained on "lay summaries" of scientific papers generalize.
218
219 > A lay summary is a summary of a research paper or scientific study that is written in plain language, without the use of technical jargon, and is designed to be easily understood by non-experts.
220
221 ## Model description
222
223 This model is a fine-tuned version of [google/long-t5-tglobal-base](https://huggingface.co/google/long-t5-tglobal-base) on the `pszemraj/scientific_lay_summarisation-plos-norm` dataset for two epochs.
224
225 - The variant trained on the ELIFE subset can be found [here](https://huggingface.co/pszemraj/long-t5-tglobal-base-sci-simplify-elife)
226
227 ## Usage
228
229 It's recommended to use this model with [beam search decoding](https://huggingface.co/docs/transformers/generation_strategies#beamsearch-decoding). If you are interested, you can also use the `textsum` util repo to have most of this abstracted for you:
230
231
232 Install with `pip`:
233
234 ```bash
235 pip install -U textsum
236 ```
237
238 Use in python:
239
240 ```python
241 from textsum.summarize import Summarizer
242
243 summarizer = Summarizer('pszemraj/long-t5-tglobal-base-sci-simplify')
244 text = "put the text you don't want to read here"
245 summary = summarizer.summarize_string(text)
246 print(summary)
247 ```
248
249 ## Intended uses & limitations
250
251 - Ability to generalize outside of the dataset domain (pubmed/bioscience type papers) has to be evaluated.
252
253
254 ## Training procedure
255
256
257 ### Eval results
258
259 It achieves the following results on the evaluation set:
260 - Loss: 1.6778
261 - Rouge1: 49.1475
262 - Rouge2: 18.9281
263 - Rougel: 26.9893
264 - Rougelsum: 45.0973
265 - Gen Len: 399.4125
266
267 ### Training hyperparameters
268
269 The following hyperparameters were used during training:
270 - learning_rate: 0.0004
271 - train_batch_size: 4
272 - eval_batch_size: 2
273 - seed: 42
274 - distributed_type: multi-GPU
275 - gradient_accumulation_steps: 16
276 - total_train_batch_size: 64
277 - optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
278 - lr_scheduler_type: cosine
279 - lr_scheduler_warmup_ratio: 0.01
280 - num_epochs: 2.0
281
282 ### Training results
283
284 | Training Loss | Epoch | Step | Validation Loss | Rouge1 | Rouge2 | Rougel | Rougelsum | Gen Len |
285 |:-------------:|:-----:|:----:|:---------------:|:-------:|:-------:|:-------:|:---------:|:--------:|
286 | 1.966 | 0.52 | 200 | 1.7171 | 48.6521 | 18.427 | 26.7726 | 44.3947 | 376.335 |
287 | 1.877 | 1.03 | 400 | 1.6909 | 49.3263 | 18.7945 | 27.0741 | 45.1737 | 382.205 |
288 | 1.9007 | 1.55 | 600 | 1.6778 | 49.1475 | 18.9281 | 26.9893 | 45.0973 | 399.4125 |
289