【发布时间】:2021-07-01 07:48:59
【问题描述】:
我是 allenNLP 库的新手。
为了为dataset_reader 设置参数,我想设置用于评估的配置,例如火车 (https://github.com/allenai/allennlp-template-config-files/blob/master/training_config/my_model_trained_on_my_dataset.jsonnet)
但我不确定是否有用于评估的配置文件模板,例如火车,并且下面的配置文件有效(其中 train_data_path 和 trainer 部分被删除。)
{
"dataset_reader" : {
// This name needs to match the name that you used to register your dataset reader, with
// the call to `@DatasetReader.register()`.
"type": "classification-tsv",
// These other parameters exactly match the constructor parameters of your dataset reader class.
"token_indexers": {
"tokens": {
"type": "single_id"
}
}
},
"validation_data_path": "/path/to/your/validation/data/here.tsv",
"model": {
// This name needs to match the name that you used to register your model, with
// the call to `@Model.register()`.
"type": "simple_classifier",
// These other parameters exactly match the constructor parameters of your model class.
"embedder": {
"token_embedders": {
"tokens": {
"type": "embedding",
"embedding_dim": 10
}
}
},
"encoder": {
"type": "bag_of_embeddings",
"embedding_dim": 10
}
},
"data_loader": {
// See http://docs.allennlp.org/master/api/data/dataloader/ for more info on acceptable
// parameters here.
"batch_size": 8,
"shuffle": true
},
}
提前致谢。
【问题讨论】:
-
您可以使用完全相同的配置文件进行训练和评估。如果您确实需要在数据集阅读器中使用不同的参数进行 eval,除了“dataset_reader”之外,您还可以设置“validation_dataset_reader”字段。
标签: allennlp