Skip to content

Commit

Permalink
Add albert result
Browse files Browse the repository at this point in the history
  • Loading branch information
monologg committed Dec 13, 2019
1 parent 30e9d86 commit f4556dd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,16 @@ Run 5 epochs each (No hyperparameter tuning)
| **ATIS** | BERT | 97.87 | 95.46 |
| | DistilBERT | 97.54 | 94.89 |
| | RoBERTa | 97.64 | 94.94 |
| | ALBERT | 97.42 | 94.91 |
| **Snips** | BERT | 98.29 | 96.05 |
| | DistilBERT | 98.42 | 94.10 |
| | RoBERTa | 98.14 | 94.60 |
| | ALBERT | 98.14 | 95.95 |

## Updates

- 2019/12/03: Add DistilBert and RoBERTa
- 2019/12/03: Add DistilBert and RoBERTa result
- 2019/12/14: Add Albert(large v1) result

## References

Expand Down
1 change: 1 addition & 0 deletions model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import torch.nn as nn
from transformers import BertPreTrainedModel, DistilBertConfig, PreTrainedModel, BertModel, DistilBertModel
from transformers.modeling_distilbert import DistilBertPreTrainedModel
from transformers.modeling_albert import AlbertPreTrainedModel
from utils import PRETRAINED_MODEL_MAP


Expand Down
9 changes: 6 additions & 3 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
import numpy as np
from sklearn.metrics import f1_score
from transformers import BertTokenizer, BertConfig, DistilBertConfig, DistilBertTokenizer, RobertaConfig, RobertaTokenizer, \
BertModel, DistilBertModel, RobertaModel
BertModel, DistilBertModel, RobertaModel, AlbertConfig, AlbertTokenizer, AlbertModel

PRETRAINED_MODEL_MAP = {
'bert': BertModel,
'distilbert': DistilBertModel,
'roberta': RobertaModel
'roberta': RobertaModel,
'albert': AlbertModel
}

from model import JointBERT, JointDistilBERT
Expand All @@ -20,12 +21,14 @@
'bert': (BertConfig, JointBERT, BertTokenizer),
'distilbert': (DistilBertConfig, JointDistilBERT, DistilBertTokenizer),
'roberta': (RobertaConfig, JointBERT, RobertaTokenizer),
'albert': (AlbertConfig, JointBERT, AlbertTokenizer)
}

MODEL_PATH_MAP = {
'bert': 'bert-base-uncased',
'distilbert': 'distilbert-base-uncased',
'roberta': 'roberta-base'
'roberta': 'roberta-base',
'albert': 'albert-large-v1'
}


Expand Down

0 comments on commit f4556dd

Please sign in to comment.