Skip to content

Commit

Permalink
Feat/llm-based and ranking-based dm (#405)
Browse files Browse the repository at this point in the history
* feat: create files for llm based response selection

* feat: tests

* feat: algorithm

* fix: filter bad or toxic uttrs

* feat: ranking based response selector

* feat: model cards

* feat: ranking and refactoring

* feat: component files

* feat: component description

* feat: component description

* feat: use gpt-j resp selector

* feat: context

* feat: utilize hypotheses correctly

* fix: configs

* fix: configs

* fix: mapping

* fix: utilize ranker based selector

* fix: decay dummy

* fix: decay dummy

* fix: response

* fix: remove old selector

* fix: logs

* fix: getting annotations

* fix: code style

* fix: deepy uses resp selector

* fix: no language

* fix: ru usage

* fix: usage of formatter

* fix: codestyle

* fix: logs

* fix: after review

* fix: sync
  • Loading branch information
dilyararimovna authored Apr 25, 2023
1 parent ae14c7a commit e2dfd33
Show file tree
Hide file tree
Showing 62 changed files with 2,323 additions and 587 deletions.
6 changes: 3 additions & 3 deletions assistant_dists/ai_faq_assistant/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ services:
- "./annotators/SentSeg:/src"
ports:
- 8011:8011
no-restrictions-selector:
ranking-based-response-selector:
volumes:
- "./response_selectors/convers_evaluation_based_selector:/src"
- "./response_selectors/ranking_based_response_selector:/src"
- "./common:/src/common"
ports:
- 8009:8009
- 8002:8002
badlisted-words:
volumes:
- "./annotators/BadlistedWordsDetector:/src"
Expand Down
33 changes: 11 additions & 22 deletions assistant_dists/ai_faq_assistant/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ services:
agent:
command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.pipeline_config=assistant_dists/ai_faq_assistant/pipeline_conf.json'
environment:
WAIT_HOSTS: "sentseg:8011, no-restrictions-selector:8009, badlisted-words:8018, combined-classification:8087,
WAIT_HOSTS: "sentseg:8011, ranking-based-response-selector:8002, badlisted-words:8018, combined-classification:8087,
sentence-ranker:8128, prompt-selector:8135, transformers-lm-oasst12b:8158,
dff-ai-faq-prompted-skill:8143"
WAIT_HOSTS_TIMEOUT: ${WAIT_TIMEOUT:-1000}
Expand Down Expand Up @@ -38,32 +38,21 @@ services:
reservations:
memory: 2G

no-restrictions-selector:
ranking-based-response-selector:
env_file: [ .env ]
build:
args:
TAG_BASED_SELECTION: 1
CALL_BY_NAME_PROBABILITY: 0.5
PROMPT_PROBA: 0
ACKNOWLEDGEMENT_PROBA: 0.3
PRIORITIZE_WITH_REQUIRED_ACT: 0
PRIORITIZE_NO_DIALOG_BREAKDOWN: 0
PRIORITIZE_WITH_SAME_TOPIC_ENTITY: 0
IGNORE_DISLIKED_SKILLS: 0
GREETING_FIRST: 0
RESTRICTION_FOR_SENSITIVE_CASE: 0
PRIORITIZE_PROMTS_WHEN_NO_SCRIPTS: 0
MAX_TURNS_WITHOUT_SCRIPTS: 100
ADD_ACKNOWLEDGMENTS_IF_POSSIBLE: 0
PRIORITIZE_SCRIPTED_SKILLS: 0
CONFIDENCE_STRENGTH: 0.8
CONV_EVAL_STRENGTH: 0.4
PRIORITIZE_HUMAN_INITIATIVE: 1
QUESTION_TO_QUESTION_DOWNSCORE_COEF: 0.8
SERVICE_PORT: 8002
SERVICE_NAME: response_selector
LANGUAGE: EN
SENTENCE_RANKER_ANNOTATION_NAME: sentence_ranker
SENTENCE_RANKER_SERVICE_URL: http://sentence-ranker:8128/respond
SENTENCE_RANKER_TIMEOUT: 3
N_UTTERANCES_CONTEXT: 5
FILTER_TOXIC_OR_BADLISTED: 1
context: .
dockerfile: ./response_selectors/convers_evaluation_based_selector/Dockerfile
command: flask run -h 0.0.0.0 -p 8009
dockerfile: ./response_selectors/ranking_based_response_selector/Dockerfile
command: flask run -h 0.0.0.0 -p 8002
environment:
- FLASK_APP=server
deploy:
Expand Down
8 changes: 4 additions & 4 deletions assistant_dists/ai_faq_assistant/pipeline_conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,18 +273,18 @@
"connector": {
"protocol": "http",
"timeout": 1.0,
"url": "http://no-restrictions-selector:8009/respond"
"url": "http://ranking-based-response-selector:8002/respond"
},
"dialog_formatter": "state_formatters.dp_formatters:full_history_dialog",
"dialog_formatter": "state_formatters.dp_formatters:cropped_dialog",
"response_formatter": "state_formatters.dp_formatters:base_response_selector_formatter_service",
"previous_services": [
"candidate_annotators"
],
"state_manager_method": "add_bot_utterance",
"is_enabled": true,
"source": {
"directory": "response_selectors/convers_evaluation_based_selector",
"container": "no-restrictions-selector",
"directory": "response_selectors/ranking_based_response_selector",
"container": "ranking-based-response-selector",
"endpoint": "respond"
}
}
Expand Down
6 changes: 3 additions & 3 deletions assistant_dists/deeppavlov_assistant/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ services:
- ".:/dp-agent"
ports:
- 4242:4242
no-restrictions-selector:
ranking-based-response-selector:
volumes:
- "./response_selectors/convers_evaluation_based_selector:/src"
- "./response_selectors/ranking_based_response_selector:/src"
- "./common:/src/common"
ports:
- 8009:8009
- 8002:8002
sentence-ranker:
volumes:
- "./services/sentence_ranker:/src"
Expand Down
33 changes: 11 additions & 22 deletions assistant_dists/deeppavlov_assistant/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,29 @@ services:
agent:
command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.pipeline_config=assistant_dists/deeppavlov_assistant/pipeline_conf.json'
environment:
WAIT_HOSTS: "no-restrictions-selector:8009, sentence-ranker:8128, prompt-selector:8135, openai-api-chatgpt:8145,
WAIT_HOSTS: "ranking-based-response-selector:8002, sentence-ranker:8128, prompt-selector:8135, openai-api-chatgpt:8145,
dff-deeppavlov-prompted-skill:8146"
WAIT_HOSTS_TIMEOUT: ${WAIT_TIMEOUT:-1000}
HIGH_PRIORITY_INTENTS: 1
RESTRICTION_FOR_SENSITIVE_CASE: 1
ALWAYS_TURN_ON_ALL_SKILLS: 0
LANGUAGE: EN

