-
Notifications
You must be signed in to change notification settings - Fork 5
/
imdb_optuna.jsonnet
64 lines (62 loc) · 1.61 KB
/
imdb_optuna.jsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
local batch_size = 64;
local cuda_device = 0;
local num_epochs = 15;
local seed = 42;
local embedding_dim = std.parseInt(std.extVar('embedding_dim'));
local dropout = std.parseJson(std.extVar('dropout'));
local lr = std.parseJson(std.extVar('lr'));
local max_filter_size = std.parseInt(std.extVar('max_filter_size'));
local num_filters = std.parseInt(std.extVar('num_filters'));
local output_dim = std.parseInt(std.extVar('output_dim'));
local ngram_filter_sizes = std.range(2, max_filter_size);
{
numpy_seed: seed,
pytorch_seed: seed,
random_seed: seed,
dataset_reader: {
type: 'text_classification_json',
tokenizer: {
type: 'spacy',
},
token_indexers: {
tokens: {
type: 'single_id',
lowercase_tokens: true,
},
},
},
datasets_for_vocab_creation: ['train'],
train_data_path: 'https://s3-us-west-2.amazonaws.com/allennlp/datasets/imdb/train.jsonl',
validation_data_path: 'https://s3-us-west-2.amazonaws.com/allennlp/datasets/imdb/dev.jsonl',
model: {
type: 'basic_classifier',
text_field_embedder: {
token_embedders: {
tokens: {
embedding_dim: embedding_dim,
},
},
},
seq2vec_encoder: {
type: 'cnn',
embedding_dim: embedding_dim,
ngram_filter_sizes: ngram_filter_sizes,
num_filters: num_filters,
output_dim: output_dim,
},
dropout: dropout,
},
data_loader: {
shuffle: true,
batch_size: batch_size,
},
trainer: {
cuda_device: cuda_device,
num_epochs: num_epochs,
optimizer: {
lr: lr,
type: 'sgd',
},
validation_metric: '+accuracy',
},
}