Skip to content

Commit

Permalink
Release 0.0.9 (#552)
Browse files Browse the repository at this point in the history
Release 0.0.9
  • Loading branch information
seliverstov committed Oct 25, 2018
2 parents 14615e6 + 75feb6e commit fd7e850
Show file tree
Hide file tree
Showing 179 changed files with 7,304 additions and 3,595 deletions.
2 changes: 1 addition & 1 deletion deeppavlov/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = '0.0.8'
__version__ = '0.0.9'
__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
3 changes: 2 additions & 1 deletion deeppavlov/agents/default_agent/default_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ def _call(self, utterances_batch: list, utterances_ids: Optional[list]=None) ->

if skill_i_utt_indexes:
skill_i_utt_batch = [utterances_batch[i] for i in skill_i_utt_indexes]
skill_i_utt_ids = [ids[i] for i in skill_i_utt_indexes]
res = [(None, 0.)] * batch_size
predicted, confidence = skill(skill_i_utt_batch, skill_i_utt_indexes)
predicted, confidence = skill(skill_i_utt_batch, skill_i_utt_ids)

for i, predicted, confidence in zip(skill_i_utt_indexes, predicted, confidence):
res[i] = (predicted, confidence)
Expand Down
14 changes: 7 additions & 7 deletions deeppavlov/agents/ecommerce_agent/ecommerce_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import argparse
from collections import defaultdict
from typing import List, Dict, Any
import argparse

from deeppavlov.agents.rich_content.default_rich_content import PlainText, ButtonsFrame, Button
from deeppavlov.core.agent.agent import Agent
from deeppavlov.core.agent.rich_content import RichMessage
from deeppavlov.core.commands.infer import build_model_from_config
from deeppavlov.core.common.log import get_logger
from deeppavlov.core.skill.skill import Skill
from deeppavlov.core.commands.infer import build_model_from_config
from deeppavlov.core.agent.rich_content import RichMessage
from deeppavlov.agents.rich_content.default_rich_content import PlainText, ButtonsFrame, Button
from deeppavlov.deep import find_config
from utils.ms_bot_framework_utils.server import run_ms_bot_framework_server

Expand Down Expand Up @@ -144,8 +144,8 @@ def _call(self, utterances_batch: list, utterances_ids: list=None) -> list:
buttons_frame = ButtonsFrame(
text="Please specify a "+entropy[0][1])
for ent_value in entropy[0][2][:3]:
button_a = Button(ent_value[0],
f'@entropy:{len(self.history[id_])-1}:{entropy[0][1]}:{ent_value[0]}')
button_a = Button(ent_value[0],
f'@entropy:{len(self.history[id_])-1}:{entropy[0][1]}:{ent_value[0]}')

buttons_frame.add_button(button_a)

Expand Down Expand Up @@ -180,7 +180,7 @@ def make_agent() -> EcommerceAgent:
"""

config_path = find_config('ecommerce_bot')
skill = build_model_from_config(config_path, as_component=True)
skill = build_model_from_config(config_path)
agent = EcommerceAgent(skills=[skill])
return agent

Expand Down
64 changes: 41 additions & 23 deletions deeppavlov/configs/classifiers/insults_kaggle.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
"pipe": [
{
"id": "classes_vocab",
"name": "default_vocab",
"name": "simple_vocab",
"fit_on": [
"y"
],
"level": "token",
"save_path": "vocabs/insults_kaggle_classes.dict",
"load_path": "vocabs/insults_kaggle_classes.dict"
"save_path": "classifiers/insults_kaggle_v1/classes.dict",
"load_path": "classifiers/insults_kaggle_v1/classes.dict",
"in": "y",
"out": "y_ids"
},
{
"in": [
Expand All @@ -48,37 +49,39 @@
"out": "x_emb",
"id": "my_embedder",
"name": "fasttext",
"save_path": "embeddings/wordpunct_tok_reddit_comments_2017_11_300.bin",
"load_path": "embeddings/wordpunct_tok_reddit_comments_2017_11_300.bin",
"dim": 300
"load_path": "embeddings/wordpunct_tok_reddit_comments_2017_11_300.bin"
},
{
"in": "y_ids",
"out": "y_onehot",
"name": "one_hotter",
"depth": "#classes_vocab.len"
},
{
"in": [
"x_emb"
],
"in_y": [
"y"
"y_onehot"
],
"out": [
"y_labels",
"y_probas_dict"
"y_pred_probas"
],
"main": true,
"name": "keras_classification_model",
"save_path": "classifiers/insults_kaggle_v0",
"load_path": "classifiers/insults_kaggle_v0",
"save_path": "classifiers/insults_kaggle_v1/model",
"load_path": "classifiers/insults_kaggle_v1/model",
"embedding_size": "#my_embedder.dim",
"classes": "#classes_vocab.keys()",
"n_classes": "#classes_vocab.len",
"kernel_sizes_cnn": [
1,
2,
3
],
"filters_cnn": 256,
"confident_threshold": 0.5,
"optimizer": "Adam",
"lear_rate": 0.01,
"lear_rate_decay": 0.1,
"learning_rate": 0.01,
"learning_rate_decay": 0.1,
"loss": "binary_crossentropy",
"last_layer_activation": "softmax",
"text_size": 100,
Expand All @@ -87,20 +90,33 @@
"dropout_rate": 0.5,
"dense_size": 100,
"model_name": "cnn_model"
},
{
"in": "y_pred_probas",
"out": "y_pred_ids",
"name": "proba2labels",
"max_proba": true
},
{
"in": "y_pred_ids",
"out": "y_pred_labels",
"ref": "classes_vocab"
}
],
"out": [
"y_labels",
"y_probas_dict"
"y_pred_labels"
]
},
"train": {
"epochs": 1000,
"batch_size": 64,
"metrics": [
"classification_accuracy",
"classification_f1",
"classification_roc_auc"
"sets_accuracy",
"f1_macro",
{
"name": "roc_auc",
"inputs": ["y_onehot", "y_pred_probas"]
}
],
"validation_patience": 5,
"val_every_n_epochs": 5,
Expand All @@ -119,12 +135,14 @@
"server_utils": "KerasIntentModel"
},
"download": [
"http://files.deeppavlov.ai/deeppavlov_data/vocabs.tar.gz",
"http://files.deeppavlov.ai/deeppavlov_data/classifiers.tar.gz",
"http://files.deeppavlov.ai/datasets/insults_data.tar.gz",
{
"url": "http://files.deeppavlov.ai/embeddings/reddit_fastText/wordpunct_tok_reddit_comments_2017_11_300.bin",
"subdir": "embeddings"
},
{
"url": "http://files.deeppavlov.ai/deeppavlov_data/classifiers/insults_kaggle_v1.tar.gz",
"subdir": "classifiers"
}
]
}
Expand Down
81 changes: 59 additions & 22 deletions deeppavlov/configs/classifiers/intents_dstc2.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
"pipe": [
{
"id": "classes_vocab",
"name": "default_vocab",
"name": "simple_vocab",
"fit_on": [
"y"
],
"level": "token",
"save_path": "vocabs/dstc2_classes.dict",
"load_path": "vocabs/dstc2_classes.dict"
"save_path": "classifiers/intents_dstc2_v6/classes.dict",
"load_path": "classifiers/intents_dstc2_v6/classes.dict",
"in": "y",
"out": "y_ids"
},
{
"in": "x",
Expand All @@ -37,63 +38,96 @@
"out": "x_emb",
"id": "my_embedder",
"name": "fasttext",
"save_path": "embeddings/dstc2_fastText_model.bin",
"load_path": "embeddings/dstc2_fastText_model.bin",
"dim": 100
"load_path": "embeddings/dstc2_fastText_model.bin"
},
{
"in": "y_ids",
"out": "y_onehot",
"name": "one_hotter",
"id": "my_one_hotter",
"depth": "#classes_vocab.len",
"multi_label": true
},
{
"in": [
"x_emb"
],
"in_y": [
"y"
"y_onehot"
],
"out": [
"y_labels",
"y_probas_dict"
"y_pred_probas"
],
"main": true,
"name": "keras_classification_model",
"save_path": "classifiers/intents_dstc2_v4",
"load_path": "classifiers/intents_dstc2_v4",
"save_path": "classifiers/intents_dstc2_v6/model",
"load_path": "classifiers/intents_dstc2_v6/model",
"embedding_size": "#my_embedder.dim",
"classes": "#classes_vocab.keys()",
"n_classes": "#classes_vocab.len",
"kernel_sizes_cnn": [
1,
2,
3
],
"filters_cnn": 512,
"confident_threshold": 0.5,
"optimizer": "Adam",
"lear_rate": 0.1,
"lear_rate_decay": 0.1,
"learning_rate": 0.1,
"learning_rate_decay": 0.1,
"loss": "binary_crossentropy",
"text_size": 15,
"coef_reg_cnn": 1e-4,
"coef_reg_den": 1e-4,
"dropout_rate": 0.5,
"dense_size": 100,
"model_name": "cnn_model"
},
{
"in": "y_pred_probas",
"out": "y_pred_ids",
"name": "proba2labels",
"confident_threshold": 0.5
},
{
"in": "y_pred_ids",
"out": "y_pred_labels",
"ref": "classes_vocab"
},
{
"ref": "my_one_hotter",
"in": "y_pred_ids",
"out": "y_pred_onehot"
}
],
"out": [
"y_labels",
"y_probas_dict"
"y_pred_probas"
]
},
"train": {
"epochs": 1000,
"batch_size": 64,
"metrics": [
"classification_accuracy",
"classification_f1",
"classification_roc_auc"
{
"name": "sets_accuracy",
"inputs": [
"y",
"y_pred_labels"
]
},
{
"name": "roc_auc",
"inputs": [
"y_onehot",
"y_pred_probas"
]
}
],
"validation_patience": 5,
"val_every_n_epochs": 5,
"log_every_n_batches": 100,
"show_examples": false
"show_examples": false,
"validate_best": true,
"test_best": true
},
"metadata": {
"requirements": [
Expand All @@ -105,11 +139,14 @@
"server_utils": "KerasIntentModel"
},
"download": [
"http://files.deeppavlov.ai/deeppavlov_data/classifiers.tar.gz",
"http://files.deeppavlov.ai/deeppavlov_data/vocabs.tar.gz",
{
"url": "http://files.deeppavlov.ai/deeppavlov_data/embeddings/dstc2_fastText_model.bin",
"subdir": "embeddings"
},
{
"url": "http://files.deeppavlov.ai/deeppavlov_data/classifiers/intents_dstc2_v6.tar.gz",
"subdir": "classifiers"
}
]
}
Expand Down

0 comments on commit fd7e850

Please sign in to comment.