https://github.com/amazon-science/efficient-longdoc-classification
https://github.com/amazon-science/efficient-longdoc-classification
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
✓DOI references
Found 1 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org, ieee.org, zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.7%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: amazon-science
- License: apache-2.0
- Language: Python
- Default Branch: main
- Size: 20.5 KB
Statistics
- Stars: 45
- Watchers: 2
- Forks: 10
- Open Issues: 2
- Releases: 0
Metadata Files
README.md
Source codes for ``Efficient Classification of Long Documents Using Transformers''
Please refer to our paper for more details and cite our paper if you find this repo useful:
@inproceedings{park-etal-2022-efficient,
title = "Efficient Classification of Long Documents Using Transformers",
author = "Park, Hyunji and
Vyas, Yogarshi and
Shah, Kashif",
booktitle = "Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers)",
month = may,
year = "2022",
address = "Dublin, Ireland",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2022.acl-short.79",
doi = "10.18653/v1/2022.acl-short.79",
pages = "702--709",
}
Instructions
1. Install required libraries
pip install -r requirements.txt
python -m spacy download en_core_web_sm
2. Prepare the datasets
Hyperpartisan News Detection
- Available at https://zenodo.org/record/1489920#.YLferh1Olc8
- Download the datasets
mkdir data/hyperpartisan
wget -P data/hyperpartisan/ https://zenodo.org/record/1489920/files/articles-training-byarticle-20181122.zip
wget -P data/hyperpartisan/ https://zenodo.org/record/1489920/files/ground-truth-training-byarticle-20181122.zip
unzip data/hyperpartisan/articles-training-byarticle-20181122.zip -d data/hyperpartisan
unzip data/hyperpartisan/ground-truth-training-byarticle-20181122.zip -d data/hyperpartisan
rm data/hyperpartisan/*zip
- Prepare the datasets with the resulting xml files and this preprocessing script (following Longformer): https://github.com/allenai/longformer/blob/master/scripts/hp_preprocess.py
20NewsGroups
- Originally available at http://qwone.com/~jason/20Newsgroups/20news-bydate.tar.gz
- Running
train.pywith the--data 20newsflag will download and prepare the data available viasklearn.datasets(following CogLTX). We adopt the train/dev/test split from this ToBERT paper.
EURLEX-57K
- Available at https://github.com/iliaschalkidis/lmtc-emnlp2020
- Download the datasets
mkdir data/EURLEX57K
wget -O data/EURLEX57K/datasets.zip http://nlp.cs.aueb.gr/software_and_datasets/EURLEX57K/datasets.zip
unzip data/EURLEX57K/datasets.zip -d data/EURLEX57K
rm data/EURLEX57K/datasets.zip
rm -rf data/EURLEX57K/__MACOSX
mv data/EURLEX57K/dataset/* data/EURLEX57K
rm -rf data/EURLEX57K/dataset
wget -O data/EURLEX57K/EURLEX57K.json http://nlp.cs.aueb.gr/software_and_datasets/EURLEX57K/eurovoc_en.json
- Running
train.pywith the--data eurlexflag reads and prepares the data fromdata/EURLEX57K/{train, dev, test}/*.jsonfiles - Running
train.pywith the--data eurlex --invertedflag creates Inverted EURLEX data by inverting the order of the sections data/EURLEX57K/EURLEX57K.jsoncontains label information.
CMU Book Summary Dataset
- Available at http://www.cs.cmu.edu/~dbamman/booksummaries.html
wget -P data/ http://www.cs.cmu.edu/~dbamman/data/booksummaries.tar.gz
tar -xf data/booksummaries.tar.gz -C data
- Running
train.pywith the--data booksflag reads and prepares the data fromdata/booksummaries/booksummaries.txt - Running
train.pywith the--data books --pairsflag creates Paired Book Summary by combining pairs of summaries and their labels
3. Run the models
e.g. python train.py --model_name bertplusrandom --data books --pairs --batch_size 8 --epochs 20 --lr 3e-05
cf. Note that we use the source code for the CogLTX model: https://github.com/Sleepychord/CogLTX
Hyperparameters used
Hyperpartisan
| Parameter | BERT | BERT+TextRank | BERT+Random | Longformer | ToBERT | |------------|-------|---------------|-------------|---------------------------------------------------|--------| | Batch size | 8 | 8 | 8 | 16 | 8 | | Epochs | 20 | 20 | 20 | 20 | 20 | | LR | 3e-05 | 3e-05 | 5e-05 | 5e-05 | 5e-05 | | Scheduler | NA | NA | NA | warmup | NA |
20NewsGroups, Book Summary, Paired Book Summary
| Parameter | BERT | BERT+TextRank | BERT+Random | Longformer | ToBERT | |------------|-------|---------------|-------------|---------------------------------------------------|--------| | Batch size | 8 | 8 | 8 | 16 | 8 | | Epochs | 20 | 20 | 20 | 20 | 20 | | LR | 3e-05 | 3e-05 | 3e-05 | 0.005 | 3e-05 | | Scheduler | NA | NA | NA | warmup | NA |
EURLEX, Inverted EURLEX
| Parameter | BERT | BERT+TextRank | BERT+Random | Longformer | ToBERT | |------------|-------|---------------|-------------|---------------------------------------------------|--------| | Batch size | 8 | 8 | 8 | 16 | 8 | | Epochs | 20 | 20 | 20 | 20 | 20 | | LR | 5e-05 | 5e-05 | 5e-05 | 0.005 | 5e-05 | | Scheduler | NA | NA | NA | warmup | NA |
Owner
- Name: Amazon Science
- Login: amazon-science
- Kind: organization
- Website: https://amazon.science
- Twitter: AmazonScience
- Repositories: 80
- Profile: https://github.com/amazon-science
GitHub Events
Total
- Watch event: 4
Last Year
- Watch event: 4
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Yogarshi Vyas | y****i | 2 |
| Amazon GitHub Automation | 5****o | 1 |
| Yogarshi Vyas | y****i@a****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: about 1 year ago
All Time
- Total issues: 2
- Total pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Total issue authors: 2
- Total pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- mert-kurttutan (1)
- GabrieleAraujo (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- jsonlines *
- pytextrank ==3.1.1
- pytorch-lightning >=1.3.7
- sklearn >=0.22.1
- spacy >=3.0.6
- torch >=1.7.0
- torchmetrics ==0.3.2
- transformers >=4.6.1