Skip to content

Commit

Permalink
refactor: ranking_ubuntu_v2_torch_bert_uncased -> ranking_ubuntu_v2_b…
Browse files Browse the repository at this point in the history
…ert_uncased
  • Loading branch information
IgnatovFedor committed Feb 1, 2022
1 parent 17ce9f5 commit e656079
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 131 deletions.
79 changes: 52 additions & 27 deletions deeppavlov/configs/ranking/ranking_ubuntu_v2_bert_uncased.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,65 +8,90 @@
"seed": 243
},
"chainer": {
"in": ["x"],
"in_y": ["y"],
"in": [
"x"
],
"in_y": [
"y"
],
"pipe": [
{
"class_name": "bert_ranker_preprocessor",
"vocab_file": "{DOWNLOADS_PATH}/bert_models/uncased_L-12_H-768_A-12/vocab.txt",
"class_name": "torch_bert_ranker_preprocessor",
"vocab_file": "bert-base-uncased",
"do_lower_case": true,
"max_seq_length": 128,
"in": ["x"],
"out": ["bert_features"]
"in": [
"x"
],
"out": [
"bert_features"
]
},
{
"class_name": "bert_ranker",
"class_name": "torch_bert_ranker",
"one_hot_labels": false,
"bert_config_file": "{DOWNLOADS_PATH}/bert_models/uncased_L-12_H-768_A-12/bert_config.json",
"pretrained_bert": "{DOWNLOADS_PATH}/bert_models/uncased_L-12_H-768_A-12/bert_model.ckpt",
"pretrained_bert": "bert-base-uncased",
"save_path": "{MODEL_PATH}/model",
"load_path": "{MODEL_PATH}/model",
"learning_rate": 2e-05,
"in": ["bert_features"],
"in_y": ["y"],
"out": ["predictions"]
"optimizer": "AdamW",
"optimizer_parameters": {
"lr": 2e-5,
"weight_decay": 1e-2,
"betas": [
0.9,
0.999
],
"eps": 1e-6
},
"in": [
"bert_features"
],
"in_y": [
"y"
],
"out": [
"predictions"
]
}
],
"out": ["predictions"]
"out": [
"predictions"
]
},
"train": {
"batch_size": 32,
"pytest_max_batches": 2,
"train_metrics": [],
"metrics": ["r@1", "r@2", "r@5"],
"metrics": [
"r@1",
"r@2",
"r@5"
],
"validation_patience": 1,
"val_every_n_batches": -1,
"val_every_n_epochs": 1,
"log_every_n_batches": -1,
"validate_best": true,
"test_best": true,
"tensorboard_log_dir": "{MODEL_PATH}/"
"log_every_n_epochs": 1,
"evaluation_targets": [
"valid",
"test"
],
"class_name": "torch_trainer"
},
"metadata": {
"variables": {
"ROOT_PATH": "~/.deeppavlov",
"DOWNLOADS_PATH": "{ROOT_PATH}/downloads",
"MODELS_PATH": "{ROOT_PATH}/models",
"MODEL_PATH": "{MODELS_PATH}/ubuntu_v2_uncased_bert_model"
"MODEL_PATH": "{MODELS_PATH}/ubuntu_v2_uncased_torch_bert_model"
},
"download": [
{
"url": "http://files.deeppavlov.ai/datasets/ubuntu_v2_data.tar.gz",
"subdir": "{DOWNLOADS_PATH}/ubuntu_v2_data"
},
{
"url": "http://files.deeppavlov.ai/deeppavlov_data/bert/uncased_L-12_H-768_A-12.zip",
"subdir": "{DOWNLOADS_PATH}/bert_models"
},
{
"url": "http://files.deeppavlov.ai/deeppavlov_data/ubuntu_v2_uncased_bert_model.tar.gz",
"url": "http://files.deeppavlov.ai/deeppavlov_data/ubuntu_v2_uncased_torch_bert_model_v0.tar.gz",
"subdir": "{MODELS_PATH}"
}
]
}
}
}

This file was deleted.

3 changes: 1 addition & 2 deletions docs/features/models/neural_ranking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,14 @@ Before using models make sure that all required packages are installed running t

.. code:: bash
python -m deeppavlov install ranking_ubuntu_v2_bert_uncased
python -m deeppavlov install ranking_ubuntu_v2_bert_sep
python -m deeppavlov install ranking_ubuntu_v2_bert_sep_interact
or on PyTorch:

.. code:: bash
python -m deeppavlov install ranking_ubuntu_v2_torch_bert_uncased
python -m deeppavlov install ranking_ubuntu_v2_bert_uncased
To train the interaction-based (accurate, slow) model on the `Ubuntu V2`_ from command line:
Expand Down
4 changes: 1 addition & 3 deletions docs/features/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ Available pre-trained models for ranking:
+-------------------+----------------------------------------------------------------------------------------------------------------------+-----------+-------+-------+-------+-----------+
| `Ubuntu V2`_ | :config:`ranking_ubuntu_v2_mt_word2vec_smn <ranking/ranking_ubuntu_v2_mt_word2vec_smn.json>` | 68.56 | 67.91 | 81.49 | 95.63 | 1609 MB |
+-------------------+----------------------------------------------------------------------------------------------------------------------+-----------+-------+-------+-------+-----------+
| `Ubuntu V2`_ | :config:`ranking_ubuntu_v2_bert_uncased <ranking/ranking_ubuntu_v2_bert_uncased.json>` | 66.5 | 66.6 | -- | -- | 396 MB |
+-------------------+----------------------------------------------------------------------------------------------------------------------+-----------+-------+-------+-------+-----------+
| `Ubuntu V2`_ | :config:`ranking_ubuntu_v2_bert_uncased on PyTorch <ranking/ranking_ubuntu_v2_torch_bert_uncased.json>` | 65.73 | 65.74 | -- | -- | 1.1 Gb |
| `Ubuntu V2`_ | :config:`ranking_ubuntu_v2_bert_uncased <ranking/ranking_ubuntu_v2_bert_uncased.json>` | 65.73 | 65.74 | -- | -- | 1.1 Gb |
+-------------------+----------------------------------------------------------------------------------------------------------------------+-----------+-------+-------+-------+-----------+
| `Ubuntu V2`_ | :config:`ranking_ubuntu_v2_bert_sep <ranking/ranking_ubuntu_v2_bert_sep.json>` | 66.5 | 66.5 | -- | -- | 396 MB |
+-------------------+----------------------------------------------------------------------------------------------------------------------+-----------+-------+-------+-------+-----------+
Expand Down
3 changes: 1 addition & 2 deletions tests/test_quick_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,7 @@
("ranking/ranking_ubuntu_v2_mt_word2vec_dam_transformer.json", "ranking", ('IP',)):
[(' & & & & & & & & bonhoeffer whar drives do you want to mount what & i have an ext3 usb drive '
'& look with fdisk -l & hello there & fdisk is all you need',
None)],
("ranking/ranking_ubuntu_v2_torch_bert_uncased.json", "ranking", ('TI',)): [ONE_ARGUMENT_INFER_CHECK]
None)]
},
"doc_retrieval": {
("doc_retrieval/en_ranker_tfidf_wiki_test.json", "doc_retrieval", ('TI',)): [ONE_ARGUMENT_INFER_CHECK],
Expand Down

0 comments on commit e656079

Please sign in to comment.