A Framework for Long Document Classification
Hi, this repository contains the code and the data for the T-ASL paper "Hierarchical multi-granularity Interaction Graph Convolutional Network for Long Document Classification"
To download the dataset for "exAAPD", "exPFD", "exLitcovid", "exMSH" and "Wiki 10-31k*", pls go to this URL: https://drive.google.com/open?id=1qGmyEVD19ruvLLz9J0QGV7rsZPFEz2Az
Any questions can be sent to [email protected]
Requirements:
Pytorch
Transformer (pytorch): https://github.com/huggingface/transformers
GPU
Commandline to rerun the code (take "baseline_wiki_based_emotion.py" as an example):
CUDA_VISIBLE_DEVICES=1 python -u train_aapd.py --do_train --do_lower_case --bert_model bert-base-uncased --max_seq_length 512 --train_batch_size 4 --learning_rate 2e-5 --num_train_epochs 30
Very importance step before running: Since our code was written in "pytorch-transformer" -- the old verion of Huggingface Transformer, pls
- update the "pytorch-transformer" into "transformer" before running the code. For example:
Now it is:
from pytorch_transformers.file_utils import PYTORCH_TRANSFORMERS_CACHE
from pytorch_transformers.modeling_bert import BertForSequenceClassification, BertConfig, WEIGHTS_NAME, CONFIG_NAME
from pytorch_transformers.tokenization_bert import BertTokenizer
from pytorch_transformers.optimization import AdamW
change to be:
from transformers.file_utils import PYTORCH_TRANSFORMERS_CACHE
from transformers.modeling_bert import BertForSequenceClassification
from transformers.tokenization_bert import BertTokenizer
from transformers.optimization import AdamW