zhichao yang commited on
Commit
cd814cf
1 Parent(s): 10e55b6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +409 -0
README.md CHANGED
@@ -1,3 +1,412 @@
1
  ---
2
  license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+
5
+ ## Introduction
6
+ [Google's LongT5: Efficient Text-To-Text Transformer for Long Sequences](https://arxiv.org/pdf/2112.07916.pdf).
7
+
8
+ This is an unofficial longt5-large-16384-pubmed-10k_steps checkpoint. I.e., this is a large configuration of the LongT5 model with a transient-global attention fine-tuned on pubmed summarization dataset for 10,000 training steps.
9
+
10
+ ## Results and Fine-tuning Details
11
+
12
+ The fine-tuned model achieves the following results on the evaluation set using `beam_search=1` and without any specific calibration of generation parameters are presented below, altogether with the results from the original paper (the original scores are higher, very likely due to a higher number of training steps).
13
+
14
+ | Metric | Score | Score (original paper)
15
+ | --- | --- | --- |
16
+ | Rouge-1 | 49.11 | 49.98 |
17
+ | Rouge-2 | 23.66 | 24.69 |
18
+ | Rouge-L | 31.19 | x |
19
+ | Rouge-Lsum | 45.87 | 46.46 |
20
+
21
+ Following previous [setup](https://huggingface.co/Stancld/longt5-tglobal-large-16384-pubmed-3k_steps/), the training parameters follow the ones specified in the paper. We accumulated batch size to 128 examples and used `Adafactor` optimizer with a constant learning rate `0.001`. The training took about 14 days on 2 A100 GPUs.
22
+
23
+ The only specific adjustment, I made for the training, was to pad very short input articles (less than 16 tokens) to at least 16 tokens as this sequences do not contribute to gradient creation in the *transient-global* attention, which resulted in training crashes when DDP used.
24
+
25
+ ## Usage
26
+
27
+ ```python
28
+ LONG_ARTICLE = """"anxiety affects quality of life in those living
29
+ with parkinson 's disease ( pd ) more so than
30
+ overall cognitive status , motor deficits , apathy
31
+ , and depression [ 13 ] . although anxiety and
32
+ depression are often related and coexist in pd
33
+ patients , recent research suggests that anxiety
34
+ rather than depression is the most prominent and
35
+ prevalent mood disorder in pd [ 5 , 6 ] . yet ,
36
+ our current understanding of anxiety and its
37
+ impact on cognition in pd , as well as its neural
38
+ basis and best treatment practices , remains
39
+ meager and lags far behind that of depression .
40
+ overall , neuropsychiatric symptoms in pd have
41
+ been shown to be negatively associated with
42
+ cognitive performance . for example , higher
43
+ depression scores have been correlated with lower
44
+ scores on the mini - mental state exam ( mmse ) [
45
+ 8 , 9 ] as well as tests of memory and executive
46
+ functions ( e.g. , attention ) [ 1014 ] . likewise
47
+ , apathy and anhedonia in pd patients have been
48
+ associated with executive dysfunction [ 10 , 1523
49
+ ] . however , few studies have specifically
50
+ investigated the relationship between anxiety and
51
+ cognition in pd . one study showed a strong
52
+ negative relationship between anxiety ( both state
53
+ and trait ) and overall cognitive performance (
54
+ measured by the total of the repeatable battery
55
+ for the assessment of neuropsychological status
56
+ index ) within a sample of 27 pd patients .
57
+ furthermore , trait anxiety was negatively
58
+ associated with each of the cognitive domains
59
+ assessed by the rbans ( i.e. , immediate memory ,
60
+ visuospatial construction , language , attention ,
61
+ and delayed memory ) . two further studies have
62
+ examined whether anxiety differentially affects
63
+ cognition in patients with left - sided dominant
64
+ pd ( lpd ) versus right - sided dominant pd ( rpd
65
+ ) ; however , their findings were inconsistent .
66
+ the first study found that working memory
67
+ performance was worse in lpd patients with anxiety
68
+ compared to rpd patients with anxiety , whereas
69
+ the second study reported that , in lpd , apathy
70
+ but not anxiety was associated with performance on
71
+ nonverbally mediated executive functions and
72
+ visuospatial tasks ( e.g. , tmt - b , wms - iii
73
+ spatial span ) , while in rpd , anxiety but not
74
+ apathy significantly correlated with performance
75
+ on verbally mediated tasks ( e.g. , clock reading
76
+ test and boston naming test ) . furthermore ,
77
+ anxiety was significantly correlated with
78
+ neuropsychological measures of attention and
79
+ executive and visuospatial functions . taken
80
+ together , it is evident that there are limited
81
+ and inconsistent findings describing the
82
+ relationship between anxiety and cognition in pd
83
+ and more specifically how anxiety might influence
84
+ particular domains of cognition such as attention
85
+ and memory and executive functioning . it is also
86
+ striking that , to date , no study has examined
87
+ the influence of anxiety on cognition in pd by
88
+ directly comparing groups of pd patients with and
89
+ without anxiety while excluding depression . given
90
+ that research on healthy young adults suggests
91
+ that anxiety reduces processing capacity and
92
+ impairs processing efficiency , especially in the
93
+ central executive and attentional systems of
94
+ working memory [ 26 , 27 ] , we hypothesized that
95
+ pd patients with anxiety would show impairments in
96
+ attentional set - shifting and working memory
97
+ compared to pd patients without anxiety .
98
+ furthermore , since previous work , albeit limited
99
+ , has focused on the influence of symptom
100
+ laterality on anxiety and cognition , we also
101
+ explored this relationship . seventeen pd patients
102
+ with anxiety and thirty - three pd patients
103
+ without anxiety were included in this study ( see
104
+ table 1 ) . the cross - sectional data from these
105
+ participants was taken from a patient database
106
+ that has been compiled over the past 8 years (
107
+ since 2008 ) at the parkinson 's disease research
108
+ clinic at the brain and mind centre , university
109
+ of sydney . inclusion criteria involved a
110
+ diagnosis of idiopathic pd according to the united
111
+ kingdom parkinson 's disease society brain bank
112
+ criteria and were confirmed by a neurologist (
113
+ sjgl ) . patients also had to have an adequate
114
+ proficiency in english and have completed a full
115
+ neuropsychological assessment . ten patients in
116
+ this study ( 5 pd with anxiety ; 5 pd without
117
+ anxiety ) were taking psychotropic drugs ( i.e. ,
118
+ benzodiazepine or selective serotonin reuptake
119
+ inhibitor ) . patients were also excluded if they
120
+ had other neurological disorders , psychiatric
121
+ disorders other than affective disorders ( such as
122
+ anxiety ) , or if they reported a score greater
123
+ than six on the depression subscale of the
124
+ hospital anxiety and depression scale ( hads ) .
125
+ thus , all participants who scored within a
126
+ depressed ( hads - d > 6 ) range were excluded
127
+ from this study , in attempt to examine a refined
128
+ sample of pd patients with and without anxiety in
129
+ order to determine the independent effect of
130
+ anxiety on cognition . this research was approved
131
+ by the human research ethics committee of the
132
+ university of sydney , and written informed
133
+ consent was obtained from all participants . self
134
+ - reported hads was used to assess anxiety in pd
135
+ and has been previously shown to be a useful
136
+ measure of clinical anxiety in pd . a cut - off
137
+ score of > 8 on the anxiety subscale of the hads (
138
+ hads - a ) was used to identify pd cases with
139
+ anxiety ( pda+ ) , while a cut - off score of < 6
140
+ on the hads - a was used to identify pd cases
141
+ without anxiety ( pda ) . this criterion was more
142
+ stringent than usual ( > 7 cut - off score ) , in
143
+ effort to create distinct patient groups . the
144
+ neurological evaluation rated participants
145
+ according to hoehn and yahr ( h&y ) stages and
146
+ assessed their motor symptoms using part iii of
147
+ the revised mds task force unified parkinson 's
148
+ disease rating scale ( updrs ) . in a similar way
149
+ this was determined by calculating a total left
150
+ and right score from rigidity items 3035 ,
151
+ voluntary movement items 3643 , and tremor items
152
+ 5057 from the mds - updrs part iii ( see table 1 )
153
+ . processing speed was assessed using the trail
154
+ making test , part a ( tmt - a , z - score ) .
155
+ attentional set - shifting was measured using the
156
+ trail making test , part b ( tmt - b , z - score )
157
+ . working memory was assessed using the digit span
158
+ forward and backward subtest of the wechsler
159
+ memory scale - iii ( raw scores ) . language was
160
+ assessed with semantic and phonemic verbal fluency
161
+ via the controlled oral word associated test (
162
+ cowat animals and letters , z - score ) . the
163
+ ability to retain learned verbal memory was
164
+ assessed using the logical memory subtest from the
165
+ wechsler memory scale - iii ( lm - i z - score ,
166
+ lm - ii z - score , % lm retention z - score ) .
167
+ the mini - mental state examination ( mmse )
168
+ demographic , clinical , and neuropsychological
169
+ variables were compared between the two groups
170
+ with the independent t - test or mann whitney u
171
+ test , depending on whether the variable met
172
+ parametric assumptions . chi - square tests were
173
+ used to examine gender and symptom laterality
174
+ differences between groups . all analyses employed
175
+ an alpha level of p < 0.05 and were two - tailed .
176
+ spearman correlations were performed separately in
177
+ each group to examine associations between anxiety
178
+ and/or depression ratings and cognitive functions
179
+ . as expected , the pda+ group reported
180
+ significant greater levels of anxiety on the hads
181
+ - a ( u = 0 , p < 0.001 ) and higher total score
182
+ on the hads ( u = 1 , p < 0.001 ) compared to the
183
+ pda group ( table 1 ) . groups were matched in age
184
+ ( t(48 ) = 1.31 , p = 0.20 ) , disease duration (
185
+ u = 259 , p = 0.66 ) , updrs - iii score ( u =
186
+ 250.5 , p = 0.65 ) , h&y ( u = 245 , p = 0.43 ) ,
187
+ ledd ( u = 159.5 , p = 0.80 ) , and depression (
188
+ hads - d ) ( u = 190.5 , p = 0.06 ) . additionally
189
+ , all groups were matched in the distribution of
190
+ gender ( = 0.098 , p = 0.75 ) and side - affected
191
+ ( = 0.765 , p = 0.38 ) . there were no group
192
+ differences for tmt - a performance ( u = 256 , p
193
+ = 0.62 ) ( table 2 ) ; however , the pda+ group
194
+ had worse performance on the trail making test
195
+ part b ( t(46 ) = 2.03 , p = 0.048 ) compared to
196
+ the pda group ( figure 1 ) . the pda+ group also
197
+ demonstrated significantly worse performance on
198
+ the digit span forward subtest ( t(48 ) = 2.22 , p
199
+ = 0.031 ) and backward subtest ( u = 190.5 , p =
200
+ 0.016 ) compared to the pda group ( figures 2(a )
201
+ and 2(b ) ) . neither semantic verbal fluency (
202
+ t(47 ) = 0.70 , p = 0.49 ) nor phonemic verbal
203
+ fluency ( t(47 ) = 0.39 , p = 0.70 ) differed
204
+ between groups . logical memory i immediate recall
205
+ test ( u = 176 , p = 0.059 ) showed a trend that
206
+ the pda+ group had worse new verbal learning and
207
+ immediate recall abilities than the pda group .
208
+ however , logical memory ii test performance ( u =
209
+ 219 , p = 0.204 ) and logical memory % retention (
210
+ u = 242.5 , p = 0.434 ) did not differ between
211
+ groups . there were also no differences between
212
+ groups in global cognition ( mmse ) ( u = 222.5 ,
213
+ p = 0.23 ) . participants were split into lpd and
214
+ rpd , and then further group differences were
215
+ examined between pda+ and pda. importantly , the
216
+ groups remained matched in age , disease duration
217
+ , updrs - iii , dde , h&y stage , and depression
218
+ but remained significantly different on self -
219
+ reported anxiety . lpda+ demonstrated worse
220
+ performance on the digit span forward test ( t(19
221
+ ) = 2.29 , p = 0.033 ) compared to lpda , whereas
222
+ rpda+ demonstrated worse performance on the digit
223
+ span backward test ( u = 36.5 , p = 0.006 ) , lm -
224
+ i immediate recall ( u = 37.5 , p = 0.008 ) , and
225
+ lm - ii ( u = 45.0 , p = 0.021 ) but not lm %
226
+ retention ( u = 75.5 , p = 0.39 ) compared to
227
+ rpda. this study is the first to directly compare
228
+ cognition between pd patients with and without
229
+ anxiety . the findings confirmed our hypothesis
230
+ that anxiety negatively influences attentional set
231
+ - shifting and working memory in pd . more
232
+ specifically , we found that pd patients with
233
+ anxiety were more impaired on the trail making
234
+ test part b which assessed attentional set -
235
+ shifting , on both digit span tests which assessed
236
+ working memory and attention , and to a lesser
237
+ extent on the logical memory test which assessed
238
+ memory and new verbal learning compared to pd
239
+ patients without anxiety . taken together , these
240
+ findings suggest that anxiety in pd may reduce
241
+ processing capacity and impair processing
242
+ efficiency , especially in the central executive
243
+ and attentional systems of working memory in a
244
+ similar way as seen in young healthy adults [ 26 ,
245
+ 27 ] . although the neurobiology of anxiety in pd
246
+ remains unknown , many researchers have postulated
247
+ that anxiety disorders are related to
248
+ neurochemical changes that occur during the early
249
+ , premotor stages of pd - related degeneration [
250
+ 37 , 38 ] such as nigrostriatal dopamine depletion
251
+ , as well as cell loss within serotonergic and
252
+ noradrenergic brainstem nuclei ( i.e. , raphe
253
+ nuclei and locus coeruleus , resp . , which
254
+ provide massive inputs to corticolimbic regions )
255
+ . over time , chronic dysregulation of
256
+ adrenocortical and catecholamine functions can
257
+ lead to hippocampal damage as well as
258
+ dysfunctional prefrontal neural circuitries [ 39 ,
259
+ 40 ] , which play a key role in memory and
260
+ attention . recent functional neuroimaging work
261
+ has suggested that enhanced hippocampal activation
262
+ during executive functioning and working memory
263
+ tasks may represent compensatory processes for
264
+ impaired frontostriatal functions in pd patients
265
+ compared to controls . therefore , chronic stress
266
+ from anxiety , for example , may disrupt
267
+ compensatory processes in pd patients and explain
268
+ the cognitive impairments specifically in working
269
+ memory and attention seen in pd patients with
270
+ anxiety . it has also been suggested that
271
+ hyperactivation within the putamen may reflect a
272
+ compensatory striatal mechanism to maintain normal
273
+ working memory performance in pd patients ;
274
+ however , losing this compensatory activation has
275
+ been shown to contribute to poor working memory
276
+ performance . anxiety in mild pd has been linked
277
+ to reduced putamen dopamine uptake which becomes
278
+ more extensive as the disease progresses . this
279
+ further supports the notion that anxiety may
280
+ disrupt compensatory striatal mechanisms as well ,
281
+ providing another possible explanation for the
282
+ cognitive impairments observed in pd patients with
283
+ anxiety in this study . noradrenergic and
284
+ serotonergic systems should also be considered
285
+ when trying to explain the mechanisms by which
286
+ anxiety may influence cognition in pd . although
287
+ these neurotransmitter systems are relatively
288
+ understudied in pd cognition , treating the
289
+ noradrenergic and serotonergic systems has shown
290
+ beneficial effects on cognition in pd . selective
291
+ serotonin reuptake inhibitor , citalopram , was
292
+ shown to improve response inhibition deficits in
293
+ pd , while noradrenaline reuptake blocker ,
294
+ atomoxetine , has been recently reported to have
295
+ promising effects on cognition in pd [ 45 , 46 ] .
296
+ overall , very few neuroimaging studies have been
297
+ conducted in pd in order to understand the neural
298
+ correlates of pd anxiety and its underlying neural
299
+ pathology . future research should focus on
300
+ relating anatomical changes and neurochemical
301
+ changes to neural activation in order to gain a
302
+ clearer understanding on how these pathologies
303
+ affect anxiety in pd . to further understand how
304
+ anxiety and cognitive dysfunction are related ,
305
+ future research should focus on using advanced
306
+ structural and function imaging techniques to
307
+ explain both cognitive and neural breakdowns that
308
+ are associated with anxiety in pd patients .
309
+ research has indicated that those with amnestic
310
+ mild cognitive impairment who have more
311
+ neuropsychiatric symptoms have a greater risk of
312
+ developing dementia compared to those with fewer
313
+ neuropsychiatric symptoms . future studies should
314
+ also examine whether treating neuropsychiatric
315
+ symptoms might impact the progression of cognitive
316
+ decline and improve cognitive impairments in pd
317
+ patients . previous studies have used pd symptom
318
+ laterality as a window to infer asymmetrical
319
+ dysfunction of neural circuits . for example , lpd
320
+ patients have greater inferred right hemisphere
321
+ pathology , whereas rpd patients have greater
322
+ inferred left hemisphere pathology . thus ,
323
+ cognitive domains predominantly subserved by the
324
+ left hemisphere ( e.g. , verbally mediated tasks
325
+ of executive function and verbal memory ) might be
326
+ hypothesized to be more affected in rpd than lpd ;
327
+ however , this remains controversial . it has also
328
+ been suggested that since anxiety is a common
329
+ feature of left hemisphere involvement [ 48 , 49 ]
330
+ , cognitive domains subserved by the left
331
+ hemisphere may also be more strongly related to
332
+ anxiety . results from this study showed selective
333
+ verbal memory deficits in rpd patients with
334
+ anxiety compared to rpd without anxiety , whereas
335
+ lpd patients with anxiety had greater attentional
336
+ / working memory deficits compared to lpd without
337
+ anxiety . although these results align with
338
+ previous research , interpretations of these
339
+ findings should be made with caution due to the
340
+ small sample size in the lpd comparison
341
+ specifically . recent work has suggested that the
342
+ hads questionnaire may underestimate the burden of
343
+ anxiety related symptomology and therefore be a
344
+ less sensitive measure of anxiety in pd [ 30 , 50
345
+ ] . in addition , our small sample size also
346
+ limited the statistical power for detecting
347
+ significant findings . based on these limitations
348
+ , our findings are likely conservative and
349
+ underrepresent the true impact anxiety has on
350
+ cognition in pd . additionally , the current study
351
+ employed a very brief neuropsychological
352
+ assessment including one or two tests for each
353
+ cognitive domain . future studies are encouraged
354
+ to collect a more complex and comprehensive
355
+ battery from a larger sample of pd participants in
356
+ order to better understand the role anxiety plays
357
+ on cognition in pd . another limitation of this
358
+ study was the absence of diagnostic interviews to
359
+ characterize participants ' psychiatric symptoms
360
+ and specify the type of anxiety disorders included
361
+ in this study . future studies should perform
362
+ diagnostic interviews with participants ( e.g. ,
363
+ using dsm - v criteria ) rather than relying on
364
+ self - reported measures to group participants ,
365
+ in order to better understand whether the type of
366
+ anxiety disorder ( e.g. , social anxiety , phobias
367
+ , panic disorders , and generalized anxiety )
368
+ influences cognitive performance differently in pd
369
+ . one advantage the hads questionnaire provided
370
+ over other anxiety scales was that it assessed
371
+ both anxiety and depression simultaneously and
372
+ allowed us to control for coexisting depression .
373
+ although there was a trend that the pda+ group
374
+ self - reported higher levels of depression than
375
+ the pda group , all participants included in the
376
+ study scored < 6 on the depression subscale of the
377
+ hads . controlling for depression while assessing
378
+ anxiety has been identified as a key shortcoming
379
+ in the majority of recent work . considering many
380
+ previous studies have investigated the influence
381
+ of depression on cognition in pd without
382
+ accounting for the presence of anxiety and the
383
+ inconsistent findings reported to date , we
384
+ recommend that future research should try to
385
+ disentangle the influence of anxiety versus
386
+ depression on cognitive impairments in pd .
387
+ considering the growing number of clinical trials
388
+ for treating depression , there are few if any for
389
+ the treatment of anxiety in pd . anxiety is a key
390
+ contributor to decreased quality of life in pd and
391
+ greatly requires better treatment options .
392
+ moreover , anxiety has been suggested to play a
393
+ key role in freezing of gait ( fog ) , which is
394
+ also related to attentional set - shifting [ 52 ,
395
+ 53 ] . future research should examine the link
396
+ between anxiety , set - shifting , and fog , in
397
+ order to determine whether treating anxiety might
398
+ be a potential therapy for improving fog ."""
399
+
400
+ import torch
401
+ from transformers import AutoTokenizer, LongT5ForConditionalGeneration
402
+
403
+ tokenizer = AutoTokenizer.from_pretrained("Stancld/longt5-tglobal-large-16384-pubmed-3k_steps")
404
+
405
+ input_ids = tokenizer(LONG_ARTICLE, return_tensors="pt").input_ids.to("cuda")
406
+
407
+ model = LongT5ForConditionalGeneration.from_pretrained("Stancld/longt5-tglobal-large-16384-pubmed-3k_steps", return_dict_in_generate=True).to("cuda")
408
+
409
+ sequences = model.generate(input_ids).sequences
410
+
411
+ summary = tokenizer.batch_decode(sequences)
412
+ ```