Skip to content

Commit

Permalink
feat: fix tests and update release version to 0.9.0 (deeppavlov#1179)
Browse files Browse the repository at this point in the history
* chore: update required transformers version

* chore: update version number to 0.9.0

* chore: rebuild registry.json

* tests: add tests for imdb sentiment

* tests: test imdb models on TI only as there is no pretrained model

* fix: generate inputs for inferring testing

* tests: fix return types on test cases

* fix: install go_bot requirements in go_bot tutorial

* fix: valid chainer outputs for elmo_1b_benchmark configs

* tests: test go_bot_minimal on a dialog input
  • Loading branch information
yoptar authored Apr 19, 2020
1 parent 485ea8f commit 444d484
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion deeppavlov/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def evaluate_model(config: [str, Path, dict], download: bool = False, recursive:
except ImportError:
'Assuming that requirements are not yet installed'

__version__ = '0.8.0'
__version__ = '0.9.0'
__author__ = 'Neural Networks and Deep Learning lab, MIPT'
__description__ = 'An open source library for building end-to-end dialog systems and training chatbots.'
__keywords__ = ['NLP', 'NER', 'SQUAD', 'Intents', 'Chatbot']
Expand Down
1 change: 0 additions & 1 deletion deeppavlov/configs/classifiers/sentiment_imdb_bert.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
"metrics": [
"f1_weighted",
"f1_macro",
"sets_accuracy",
{
"name": "roc_auc",
"inputs": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
"metrics": [
"f1_weighted",
"f1_macro",
"sets_accuracy",
{
"name": "roc_auc",
"inputs": [
Expand Down
5 changes: 2 additions & 3 deletions deeppavlov/configs/elmo/elmo_1b_benchmark.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
}
],
"out": [
"x_char_ids",
"y_token_ids"
"x_char_ids"
]
},
"train": {
Expand Down Expand Up @@ -83,4 +82,4 @@
}
]
}
}
}
5 changes: 2 additions & 3 deletions deeppavlov/configs/elmo/elmo_1b_benchmark_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
}
],
"out": [
"x_char_ids",
"y_token_ids"
"x_char_ids"
]
},
"train": {
Expand Down Expand Up @@ -81,4 +80,4 @@
}
]
}
}
}
2 changes: 1 addition & 1 deletion deeppavlov/core/common/registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
"glove": "deeppavlov.models.embedders.glove_embedder:GloVeEmbedder",
"go_bot": "deeppavlov.models.go_bot.network:GoalOrientedBot",
"hashing_tfidf_vectorizer": "deeppavlov.models.vectorizers.hashing_tfidf_vectorizer:HashingTfIdfVectorizer",
"imdb_reader": "deeppavlov.dataset_readers.imdb_reader:ImdbReader",
"hybrid_ner_model": "deeppavlov.models.ner.NER_model:HybridNerModel",
"imdb_reader": "deeppavlov.dataset_readers.imdb_reader:ImdbReader",
"insurance_reader": "deeppavlov.dataset_readers.insurance_reader:InsuranceReader",
"joint_tagger_parser": "deeppavlov.models.syntax_parser.joint:JointTaggerParser",
"kb_answer_parser_wikidata": "deeppavlov.models.kbqa.kb_answer_parser_wikidata:KBAnswerParserWikidata",
Expand Down
2 changes: 1 addition & 1 deletion deeppavlov/requirements/transformers.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
transformers==2.5.0
transformers==2.8.0
3 changes: 2 additions & 1 deletion examples/gobot_extended_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
},
"outputs": [],
"source": [
"!pip install deeppavlov"
"!pip install deeppavlov\n",
"!python -m deeppavlov install gobot_simple_dstc2"
]
},
{
Expand Down
22 changes: 12 additions & 10 deletions tests/test_quick_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
# Mapping from model name to config-model_dir-ispretrained and corresponding queries-response list.
PARAMS = {
"ecommerce_skill": {
("ecommerce_skill/bleu_retrieve.json", "ecommerce_skill_bleu", ALL_MODES): [('Dummy text', '[]', '{}', None)],
("ecommerce_skill/tfidf_retrieve.json", "ecommerce_skill_tfidf", ALL_MODES): [('Dummy text', '[]', '{}', None)]
("ecommerce_skill/bleu_retrieve.json", "ecommerce_skill_bleu", ALL_MODES): [('Dummy text', [], {}, None)],
("ecommerce_skill/tfidf_retrieve.json", "ecommerce_skill_tfidf", ALL_MODES): [('Dummy text', [], {}, None)]
},
"faq": {
("faq/tfidf_logreg_en_faq.json", "faq_tfidf_logreg_en", ALL_MODES): [ONE_ARGUMENT_INFER_CHECK],
Expand Down Expand Up @@ -85,7 +85,7 @@
"go_bot": {
("go_bot/gobot_dstc2.json", "gobot_dstc2", ALL_MODES): [ONE_ARGUMENT_INFER_CHECK],
("go_bot/gobot_dstc2_best.json", "gobot_dstc2_best", ALL_MODES): [ONE_ARGUMENT_INFER_CHECK],
("go_bot/gobot_dstc2_minimal.json", "gobot_dstc2_minimal", ('TI',)): [ONE_ARGUMENT_INFER_CHECK]
("go_bot/gobot_dstc2_minimal.json", "gobot_dstc2_minimal", ('TI',)): [([{"text": "the weather is clooudy and gloooomy"}], None)]
},
"classifiers": {
("classifiers/paraphraser_bert.json", "classifiers", ('IP', 'TI')): [TWO_ARGUMENTS_INFER_CHECK],
Expand All @@ -107,13 +107,15 @@
("classifiers/yahoo_convers_vs_info.json", "classifiers", ('IP',)): [ONE_ARGUMENT_INFER_CHECK],
("classifiers/ru_obscenity_classifier.json", "classifiers", ('IP',)):
[
("Ну и сука же она", 'True'),
("я два года жду эту игру", 'False')
("Ну и сука же она", True),
("я два года жду эту игру", False)
],
("classifiers/sentiment_sst_conv_bert.json", "classifiers", ('IP',)): [ONE_ARGUMENT_INFER_CHECK],
("classifiers/sentiment_sst_multi_bert.json", "classifiers", ('IP',)): [ONE_ARGUMENT_INFER_CHECK],
("classifiers/sentiment_yelp_conv_bert.json", "classifiers", ('IP',)): [ONE_ARGUMENT_INFER_CHECK],
("classifiers/sentiment_yelp_multi_bert.json", "classifiers", ('IP',)): [ONE_ARGUMENT_INFER_CHECK]
("classifiers/sentiment_yelp_multi_bert.json", "classifiers", ('IP',)): [ONE_ARGUMENT_INFER_CHECK],
("classifiers/sentiment_imdb_bert.json", "classifiers", ('TI',)): [ONE_ARGUMENT_INFER_CHECK],
("classifiers/sentiment_imdb_conv_bert.json", "classifiers", ('TI',)): [ONE_ARGUMENT_INFER_CHECK]
},
"snips": {
("classifiers/intents_snips.json", "classifiers", ('TI',)): [ONE_ARGUMENT_INFER_CHECK],
Expand Down Expand Up @@ -152,9 +154,9 @@
("ner/ner_rus.json", "ner_rus", ('IP',)): [ONE_ARGUMENT_INFER_CHECK],
("ner/slotfill_dstc2.json", "slotfill_dstc2", ('IP',)):
[
("chinese food", "{'food': 'chinese'}"),
("in the west part", "{'area': 'west'}"),
("moderate price range", "{'pricerange': 'moderate'}")
("chinese food", {'food': 'chinese'}),
("in the west part", {'area': 'west'}),
("moderate price range", {'pricerange': 'moderate'})
]
},
"sentence_segmentation": {
Expand Down Expand Up @@ -386,7 +388,7 @@ class TestQuickStart(object):
@staticmethod
def infer(config_path, qr_list=None, check_outputs=True):

*inputs, expected_outputs = zip(*qr_list) if qr_list else [],
*inputs, expected_outputs = zip(*qr_list) if qr_list else ([],)
with ProcessPoolExecutor(max_workers=1) as executor:
f = executor.submit(_infer, config_path, inputs)
outputs = f.result()
Expand Down

0 comments on commit 444d484

Please sign in to comment.