This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add way to initialize SrlBert without pretrained BERT weights (#257)
* add way to initialize SrlBert without pretrained BERT weights * tick cache version * add test
- Loading branch information
Showing
6 changed files
with
107 additions
and
29 deletions.
There are no files selected for viewing
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
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
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
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
56 changes: 56 additions & 0 deletions
56
test_fixtures/structured_prediction/srl/bert_srl_local_files.jsonnet
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
local bert_model = "test_fixtures/bert-xsmall-dummy"; | ||
|
||
# Take from test_fixtures/bert-xsmall-dummy/config.json | ||
local bert_config = { | ||
"architectures": [ | ||
"BertModel" | ||
], | ||
"attention_probs_dropout_prob": 0.1, | ||
"hidden_act": "gelu", | ||
"hidden_dropout_prob": 0.1, | ||
"hidden_size": 20, | ||
"initializer_range": 0.02, | ||
"intermediate_size": 40, | ||
"layer_norm_eps": 1e-12, | ||
"max_position_embeddings": 512, | ||
"model_type": "bert", | ||
"num_attention_heads": 1, | ||
"num_hidden_layers": 1, | ||
"pad_token_id": 0, | ||
"type_vocab_size": 2, | ||
"vocab_size": 250 | ||
}; | ||
|
||
{ | ||
"dataset_reader":{ | ||
"type":"srl", | ||
"bert_model_name": bert_model, | ||
}, | ||
"train_data_path": "test_fixtures/structured_prediction/srl", | ||
"validation_data_path": "test_fixtures/structured_prediction/srl", | ||
"model": { | ||
"type": "srl_bert", | ||
"bert_model": bert_config, | ||
"embedding_dropout": 0.0 | ||
}, | ||
"data_loader": { | ||
"batch_sampler": { | ||
"type": "bucket", | ||
"batch_size": 5, | ||
"padding_noise": 0.0 | ||
} | ||
}, | ||
"trainer": { | ||
"optimizer": { | ||
"type": "adam", | ||
"lr": 0.001 | ||
}, | ||
"checkpointer": { | ||
"num_serialized_models_to_keep": 1 | ||
}, | ||
"num_epochs": 3, | ||
"grad_norm": 10.0, | ||
"patience": 5, | ||
"cuda_device": -1 | ||
} | ||
} |
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