no-restrictions-selector:
ranking-based-response-selector:
env_file: [ .env ]
build:
args:
TAG_BASED_SELECTION: 1
CALL_BY_NAME_PROBABILITY: 0.5
PROMPT_PROBA: 0
ACKNOWLEDGEMENT_PROBA: 0.3
PRIORITIZE_WITH_REQUIRED_ACT: 0
PRIORITIZE_NO_DIALOG_BREAKDOWN: 0
PRIORITIZE_WITH_SAME_TOPIC_ENTITY: 0
IGNORE_DISLIKED_SKILLS: 0
GREETING_FIRST: 0
RESTRICTION_FOR_SENSITIVE_CASE: 0
PRIORITIZE_PROMTS_WHEN_NO_SCRIPTS: 0
MAX_TURNS_WITHOUT_SCRIPTS: 100
ADD_ACKNOWLEDGMENTS_IF_POSSIBLE: 0
PRIORITIZE_SCRIPTED_SKILLS: 0
CONFIDENCE_STRENGTH: 0.8
CONV_EVAL_STRENGTH: 0.4
PRIORITIZE_HUMAN_INITIATIVE: 1
QUESTION_TO_QUESTION_DOWNSCORE_COEF: 0.8
SERVICE_PORT: 8002
SERVICE_NAME: response_selector
LANGUAGE: EN
SENTENCE_RANKER_ANNOTATION_NAME: sentence_ranker
SENTENCE_RANKER_SERVICE_URL: http://sentence-ranker:8128/respond
SENTENCE_RANKER_TIMEOUT: 3
N_UTTERANCES_CONTEXT: 5
FILTER_TOXIC_OR_BADLISTED: 1
context: .
dockerfile: ./response_selectors/convers_evaluation_based_selector/Dockerfile
command: flask run -h 0.0.0.0 -p 8009
dockerfile: ./response_selectors/ranking_based_response_selector/Dockerfile
command: flask run -h 0.0.0.0 -p 8002
environment:
- FLASK_APP=server
deploy:
Expand Down
8 changes: 4 additions & 4 deletions assistant_dists/deeppavlov_assistant/pipeline_conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,18 @@
"connector": {
"protocol": "http",
"timeout": 1.0,
"url": "http://no-restrictions-selector:8009/respond"
"url": "http://ranking-based-response-selector:8002/respond"
},
"dialog_formatter": "state_formatters.dp_formatters:full_history_dialog",
"dialog_formatter": "state_formatters.dp_formatters:cropped_dialog",
"response_formatter": "state_formatters.dp_formatters:base_response_selector_formatter_service",
"previous_services": [
"candidate_annotators"
],
"state_manager_method": "add_bot_utterance",
"is_enabled": true,
"source": {
"directory": "response_selectors/convers_evaluation_based_selector",
"container": "no-restrictions-selector",
"directory": "response_selectors/ranking_based_response_selector",
"container": "ranking-based-response-selector",
"endpoint": "respond"
}
}
Expand Down
4 changes: 0 additions & 4 deletions assistant_dists/deepy_assistant/cpu.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
version: '3.7'
services:
combined-classification:
environment:
DEVICE: cpu
CUDA_VISIBLE_DEVICES: ""
sentence-ranker:
environment:
DEVICE: cpu
Expand Down
23 changes: 3 additions & 20 deletions assistant_dists/deepy_assistant/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,12 @@ services:
- ".:/dp-agent"
ports:
- 4242:4242
sentseg:
volumes:
- "./annotators/SentSeg:/src"
ports:
- 8011:8011
no-restrictions-selector:
volumes:
- "./response_selectors/convers_evaluation_based_selector:/src"
- "./common:/src/common"
ports:
- 8009:8009
badlisted-words:
volumes:
- "./annotators/BadlistedWordsDetector:/src"
- "./common:/src/common"
ports:
- 8018:8018
combined-classification:
ranking-based-response-selector:
volumes:
- "./response_selectors/ranking_based_response_selector:/src"
- "./common:/src/common"
- "./annotators/combined_classification:/src"
ports:
- 8087:8087
- 8002:8002
sentence-ranker:
volumes:
- "./services/sentence_ranker:/src"
Expand Down
88 changes: 16 additions & 72 deletions assistant_dists/deepy_assistant/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,68 +2,29 @@ services:
agent:
command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.pipeline_config=assistant_dists/deepy_assistant/pipeline_conf.json'
environment:
WAIT_HOSTS: "sentseg:8011, no-restrictions-selector:8009, badlisted-words:8018, combined-classification:8087,
sentence-ranker:8128, prompt-selector:8135, openai-api-davinci3:8131,
dff-deepy-prompted-skill:8148"
WAIT_HOSTS: "ranking-based-response-selector:8002, sentence-ranker:8128, prompt-selector:8135, openai-api-davinci3:8131,
dff-deepy-prompted-skill:8148"
WAIT_HOSTS_TIMEOUT: ${WAIT_TIMEOUT:-1000}
HIGH_PRIORITY_INTENTS: 1
RESTRICTION_FOR_SENSITIVE_CASE: 1
ALWAYS_TURN_ON_ALL_SKILLS: 0
LANGUAGE: EN

