Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
Adds SST and NLI models to the list of pretrained models (#73)
Browse files Browse the repository at this point in the history
* Adds a RoBERTa SST model to the list of pretrained models

* Update changelog

* Formatting

* LSTM SST model

* More pretrained models

* Formatting

* Update changelog

* Set the right predictor for entailment
  • Loading branch information
dirkgr authored Jun 10, 2020
1 parent 4b010c0 commit c0821a0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Added option to SemanticDependenciesDatasetReader to not skip instances that have no arcs, for validation data
- Added a default predictors to several models
- Added sentiment analysis models to pretrained.py
- Added NLI models to pretrained.py

## [v1.0.0rc5](https://github.com/allenai/allennlp-models/releases/tag/v1.0.0rc5) - 2020-05-14

Expand Down
28 changes: 27 additions & 1 deletion allennlp_models/pretrained.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Optional

from allennlp.models import load_archive
from allennlp.predictors import Predictor
from allennlp.predictors import Predictor, TextClassifierPredictor

from allennlp_models.coref import CorefPredictor
from allennlp_models.pair_classification import DecomposableAttentionPredictor
Expand Down Expand Up @@ -137,3 +137,29 @@ def esim_nli_with_elmo_chen_2017() -> DecomposableAttentionPredictor:
"https://storage.googleapis.com/allennlp-public-models/decomposable-attention-elmo-2020.04.09.tar.gz"
)
return predictor


def glove_sst() -> TextClassifierPredictor:
return _load_predictor(
"https://storage.googleapis.com/allennlp-public-models/basic_stanford_sentiment_treebank-2020.06.09.tar.gz"
)


def roberta_sst() -> TextClassifierPredictor:
return _load_predictor(
"https://storage.googleapis.com/allennlp-public-models/sst-roberta-large-2020.06.08.tar.gz"
)


def roberta_mnli() -> DecomposableAttentionPredictor:
return _load_predictor(
"https://storage.googleapis.com/allennlp-public-models/mnli_roberta-2020.06.09.tar.gz",
"textual-entailment",
)


def roberta_snli() -> DecomposableAttentionPredictor:
return _load_predictor(
"https://storage.googleapis.com/allennlp-public-models/snli_roberta-2020.06.09.tar.gz",
"textual-entailment",
)
2 changes: 1 addition & 1 deletion training_config/pair_classification/mnli_roberta.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local transformer_dim = 1024;
local cls_is_last_token = false;

{
"dataset_reader":{
"dataset_reader": {
"type": "snli",
"tokenizer": {
"type": "pretrained_transformer",
Expand Down

0 comments on commit c0821a0

Please sign in to comment.