longformer-base-health-fact2
This model is a fine-tuned version of allenai/longformer-base-4096 on the health_fact dataset. It achieves the following results on the VALIDATION set:
- Loss: 0.5858
- Micro F1: 0.8122
- Macro F1: 0.6830
- False F1: 0.7941
- Mixture F1: 0.5015
- True F1: 0.9234
- Unproven F1: 0.5128
The following are the results on the TEST set:
- Macro F1: 0.6732897445517078
- Accuracy: 0.797242497972425
- False Accuracy: 0.8092783505154639
- Mixture Accuracy: 0.5323383084577115
- True Accuracy: 0.9081803005008348
- Unproven Accuracy: 0.4
Model description
The health fact dataset is for building fact-checking models related to health. Here is how you can use this model:
import torch
from transformers import pipeline
claim = "A mother revealed to her child in a letter after her death that she had just one eye because she had donated the other to him."
text = "In April 2005, we spotted a tearjerker on the Internet about a mother who gave up one of her eyes to a son who had lost one of his at an early age. By February 2007 the item was circulating in e-mail in the following shortened version: My mom only had one eye. I hated herโฆ She was such an embarrassment. She cooked for students and teachers to support the family. There was this one day during elementary school where my mom came to say hello to me. I was so embarrassed. How could she do this to me? I ignored her, threw her a hateful look and ran out. The next day at school one of my classmates said, โEEEE, your mom only has one eye!โ I wanted to bury myself. I also wanted my mom to just disappear. I confronted her that day and said, โIf youโre only gonna make me a laughing stock, why donโt you just die?โ My mom did not respondโฆ I didnโt even stop to think for a second about what I had said, because I was full of anger. I was oblivious to her feelings. I wanted out of that house, and have nothing to do with her. So I studied real hard, got a chance to go abroad to study. Then, I got married. I bought a house of my own. I had kids of my own. I was happy with my life, my kids and the comforts. Then one day, my Mother came to visit me. She hadnโt seen me in years and she didnโt even meet her grandchildren. When she stood by the door, my children laughed at her, and I yelled at her for coming over uninvited. I screamed at her, โHow dare you come to my house and scare my children! GET OUT OF HERE! NOW!! !โ And to this, my mother quietly answered, โOh, Iโm so sorry. I may have gotten the wrong address,โ and she disappeared out of sight. One day, a letter regarding a school reunion came to my house. So I lied to my wife that I was going on a business trip. After the reunion, I went to the old shack just out of curiosity. My neighbors said that she died. I did not shed a single tear. They handed me a letter that she had wanted me to have. My dearest son, I think of you all the time. Iโm sorry that I came to your house and scared your children. I was so glad when I heard you were coming for the reunion. But I may not be able to even get out of bed to see you. Iโm sorry that I was a constant embarrassment to you when you were growing up. You seeโฆโฆ..when you were very little, you got into an accident, and lost your eye. As a mother, I couldnโt stand watching you having to grow up with one eye. So I gave you mine. I was so proud of my son who was seeing a whole new world for me, in my place, with that eye. With all my love to you, Your mother. In its earlier incarnation, the story identified by implication its location as Korea through statements made by both the mother and the son (the sonโs โI left my mother and came to Seoulโ and the motherโs โI wonโt visit Seoul anymoreโ). It also supplied a reason for the sonโs behavior when his mother arrived unexpectedly to visit him (โMy little girl ran away, scared of my momโs eyeโ and โI screamed at her, โHow dare you come to my house and scare my daughter!'โ). A further twist was provided in the original: rather than gaining the news of his motherโs death from neighbors (who hand him her letter), the son instead discovered the woman who bore him lying dead on the floor of what used to be his childhood home, her missive to him clutched in her lifeless hand: Give your parents roses while they are alive, not deadMY mom only had one eye. I hated her โฆ she was such an embarrassment. My mom ran a small shop at a flea market. She collected little weeds and such to sell โฆ anything for the money we needed she was such an embarrassment. There was this one day during elementary school โฆ It was field day, and my mom came. I was so embarrassed. How could she do this to me? I threw her a hateful look and ran out. The next day at school โฆ โyour mom only has one eye?!? !โ โฆ And they taunted me. I wished that my mom would just disappear from this world so I said to my mom, โmom โฆ Why donโt you have the other eye?! If youโre only going to make me a laughingstock, why donโt you just die?!! !โ my mom did not respond โฆ I guess I felt a little bad, but at the same time, it felt good to think that I had said what Iโd wanted to say all this timeโฆ maybe it was because my mom hadnโt punished me, but I didnโt think that I had hurt her feelings very badly. That nightโฆ I woke up, and went to the kitchen to get a glass of water. My mom was crying there, so quietly, as if she was afraid that she might wake me. I took a look at her, and then turned away. Because of the thing I had said to her earlier, there was something pinching at me in the corner of my heart. Even so, I hated my mother who was crying out of her one eye. So I told myself that I would grow up and become successful. Because I hated my one-eyed mom and our desperate povertyโฆ then I studied real hard. I left my mother and came to Seoul and studied, and got accepted in the Seoul University with all the confidence I had. Then, I got married. I bought a house of my own. Then I had kids, tooโฆ now Iโm living happily as a successful man. I like it here because itโs a place that doesnโt remind me of my mom. This happiness was getting bigger and bigger, whenโฆ what?! Whoโs thisโฆit was my motherโฆ still with her one eye. It felt as if the whole sky was falling apart on me. My little girl ran away, scared of my momโs eye. And I asked her, โwho are you? !โ โI donโt know you!! !โ as if trying to make that real. I screamed at her, โHow dare you come to my house and scare my daughter!โ โGET OUT OF HERE! NOW!! !โ and to this, my mother quietly answered, โoh, Iโm so sorry. I may have gotten the wrong address,โ and she disappeared out of sight. Thank goodnessโฆ she doesnโt recognize meโฆ I was quite relieved. I told myself that I wasnโt going to care, or think about this for the rest of my life. Then a wave of relief came upon meโฆ One day, a letter regarding a school reunion came to my house. So, lying to my wife that I was going on a business trip, I went. After the reunion, I went down to the old shack, that I used to call a houseโฆ just out of curiosity there, I found my mother fallen on the cold ground. But I did not shed a single tear. She had a piece of paper in her handโฆ. it was a letter to me. My sonโฆ I think my life has been long enough nowโฆ Andโฆ I wonโt visit Seoul anymoreโฆ but would it be too much to ask if I wanted you to come visit me once in a while? I miss you so muchโฆ and I was so glad when I heard you were coming for the reunion. But I decided not to go to the school. โฆfor youโฆ and Iโm sorry that I only have one eye, and I was an embarrassment for you. You see, when you were very little, you got into an accident, and lost your eye. as a mom, I couldnโt stand watching you having to grow up with only one eyeโฆ so I gave you mineโฆ I was so proud of my son that was seeing a whole new world for me, in my place, with that eye. I was never upset at you for anything you didโฆ the couple times that you were angry with me, I thought to myself, โitโs because he loves meโฆโ my son. Oh, my sonโฆ I donโt want you to cry for me, because of my death. My son, I love you my son, I love you so much. With all modern medical technology, transplantation of the eyeball is still impossible. The optic nerve isnโt an ordinary nerve, but instead an inset running from the brain. Modern medicine isnโt able to โconnectโ an eyeball back to brain after an optic nerve has been severed, let alone transplant the eye from a different person. (The only exception is the cornea, the transparent part in front of the eye: corneas are transplanted to replace injured and opaque ones.) We wonโt try to comment on whether any surgeon would accept an eye from a living donor for transplant into another โ weโll leave that to others who are far more knowledgeable about medical ethics and transplant procedures. But we will note that the plot device of a motherโs dramatic sacrifice for the sake of her childโs being revealed in a written communication delivered after her demise appears in another legend about maternal love: the 2008 tale about a woman who left a touching message on her cell phone even as life ebbed from her as she used her body to shield the tot during an earthquake. Giving up oneโs own life for a loved one is central to a 2005 urban legend about a boy on a motorcycle who has his girlfriend hug him one last time and put on his helmet just before the crash that kills him and spares her. Returning to the โnotes from the deadโ theme is the 1995 story about a son who discovers only through a posthumous letter from his mother what their occasional dinner โdatesโ had meant to her. Another legend weโre familiar with features a meme used in the one-eyed mother story (the coming to light of the enduring love of the person who died for the completely unworthy person sheโd lavished it on), but that one involves a terminally ill woman and her cheating husband. In it, an about-to-be-spurned wife begs the adulterous hoon sheโd married to stick around for another 30 days and to carry her over the threshold of their home once every day of that month as her way of keeping him around long enough for her to kick the bucket and thus spare their son the knowledge that his parents were on the verge of divorce."
label = "false"
device = 0 if torch.cuda.is_available() else -1
pl = pipeline("text-classification", model="nbroad/longformer-base-health-fact", device=device)
input_text = claim+pl.tokenizer.sep_token+text
print(len(pl.tokenizer(input_text).input_ids))
# 2361 (which is why longformer is useful)
pl(input_text)
# [{'label': 'false', 'score': 0.8015491962432861}]
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 3e-05
- train_batch_size: 16
- eval_batch_size: 32
- seed: 18
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-06
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.1
- num_epochs: 3
- mixed_precision_training: Native AMP
Training results
| Training Loss | Epoch | Step | Validation Loss | Micro F1 | Macro F1 | False F1 | Mixture F1 | True F1 | Unproven F1 |
|---|---|---|---|---|---|---|---|---|---|
| 0.555 | 1.0 | 613 | 0.5243 | 0.7842 | 0.5535 | 0.7698 | 0.4170 | 0.8938 | 0.1333 |
| 0.4282 | 2.0 | 1226 | 0.5008 | 0.8031 | 0.6393 | 0.7829 | 0.4605 | 0.9199 | 0.3939 |
| 0.2897 | 3.0 | 1839 | 0.5858 | 0.8122 | 0.6830 | 0.7941 | 0.5015 | 0.9234 | 0.5128 |
Framework versions
- Transformers 4.19.0.dev0
- Pytorch 1.11.0a0+17540c5
- Datasets 2.1.1.dev0
- Tokenizers 0.12.1
- Downloads last month
- 32
Model tree for nbroad/longformer-base-health-fact
Base model
allenai/longformer-base-4096Dataset used to train nbroad/longformer-base-health-fact
Space using nbroad/longformer-base-health-fact 1
Evaluation results
- F1 on health_facttest set self-reported0.673
- Accuracy on health_facttest set self-reported0.797
- False Accuracy on health_facttest set self-reported0.809
- Mixture Accuracy on health_facttest set self-reported0.532
- True Accuracy on health_facttest set self-reported0.908
- Unproven Accuracy on health_facttest set self-reported0.400