sentseg:
env_file: [ .env ]
build:
context: ./annotators/SentSeg/
command: flask run -h 0.0.0.0 -p 8011
environment:
- FLASK_APP=server
deploy:
resources:
limits:
memory: 1.5G
reservations:
memory: 1.5G

combined-classification:
env_file: [ .env ]
build:
args:
CONFIG: combined_classifier.json
SERVICE_PORT: 8087
context: .
dockerfile: ./annotators/combined_classification/Dockerfile
environment:
- CUDA_VISIBLE_DEVICES=0
deploy:
resources:
limits:
memory: 2G
reservations:
memory: 2G

no-restrictions-selector:
ranking-based-response-selector:
env_file: [ .env ]
build:
args:
TAG_BASED_SELECTION: 1
CALL_BY_NAME_PROBABILITY: 0.5
PROMPT_PROBA: 0
ACKNOWLEDGEMENT_PROBA: 0.3
PRIORITIZE_WITH_REQUIRED_ACT: 0
PRIORITIZE_NO_DIALOG_BREAKDOWN: 0
PRIORITIZE_WITH_SAME_TOPIC_ENTITY: 0
IGNORE_DISLIKED_SKILLS: 0
GREETING_FIRST: 0
RESTRICTION_FOR_SENSITIVE_CASE: 0
PRIORITIZE_PROMTS_WHEN_NO_SCRIPTS: 0
MAX_TURNS_WITHOUT_SCRIPTS: 100
ADD_ACKNOWLEDGMENTS_IF_POSSIBLE: 0
PRIORITIZE_SCRIPTED_SKILLS: 0
CONFIDENCE_STRENGTH: 0.8
CONV_EVAL_STRENGTH: 0.4
PRIORITIZE_HUMAN_INITIATIVE: 1
QUESTION_TO_QUESTION_DOWNSCORE_COEF: 0.8
SERVICE_PORT: 8002
SERVICE_NAME: response_selector
LANGUAGE: EN
SENTENCE_RANKER_ANNOTATION_NAME: sentence_ranker
SENTENCE_RANKER_SERVICE_URL: http://sentence-ranker:8128/respond
SENTENCE_RANKER_TIMEOUT: 3
N_UTTERANCES_CONTEXT: 5
FILTER_TOXIC_OR_BADLISTED: 1
context: .
dockerfile: ./response_selectors/convers_evaluation_based_selector/Dockerfile
command: flask run -h 0.0.0.0 -p 8009
dockerfile: ./response_selectors/ranking_based_response_selector/Dockerfile
command: flask run -h 0.0.0.0 -p 8002
environment:
- FLASK_APP=server
deploy:
Expand All @@ -73,23 +34,6 @@ services:
reservations:
memory: 100M

badlisted-words:
env_file: [ .env ]
build:
args:
SERVICE_PORT: 8018
SERVICE_NAME: badlisted_words
context: annotators/BadlistedWordsDetector/
command: flask run -h 0.0.0.0 -p 8018
environment:
- FLASK_APP=server
deploy:
resources:
limits:
memory: 256M
reservations:
memory: 256M

prompt-selector:
env_file: [ .env ]
build:
Expand Down
Loading

0 comments on commit e2dfd33

Please sign in to comment.