Skip to content

Commit

Permalink
entity linking to pytorch and reduce ram and gpu (#1516)
Browse files Browse the repository at this point in the history
* lite entity linking

* fixes

* kbqa to pytorch and lite

* el and kbqa updates

* remove redundant components

* update outputs of ner configs

* update components registry

* reformat

* docstrings

* rename configs

* update tests

* update docs

* update docs

* add init.py

* refactor

* fix tests

* fix tests

* fix requirements

* fixes

* fix kbqa requirements and downloads

* fix downloads

* update requirements

* fix tests

* fix downloads

* feat: kbqa aliases

* remove: rel_ranking_infer requirement_registry duplicate

* refactor

* refactor

* update typing

* refactor

* refactor

* fixes

* refactor: license, import order, etc.

* refactor: removed ranking training configs, devices type changed

Co-authored-by: Fedor Ignatov <ignatov.fedor@gmail.com>
  • Loading branch information
dmitrijeuseew and IgnatovFedor committed May 4, 2022
1 parent abbd090 commit 7f1c926
Show file tree
Hide file tree
Showing 63 changed files with 3,418 additions and 3,854 deletions.

This file was deleted.

This file was deleted.

68 changes: 28 additions & 40 deletions deeppavlov/configs/classifiers/query_pr.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"dataset_reader": {
"class_name": "basic_classification_reader",
"x": "Question",
"y": "Class",
"data_path": "{DOWNLOADS_PATH}/query_prediction"
"class_name": "sq_reader",
"data_path": "{DOWNLOADS_PATH}/query_prediction/query_prediction_eng.pickle"
},
"dataset_iterator": {
"class_name": "basic_classification_iterator",
Expand All @@ -14,8 +12,8 @@
"in_y": ["y"],
"pipe": [
{
"class_name": "bert_preprocessor",
"vocab_file": "{BERT_PATH}/vocab.txt",
"class_name": "torch_transformers_preprocessor",
"vocab_file": "{TRANSFORMER}",
"do_lower_case": false,
"max_seq_length": 64,
"in": ["x"],
Expand All @@ -27,42 +25,40 @@
"fit_on": ["y"],
"save_path": "{MODEL_PATH}/classes.dict",
"load_path": "{MODEL_PATH}/classes.dict",
"in": "y",
"out": "y_ids"
"in": ["y"],
"out": ["y_ids"]
},
{
"in": "y_ids",
"out": "y_onehot",
"in": ["y_ids"],
"out": ["y_onehot"],
"class_name": "one_hotter",
"depth": "#classes_vocab.len",
"single_vector": true
},
{
"class_name": "bert_classifier",
"class_name": "torch_transformers_classifier",
"n_classes": "#classes_vocab.len",
"return_probas": true,
"one_hot_labels": true,
"bert_config_file": "{BERT_PATH}/bert_config.json",
"pretrained_bert": "{BERT_PATH}/bert_model.ckpt",
"pretrained_bert": "{TRANSFORMER}",
"save_path": "{MODEL_PATH}/model",
"load_path": "{MODEL_PATH}/model",
"keep_prob": 0.5,
"learning_rate": 1e-05,
"optimizer": "AdamW",
"optimizer_parameters": {"lr": 1e-05},
"learning_rate_drop_patience": 5,
"learning_rate_drop_div": 2.0,
"in": ["bert_features"],
"in_y": ["y_onehot"],
"in_y": ["y_ids"],
"out": ["y_pred_probas"]
},
{
"in": "y_pred_probas",
"out": "y_pred_ids",
"in": ["y_pred_probas"],
"out": ["y_pred_ids"],
"class_name": "proba2labels",
"max_proba": true
},
{
"in": "y_pred_ids",
"out": "y_pred_labels",
"in": ["y_pred_ids"],
"out": ["y_pred_labels"],
"ref": "classes_vocab"
}
],
Expand All @@ -72,44 +68,36 @@
"epochs": 100,
"batch_size": 64,
"metrics": [
"sets_accuracy",
"f1_macro",
"accuracy",
{
"name": "roc_auc",
"inputs": ["y_onehot", "y_pred_probas"]
}
],
"validation_patience": 5,
"val_every_n_epochs": 1,
"log_every_n_epochs": 1,
"validation_patience": 10,
"val_every_n_batches": 100,
"log_every_n_batches": 100,
"show_examples": false,
"evaluation_targets": ["train", "valid", "test"],
"class_name": "nn_trainer",
"tensorboard_log_dir": "{MODEL_PATH}/"
"class_name": "torch_trainer"
},
"metadata": {
"variables": {
"TRANSFORMER": "haisongzhang/roberta-tiny-cased",
"ROOT_PATH": "~/.deeppavlov",
"DOWNLOADS_PATH": "{ROOT_PATH}/downloads",
"MODELS_PATH": "{ROOT_PATH}/models",
"BERT_PATH": "{DOWNLOADS_PATH}/bert_models_kbqa/cased_L-12_H-768_A-12",
"MODEL_PATH": "{MODELS_PATH}/classifiers/query_prediction"
},
"labels": {
"server_utils": "KerasIntentModel"
"MODEL_PATH": "{MODELS_PATH}/classifiers/query_prediction_eng"
},
"download": [
{
"url": "http://files.deeppavlov.ai/kbqa/datasets/query_prediction.tar.gz",
"subdir": "{DOWNLOADS_PATH}/query_prediction"
"url": "http://files.deeppavlov.ai/kbqa/wikidata/query_prediction_eng.tar.gz",
"subdir": "{MODELS_PATH}/classifiers/query_prediction_eng"
},
{
"url": "http://files.deeppavlov.ai/deeppavlov_data/bert/cased_L-12_H-768_A-12.zip",
"subdir": "{DOWNLOADS_PATH}/bert_models_kbqa"
},
{
"url": "http://files.deeppavlov.ai/kbqa/models/query_prediction.tar.gz",
"subdir": "{MODELS_PATH}/classifiers/query_prediction"
"url": "http://files.deeppavlov.ai/kbqa/wikidata/query_prediction_eng.pickle",
"subdir": "{DOWNLOADS_PATH}/query_prediction"
}
]
}
Expand Down
77 changes: 0 additions & 77 deletions deeppavlov/configs/classifiers/rel_ranking_bert.json

This file was deleted.

0 comments on commit 7f1c926

Please sign in to comment.