Last active
October 27, 2021 05:50
-
-
Save xinzhel/db693c10d0e710eac97105b8576eaeeb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Configuration for a basic LSTM sentiment analysis classifier, using the binary Stanford Sentiment | |
// Treebank (Socher at al. 2013). | |
{ | |
"dataset_reader": { | |
"type": "sst_tokens", | |
"use_subtrees": true, | |
"granularity": "2-class", | |
"tokenizer": { | |
"type": "spacy" | |
}, | |
"token_indexers": { | |
"tokens": { | |
"type": "single_id" | |
} | |
}, | |
}, | |
"train_data_path": "https://allennlp.s3.amazonaws.com/datasets/sst/train.txt", | |
"validation_data_path": "https://allennlp.s3.amazonaws.com/datasets/sst/dev.txt", | |
"test_data_path": "https://allennlp.s3.amazonaws.com/datasets/sst/test.txt", | |
"model": { | |
"type": "basic_classifier", | |
"text_field_embedder": { | |
"token_embedders": { | |
"tokens": { | |
"type": "embedding", | |
"embedding_dim": 300, | |
"pretrained_file": "https://allennlp.s3.amazonaws.com/datasets/glove/glove.840B.300d.txt.gz", | |
"trainable": false | |
} | |
} | |
}, | |
"seq2vec_encoder": { | |
"type": "lstm", | |
"input_size": 300, | |
"hidden_size": 512, | |
"num_layers": 2 | |
} | |
}, | |
"data_loader": { | |
"batch_sampler": { | |
"type": "bucket", | |
"batch_size" : 32 | |
} | |
}, | |
"trainer": { | |
"num_epochs": 5, | |
"patience": 1, | |
"grad_norm": 5.0, | |
"validation_metric": "+accuracy", | |
"optimizer": { | |
"type": "adam", | |
"lr": 0.001 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment