You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+70-21Lines changed: 70 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,10 @@ Our goal is to enable AI-application developers and researchers with:
15
15
* a framework for implementing and testing their own dialog models
16
16
* tools for application integration with adjacent infrastructure (messengers, helpdesk software etc.)
17
17
* benchmarking environment for conversational models and uniform access to relevant datasets
18
-
18
+
19
19
## Demo
20
20
21
-
Demo of selected features is available at [demo.ipavlov.ai](http://demo.ipavlov.ai/)
21
+
Demo of selected features is available at [demo.ipavlov.ai](https://demo.ipavlov.ai/)
22
22
23
23
## Features
24
24
@@ -33,6 +33,7 @@ Demo of selected features is available at [demo.ipavlov.ai](http://demo.ipavlov.
33
33
|**Skills**||
34
34
|[Goal-oriented bot](deeppavlov/skills/go_bot/README.md)| Based on Hybrid Code Networks (HCNs) architecture from [Jason D. Williams, Kavosh Asadi, Geoffrey Zweig, Hybrid Code Networks: practical and efficient end-to-end dialog control with supervised and reinforcement learning – 2017](https://arxiv.org/abs/1702.03274). It allows to predict responses in goal-oriented dialog. The model is customizable: embeddings, slot filler and intent classifier can switched on and off on demand. |
35
35
|[Seq2seq goal-oriented bot](deeppavlov/skills/seq2seq_go_bot/README.md)| Dialogue agent predicts responses in a goal-oriented dialog and is able to handle multiple domains (pretrained bot allows calendar scheduling, weather information retrieval, and point-of-interest navigation). The model is end-to-end differentiable and does not need to explicitly model dialogue state or belief trackers. |
36
+
|[ODQA](deeppavlov/skills/odqa/README.md)| An open domain question answering skill. The skill accepts free-form questions about the world and outputs an answer based on its Wikipedia knowledge.|
36
37
|**Embeddings**||
37
38
|[Pre-trained embeddings for the Russian language](pretrained-vectors.md)| Word vectors for the Russian language trained on joint [Russian Wikipedia](https://ru.wikipedia.org/wiki/%D0%97%D0%B0%D0%B3%D0%BB%D0%B0%D0%B2%D0%BD%D0%B0%D1%8F_%D1%81%D1%82%D1%80%D0%B0%D0%BD%D0%B8%D1%86%D0%B0) and [Lenta.ru](https://lenta.ru/) corpora. |
38
39
@@ -44,27 +45,31 @@ View video demo of deployment of a goal-oriented bot and a slot-filling model wi
* `<mode>` can be 'train', 'interact', 'interactbot' or 'riseapi'
157
-
* `<path_to_config>` should be a path to an NLP pipeline json config
160
+
* `<mode>` can be 'train', 'predict', 'interact', 'interactbot' or 'riseapi'
161
+
* `<path_to_config>` should be a path to an NLP pipeline json config (e.g. `deeppavlov/configs/ner/slotfill_dstc2.json`)
162
+
or a name without the `.json` extension of one of the config files [provided](deeppavlov/configs) in this repository (e.g. `slotfill_dstc2`)
158
163
159
-
For 'interactbot' mode you should specify Telegram bot token in `-t` parameter or in `TELEGRAM_TOKEN` environment variable.
164
+
For the 'interactbot' mode you should specify Telegram bot token in `-t` parameter or in `TELEGRAM_TOKEN` environment variable. Also if you want to get custom `/start` and `/help` Telegram messages for the running model you should:
165
+
* Add section to `utils/telegram_utils/model_info.json` with your custom Telegram messages
166
+
* In model config file specify `metadata.labels.telegram_utils` parameter with name which refers to the added section of `utils/telegram_utils/model_info.json`
160
167
161
168
For 'riseapi' mode you should specify api settings (host, port, etc.) in [*utils/server_utils/server_config.json*](utils/server_utils/server_config.json) configuration file. If provided, values from *model_defaults* section override values for the same parameters from *common_defaults* section. Model names in *model_defaults* section should be similar to the class names of the models main component.
162
169
170
+
For 'predict' you can specify path to input file with `-f` or `--input-file` parameter, otherwise, data will be taken
171
+
from stdin.
172
+
Every line of input text will be used as a pipeline input parameter, so one example will consist of as many lines,
173
+
as many input parameters your pipeline expects.
174
+
You can also specify batch size with `-b` or `--batch-size` parameter.
175
+
163
176
Available model configs are:
164
177
165
178
- ```deeppavlov/configs/go_bot/*.json```
166
179
167
180
- ```deeppavlov/configs/seq2seq_go_bot/*.json```
168
181
182
+
- ```deeppavlov/configs/odqa/*.json```
183
+
169
184
- ```deeppavlov/configs/squad/*.json```
170
185
171
186
- ```deeppavlov/configs/intents/*.json```
172
187
173
188
- ```deeppavlov/configs/ner/*.json```
174
189
175
-
- ```deeppavlov/configs/rankinf/*.json```
190
+
- ```deeppavlov/configs/ranking/*.json```
176
191
177
192
- ```deeppavlov/configs/error_model/*.json```
178
193
@@ -251,7 +266,7 @@ Chainer is a core concept of DeepPavlov library: chainer builds a pipeline from
251
266
its inputs and outputs as arrays of names, for example: `"in": ["tokens", "features"]` and `"out": ["token_embeddings", "features_embeddings"]` and you can chain outputs of one components with inputs of other components:
@@ -261,8 +276,10 @@ its inputs and outputs as arrays of names, for example: `"in": ["tokens", "featu
261
276
"out": ["x_tokens"]
262
277
},
263
278
```
264
-
Each [Component](deeppavlov/core/models/component.py) in the pipeline must implement method `__call__` and has `name` parameter, which is its registered codename. It can also have any other parameters which repeat its `__init__()` method arguments.
265
-
Default values of `__init__()` arguments will be overridden with the config values during the initialization of a class instance.
279
+
Each [Component](deeppavlov/core/models/component.py) in the pipeline must implement method `__call__` and has `name` parameter, which is its registered codename,
280
+
or `class` parameter in the form of `module_name:ClassName`.
281
+
It can also have any other parameters which repeat its `__init__()` method arguments.
282
+
Default values of `__init__()` arguments will be overridden with the config values during the initialization of a class instance.
266
283
267
284
You can reuse components in the pipeline to process different parts of data with the help of `id` and `ref` parameters:
268
285
```json
@@ -278,7 +295,7 @@ You can reuse components in the pipeline to process different parts of data with
278
295
"out": ["y_tokens"]
279
296
},
280
297
```
281
-
298
+
282
299
### Training
283
300
284
301
There are two abstract classes for trainable components: **Estimator** and **NNModel**.
@@ -383,6 +400,38 @@ A particular format of returned data should be defined in `__call__()`.
383
400
384
401
Inference is triggered by `deeppavlov.core.commands.infer.interact_model()` function. There is no need in a separate JSON for inference.
385
402
403
+
### Rest API
404
+
405
+
Each library component or skill can be easily made available for inference as a REST web service. The general method is:
(optional `-d` key is for dependencies download before service start)
410
+
411
+
Web service properties (host, port, model endpoint, GET request arguments) are provided in `utils/server_utils/server_config.json`.
412
+
Properties from `common_defaults` section are used by default unless they are overridden by component-specific properties, provided in `model_defaults` section of the `server_config.json`.
413
+
Component-specific properties are bound to the component by `server_utils` label in `metadata/labels` section of the component config. Value of `server_utils` label from component config should match with properties key from `model_defaults` section of `server_config.json`.
414
+
415
+
For example, `metadata/labels/server_utils` tag from `go_bot/gobot_dstc2.json` references to the *GoalOrientedBot* section of `server_config.json`. Therefore, `model_endpoint` parameter in `common_defaults` will be will be overridden with the same parameter from `model_defaults/GoalOrientedBot`.
416
+
417
+
Model argument names are provided as list in `model_args_names` parameter, where arguments order corresponds to component API.
418
+
When inferencing model via REST api, JSON payload keys should match component arguments names from `model_args_names`.
419
+
Default argument name for one argument components is *"context"*.
420
+
Here are POST requests examples for some of the library components:
421
+
422
+
| Component | POST request JSON payload example |
423
+
| --------- | -------------------- |
424
+
|**One argument components**|
425
+
| NER component | {"context":"Elon Musk launched his cherry Tesla roadster to the Mars orbit"} |
426
+
| Intent classification component | {"context":"I would like to go to a restaurant with Asian cuisine this evening"} |
| Ranking component | {"context":"What is the average cost of life insurance services?"} |
429
+
| (Seq2seq) Goal-oriented bot | {"context":"Hello, can you help me to find and book a restaurant this evening?"} |
430
+
|**Two arguments components**|
431
+
| Question Answering component | {"context":"After 1765, growing philosophical and political differences strained the relationship between Great Britain and its colonies.", "question":"What strained the relationship between Great Britain and its colonies?"} |
432
+
433
+
Flasgger UI for API testing is provided on `<host>:<port>/apidocs` when running a component in `riseapi` mode.
0 commit comments