diff --git a/.gitignore b/.gitignore index 6f3691ab75..9c70b2b1f4 100644 --- a/.gitignore +++ b/.gitignore @@ -142,3 +142,6 @@ kubernetes/models docker-compose-one-replica.yml *.pem + +# personal env keys and tokens +.env_secret diff --git a/README.md b/README.md index 7c901c02b1..2caa9160c3 100644 --- a/README.md +++ b/README.md @@ -199,7 +199,7 @@ convers-evaluator-annotator: dockerfile: Dockerfile environment: - PROXY_PASS=dream.deeppavlov.ai:8004 - - PORT=8004 + - SERVICE_PORT=8004 ``` and include this config in your deployment command: @@ -260,70 +260,86 @@ Dream Architecture is presented in the following image: | Wiki Facts | 1.7 GB RAM | model that extracts related facts from Wikipedia and WikiHow pages | ## Services -| Name | Requirements | Description | -|------------------------|-------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| DialoGPT | 1.2 GB RAM, 2.1 GB GPU | generative service based on Transformers generative model, the model is set in docker compose argument `PRETRAINED_MODEL_NAME_OR_PATH` (for example, `microsoft/DialoGPT-small` with 0.2-0.5 sec on GPU) | -| DialoGPT Persona-based | 1.2 GB RAM, 2.1 GB GPU | generative service based on Transformers generative model, the model was pre-trained on the PersonaChat dataset to generate a response conditioned on a several sentences of the socialbot's persona | -| Transformers LM GPT-J | 1.5 GB RAM, 24.2 GB GPU | generative service based on Transformers generative model, the model is set in docker compose argument `PRETRAINED_MODEL_NAME_OR_PATH` (in particular, in this service, [GPT-J model](https://huggingface.co/EleutherAI/gpt-j-6B) is used. | -| Image Captioning | 4 GB RAM, 5.4 GB GPU | creates text representation of a received image | -| Infilling | 1 GB RAM, 1.2 GB GPU | (turned off but the code is available) generative service based on Infilling model, for the given utterance returns utterance where `_` from original text is replaced with generated tokens | -| Knowledge Grounding | 2 GB RAM, 2.1 GB GPU | generative service based on BlenderBot architecture providing a response to the context taking into account an additional text paragraph | -| Masked LM | 1.1 GB RAM, 1 GB GPU | (turned off but the code is available) | -| Seq2seq Persona-based | 1.5 GB RAM, 1.5 GB GPU | generative service based on Transformers seq2seq model, the model was pre-trained on the PersonaChat dataset to generate a response conditioned on a several sentences of the socialbot's persona | -| Sentence Ranker | 1.2 GB RAM, 2.1 GB GPU | ranking model given as `PRETRAINED_MODEL_NAME_OR_PATH` which for a pair os sentences returns a float score of correspondence | -| StoryGPT | 2.6 GB RAM, 2.15 GB GPU | generative service based on fine-tuned GPT-2, for the given set of keywords returns a short story using the keywords | -| Prompt StoryGPT | 3 GB RAM, 4 GB GPU | generative service based on fine-tuned GPT-2, for the given topic represented by one noun returns short story on a given topic | +| Name | Requirements | Description | +|------------------------|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| DialoGPT | 1.2 GB RAM, 2.1 GB GPU | generative service based on Transformers generative model, the model is set in docker compose argument `PRETRAINED_MODEL_NAME_OR_PATH` (for example, `microsoft/DialoGPT-small` with 0.2-0.5 sec on GPU) | +| DialoGPT Persona-based | 1.2 GB RAM, 2.1 GB GPU | generative service based on Transformers generative model, the model was pre-trained on the PersonaChat dataset to generate a response conditioned on a several sentences of the socialbot's persona | +| Image Captioning | 4 GB RAM, 5.4 GB GPU | creates text representation of a received image | +| Infilling | 1 GB RAM, 1.2 GB GPU | (turned off but the code is available) generative service based on Infilling model, for the given utterance returns utterance where `_` from original text is replaced with generated tokens | +| Knowledge Grounding | 2 GB RAM, 2.1 GB GPU | generative service based on BlenderBot architecture providing a response to the context taking into account an additional text paragraph | +| Masked LM | 1.1 GB RAM, 1 GB GPU | (turned off but the code is available) | +| Seq2seq Persona-based | 1.5 GB RAM, 1.5 GB GPU | generative service based on Transformers seq2seq model, the model was pre-trained on the PersonaChat dataset to generate a response conditioned on a several sentences of the socialbot's persona | +| Sentence Ranker | 1.2 GB RAM, 2.1 GB GPU | ranking model given as `PRETRAINED_MODEL_NAME_OR_PATH` which for a pair os sentences returns a float score of correspondence | +| StoryGPT | 2.6 GB RAM, 2.15 GB GPU | generative service based on fine-tuned GPT-2, for the given set of keywords returns a short story using the keywords | +| GPT-3.5 | 100 MB RAM | generative service based on OpenAI API service, the model is set in docker compose argument `PRETRAINED_MODEL_NAME_OR_PATH` (in particular, in this service, `text-davinci-003` is used. | +| ChatGPT | 100 MB RAM | generative service based on OpenAI API service, the model is set in docker compose argument `PRETRAINED_MODEL_NAME_OR_PATH` (in particular, in this service, `gpt-3.5-turbo` is used. | +| Prompt StoryGPT | 3 GB RAM, 4 GB GPU | generative service based on fine-tuned GPT-2, for the given topic represented by one noun returns short story on a given topic | +| GPT-J 6B | 1.5 GB RAM, 24.2 GB GPU | generative service based on Transformers generative model, the model is set in docker compose argument `PRETRAINED_MODEL_NAME_OR_PATH` (in particular, in this service, [GPT-J model](https://huggingface.co/EleutherAI/gpt-j-6B) is used. | ## Skills -| Name | Requirements | Description | -|----------------------------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Christmas Skill | | supports FAQ, facts, and scripts for Christmas | -| Comet Dialog skill | | uses COMeT ConceptNet model to express an opinion, to ask a question or give a comment about user's actions mentioned in the dialogue | -| Convert Reddit | 1.2 GB RAM | uses a ConveRT encoder to build efficient representations for sentences | -| Dummy Skill | a part of agent container | a fallback skill with multiple non-toxic candidate responses | -| Dummy Skill Dialog | 600 MB RAM | returns the next turn from the Topical Chat dataset if the response of the user to the Dummy Skill is similar to the corresponding response in the source data | -| Eliza | 30 MB RAM | Chatbot (https://github.com/wadetb/eliza) | -| Emotion Skill | 40 MB RAM | returns template responses to emotions detected by Emotion Classification from Combined Classification annotator | -| Factoid QA | 170 MB RAM | answers factoid questions | -| Game Cooperative Skill | 100 MB RAM | provides user with a conversation about computer games: the charts of the best games for the past year, past month, and last week | -| Knowledge Grounding Skill | 100 MB RAM | generates a response based on the dialogue history and provided knowledge related to the current conversation topic | -| Meta Script Skill | 150 MB RAM | provides a multi-turn dialogue around human activities. The skill uses COMeT Atomic model to generate commonsensical descriptions and questions on several aspects | -| Misheard ASR | 40 MB RAM | uses the ASR Processor annotations to give feedback to the user when ASR confidence is too low | -| News API Skill | 60 MB RAM | presents the top-rated latest news about entities or topics using the GNews API | -| Oscar Skill | | supports FAQ, facts, and scripts for Oscar | -| Personal Info Skill | 40 MB RAM | queries and stores user's name, birthplace, and location | -| DFF Program Y Skill | 800 MB RAM | **[New DFF version]** Chatbot Program Y (https://github.com/keiffster/program-y) adapted for Dream socialbot | -| DFF Program Y Dangerous Skill | 100 MB RAM | **[New DFF version]** Chatbot Program Y (https://github.com/keiffster/program-y) adapted for Dream socialbot, containing responses to dangerous situations in a dialog | -| DFF Program Y Wide Skill | 110 MB RAM | **[New DFF version]** Chatbot Program Y (https://github.com/keiffster/program-y) adapted for Dream socialbot, which includes only very general templates (with lower confidence) | -| Small Talk Skill | 35 MB RAM | asks questions using the hand-written scripts for 25 topics, including but not limited to love, sports, work, pets, etc. | -| SuperBowl Skill | | supports FAQ, facts, and scripts for SuperBowl | -| Text QA | 1.8 GB RAM, 2.8 GB GPU | | -| Valentine's Day Skill | | supports FAQ, facts, and scripts for Valentine's Day | -| Wikidata Dial Skill | | generates an utterance using Wikidata triplets. Not turned on, needs improvement | -| DFF Animals Skill | 200 MB RAM | is created using DFF and has three branches of conversation about animals: user's pets, pets of the socialbot, and wild animals | -| DFF Art Skill | 100 MB RAM | DFF-based skill to discuss art | -| DFF Book Skill | 400 MB RAM | **[New DFF version]** detects book titles and authors mentioned in the user's utterance with the help of Wiki parser and Entity linking and recommends books by leveraging information from the GoodReads database | -| DFF Bot Persona Skill | 150 MB RAM | aims to discuss user favorites and 20 most popular things with short stories expressing the socialbot's opinion towards them | -| DFF Coronavirus Skill | 110 MB RAM | **[New DFF version]** retrieves data about the number of coronavirus cases and deaths in different locations sourced from the John Hopkins University Center for System Science and Engineering | -| DFF Dream Persona Prompted Skill | 150 MB RAM | **[New DFF version]** Prompt-based skill that utilizes given generative service to generate responses based on the given prompt | -| DFF Food Skill | 150 MB RAM | constructed with DFF to encourage food-related conversation | -| DFF Friendship Skill | 100 MB RAM | **[New DFF version]** DFF-based skill to greet the user in the beginning of the dialog, and forward the user to some scripted skill | -| DFF Funfact Skill | 100 MB RAM | **[New DFF version]** Tells user fun facts | -| DFF Gaming Skill | 80 MB RAM | provides a video games discussion. Gaming Skill is for more general talk about video games | -| DFF Gossip Skill | 95 MB RAM | DFF-based skill to discuss other people with news about them | -| DFF Image Skill | 100 MB RAM | **[New DFF version]** Scripted skill that based on the sent image captioning (from annotations) responses with specified responses in case of food, animals or people detected, and default responses otherwise | -| DFF Template Skill | 50 MB RAM | **[New DFF version]** DFF-based skill that provides an example of DFF usage | -| DFF Template Prompted Skill | 50 MB RAM | **[New DFF version]** DFF-based skill that provides answers generated by language model based on specified prompts and the dialog context. The model to be used is specified in GENERATIVE_SERVICE_URL. For example, you may use Transformer LM GPTJ service. | -| DFF Grounding Skill | 90 MB RAM | **[New DFF version]** DFF-based skill to answer what is the topic of the conversation, to generate acknowledgement, to generate universal responses on some dialog acts by MIDAS | -| DFF Intent Responder | 100 MB RAM | **[New DFF version]** provides template-based replies for some of the intents detected by Intent Catcher annotator | -| DFF Movie Skill | 1.1 GB RAM | is implemented using DFF and takes care of the conversations related to movies | -| DFF Music Skill | 70 MB RAM | DFF-based skill to discuss music | -| DFF Science Skill | 90 MB RAM | DFF-based skill to discuss science | -| DFF Short Story Skill | 90 MB RAM | **[New DFF version]** tells user short stories from 3 categories: (1) bedtime stories, such as fables and moral stories, (2) horror stories, and (3) funny ones | -| DFF Sport Skill | 70 MB RAM | DFF-based skill to discuss sports | -| DFF Travel Skill | 70 MB RAM | DFF-based skill to discuss travel | -| DFF Weather Skill | 1.4 GB RAM | **[New DFF version]** uses the OpenWeatherMap service to get the forecast for the user's location | -| DFF Wiki Skill | 150 MB RAM | used for making scenarios with the extraction of entities, slot filling, facts insertion, and acknowledgements | +| Name | Requirements | Description | +|------------------------------------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| Alexa Handler | 30 MB RAM | handler for several specific Alexa commands | +| Christmas Skill | 30 MB RAM | supports FAQ, facts, and scripts for Christmas | +| Comet Dialog skill | 300 MB RAM | uses COMeT ConceptNet model to express an opinion, to ask a question or give a comment about user's actions mentioned in the dialogue | +| Convert Reddit | 1.2 GB RAM | uses a ConveRT encoder to build efficient representations for sentences | +| Dummy Skill | a part of agent container | a fallback skill with multiple non-toxic candidate responses | +| Dummy Skill Dialog | 600 MB RAM | returns the next turn from the Topical Chat dataset if the response of the user to the Dummy Skill is similar to the corresponding response in the source data | +| Eliza | 30 MB RAM | Chatbot (https://github.com/wadetb/eliza) | +| Emotion Skill | 40 MB RAM | returns template responses to emotions detected by Emotion Classification from Combined Classification annotator | +| Factoid QA | 170 MB RAM | answers factoid questions | +| Game Cooperative Skill | 100 MB RAM | provides user with a conversation about computer games: the charts of the best games for the past year, past month, and last week | +| Harvesters Maintenance Skill | 30 MB RAM | Harvesters maintenance skill | +| Harvesters Maintenance Gobot Skill | 30 MB RAM | Harvesters maintenance Goal-oriented skill | +| Knowledge Grounding Skill | 100 MB RAM | generates a response based on the dialogue history and provided knowledge related to the current conversation topic | +| Meta Script Skill | 150 MB RAM | provides a multi-turn dialogue around human activities. The skill uses COMeT Atomic model to generate commonsensical descriptions and questions on several aspects | +| Misheard ASR | 40 MB RAM | uses the ASR Processor annotations to give feedback to the user when ASR confidence is too low | +| News API Skill | 60 MB RAM | presents the top-rated latest news about entities or topics using the GNews API | +| Oscar Skill | 30 MB RAM | supports FAQ, facts, and scripts for Oscar | +| Personal Info Skill | 40 MB RAM | queries and stores user's name, birthplace, and location | +| DFF Program Y Skill | 800 MB RAM | **[New DFF version]** Chatbot Program Y (https://github.com/keiffster/program-y) adapted for Dream socialbot | +| DFF Program Y Dangerous Skill | 100 MB RAM | **[New DFF version]** Chatbot Program Y (https://github.com/keiffster/program-y) adapted for Dream socialbot, containing responses to dangerous situations in a dialog | +| DFF Program Y Wide Skill | 110 MB RAM | **[New DFF version]** Chatbot Program Y (https://github.com/keiffster/program-y) adapted for Dream socialbot, which includes only very general templates (with lower confidence) | +| Small Talk Skill | 35 MB RAM | asks questions using the hand-written scripts for 25 topics, including but not limited to love, sports, work, pets, etc. | +| SuperBowl Skill | 30 MB RAM | supports FAQ, facts, and scripts for SuperBowl | +| Text QA | 1.8 GB RAM, 2.8 GB GPU | | +| Valentine's Day Skill | 30 MB RAM | supports FAQ, facts, and scripts for Valentine's Day | +| Wikidata Dial Skill | 100 MB RAM | generates an utterance using Wikidata triplets. Not turned on, needs improvement | +| DFF Animals Skill | 200 MB RAM | is created using DFF and has three branches of conversation about animals: user's pets, pets of the socialbot, and wild animals | +| DFF Art Skill | 100 MB RAM | DFF-based skill to discuss art | +| DFF Book Skill | 400 MB RAM | **[New DFF version]** detects book titles and authors mentioned in the user's utterance with the help of Wiki parser and Entity linking and recommends books by leveraging information from the GoodReads database | +| DFF Bot Persona Skill | 150 MB RAM | aims to discuss user favorites and 20 most popular things with short stories expressing the socialbot's opinion towards them | +| DFF Coronavirus Skill | 110 MB RAM | **[New DFF version]** retrieves data about the number of coronavirus cases and deaths in different locations sourced from the John Hopkins University Center for System Science and Engineering | +| DFF Food Skill | 150 MB RAM | constructed with DFF to encourage food-related conversation | +| DFF Friendship Skill | 100 MB RAM | **[New DFF version]** DFF-based skill to greet the user in the beginning of the dialog, and forward the user to some scripted skill | +| DFF Funfact Skill | 100 MB RAM | **[New DFF version]** Tells user fun facts | +| DFF Gaming Skill | 80 MB RAM | provides a video games discussion. Gaming Skill is for more general talk about video games | +| DFF Gossip Skill | 95 MB RAM | DFF-based skill to discuss other people with news about them | +| DFF Image Skill | 100 MB RAM | **[New DFF version]** Scripted skill that based on the sent image captioning (from annotations) responses with specified responses in case of food, animals or people detected, and default responses otherwise | +| DFF Template Skill | 50 MB RAM | **[New DFF version]** DFF-based skill that provides an example of DFF usage | +| DFF Template Prompted Skill | 50 MB RAM | **[New DFF version]** DFF-based skill that provides answers generated by language model based on specified prompts and the dialog context. The model to be used is specified in GENERATIVE_SERVICE_URL. For example, you may use Transformer LM GPTJ service. | +| DFF Grounding Skill | 90 MB RAM | **[New DFF version]** DFF-based skill to answer what is the topic of the conversation, to generate acknowledgement, to generate universal responses on some dialog acts by MIDAS | +| DFF Intent Responder | 100 MB RAM | **[New DFF version]** provides template-based replies for some of the intents detected by Intent Catcher annotator | +| DFF Movie Skill | 1.1 GB RAM | is implemented using DFF and takes care of the conversations related to movies | +| DFF Music Skill | 70 MB RAM | DFF-based skill to discuss music | +| DFF Science Skill | 90 MB RAM | DFF-based skill to discuss science | +| DFF Short Story Skill | 90 MB RAM | **[New DFF version]** tells user short stories from 3 categories: (1) bedtime stories, such as fables and moral stories, (2) horror stories, and (3) funny ones | +| DFF Sport Skill | 70 MB RAM | DFF-based skill to discuss sports | +| DFF Travel Skill | 70 MB RAM | DFF-based skill to discuss travel | +| DFF Weather Skill | 1.4 GB RAM | **[New DFF version]** uses the OpenWeatherMap service to get the forecast for the user's location | +| DFF Wiki Skill | 150 MB RAM | used for making scenarios with the extraction of entities, slot filling, facts insertion, and acknowledgements | + +## Prompted Skills +| Name | Requirements | Description | +|----------------------------|---------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| AI FAQ Skill | 150 MB RAM | **[New DFF version]** Everything you wanted to know about modern AI but was afraid to ask! This FAQ Assistant chats with you while explaining the simplest topics from today's technology world. | +| da Costa Clothes Skill | 150 MB RAM | **[New DFF version]** Stay protected in every season with da Costa Industries Clothes Assistant! Experience the ultimate comfort and protection, no matter the weather. Stay warm in winter a... | +| Dream Persona Skill | 150 MB RAM | **[New DFF version]** Prompt-based skill that utilizes given generative service to generate responses based on the given prompt | +| Empathetic Marketing Skill | 150 MB RAM | **[New DFF version]** Connect with your audience like never before with Empathetic Marketing AI Assistant! Reach new heights of success by tapping into the power of empathy. Say goodbye.. | +| Fairytale Skill | 150 MB RAM | **[New DFF version]** This assistant will tell you or your children a short but engaging fairytale. Choose the characters and the topic and leave the rest to AI imagination. | +| Nutrition Skill | 150 MB RAM | **[New DFF version]** Discover the secret to healthy eating with our AI assistant! Find nutritious food options for you and your loved ones with ease. Say goodbye to mealtime stress and hello to delici... | +| Rhodes Coaching Skill | 150 MB RAM | **[New DFF version]** Unlock your full potential with Rhodes & Co's patented AI assistant! Reach peak performance at work and at home. Get into top form effortlessly and inspire others with. | + # Papers diff --git a/README_multilingual.md b/README_multilingual.md index 67a0021686..088054a9fc 100644 --- a/README_multilingual.md +++ b/README_multilingual.md @@ -17,9 +17,9 @@ Dream Architecture is presented in the following image: | Sentence Ranker | 2.5 GB RAM, 1.8 GB GPU | for a pair of sentences predicts a floating point value. For multilingual version, return cosine similarity between embeddings from multilingual sentence BERT | ## Skills & Services -| Name | Requirements | Description | -|---------------------|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------| -| GPT-2 Multilingual | 5 GB RAM, 6.5 GB GPU | GPT2-based generative model. For Multilingual distribution we propose mgpt by Sberbank [from HugginFace](https://huggingface.co/sberbank-ai/mGPT) | +| Name | Requirements | Description | +|--------------------|-----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------| +| GPT-2 Multilingual | 5 GB RAM, 6.5 GB GPU | GPT2-based generative model. For Multilingual distribution we propose mgpt by Sberbank [from HugginFace](https://huggingface.co/sberbank-ai/mGPT) | # Papers diff --git a/README_ru.md b/README_ru.md index 6753371ec0..c1087d4dce 100644 --- a/README_ru.md +++ b/README_ru.md @@ -214,6 +214,7 @@ docker-compose -f docker-compose.yml -f assistant_dists/dream/docker-compose.ove | DFF Intent Responder | 50 MB RAM | provides template-based replies for some of the intents detected by Intent Catcher annotator | | DFF Program Y Skill | 80 MB RAM | **[New DFF version]** Chatbot Program Y (https://github.com/keiffster/program-y) adapted for Dream socialbot | | DFF Friendship Skill | 70 MB RAM | **[New DFF version]** DFF-based skill to greet the user in the beginning of the dialog, and forward the user to some scripted skill | +| DFF Template Skill | 50 MB RAM | **[New DFF version]** DFF-based skill that provides an example of DFF usage | | Text QA | 3.8 GiB RAM, 5.2 GiB GPU | Навык для ответа на вопросы по тексту. | diff --git a/annotators/ConversationEvaluator/Dockerfile b/annotators/ConversationEvaluator/Dockerfile index e33d513b54..c50fc338f3 100644 --- a/annotators/ConversationEvaluator/Dockerfile +++ b/annotators/ConversationEvaluator/Dockerfile @@ -2,9 +2,9 @@ FROM deeppavlov/base-gpu:0.12.0 RUN pip install --upgrade pip && pip install git+https://github.com/deeppavlov/DeepPavlov.git@0.12.0 ARG CONFIG -ARG PORT +ARG SERVICE_PORT ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT WORKDIR /src RUN mkdir common diff --git a/annotators/NER_deeppavlov/Dockerfile b/annotators/NER_deeppavlov/Dockerfile index ed1f25298a..d4ee00e894 100644 --- a/annotators/NER_deeppavlov/Dockerfile +++ b/annotators/NER_deeppavlov/Dockerfile @@ -2,12 +2,12 @@ FROM deeppavlov/base-gpu:1.0.0rc1 RUN pip install --upgrade pip && pip install git+https://github.com/deeppavlov/DeepPavlov.git@1.0.0rc1 ARG CONFIG -ARG PORT +ARG SERVICE_PORT ARG SRC_DIR ARG SED_ARG=" | " ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT COPY ./annotators/NER_deeppavlov/requirements.txt /src/requirements.txt RUN pip install --upgrade pip && pip install -r /src/requirements.txt diff --git a/annotators/combined_classification/Dockerfile b/annotators/combined_classification/Dockerfile index 058ef93e80..9cfe64e332 100644 --- a/annotators/combined_classification/Dockerfile +++ b/annotators/combined_classification/Dockerfile @@ -6,9 +6,9 @@ WORKDIR /base/DeepPavlov ARG CONFIG -ARG PORT +ARG SERVICE_PORT ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT WORKDIR /src RUN mkdir common diff --git a/annotators/combined_classification/load_test.sh b/annotators/combined_classification/load_test.sh index c5ea555501..5d2f79acdc 100755 --- a/annotators/combined_classification/load_test.sh +++ b/annotators/combined_classification/load_test.sh @@ -1,2 +1,2 @@ pip install -r requirements_load_test.txt -locust -f load_test.py --headless -u 10 -r 2 --host http://0.0.0.0:$PORT/model \ No newline at end of file +locust -f load_test.py --headless -u 10 -r 2 --host http://0.0.0.0:$SERVICE_PORT/model \ No newline at end of file diff --git a/annotators/dialog_breakdown/Dockerfile b/annotators/dialog_breakdown/Dockerfile index 3892610429..31044cdd7e 100644 --- a/annotators/dialog_breakdown/Dockerfile +++ b/annotators/dialog_breakdown/Dockerfile @@ -2,11 +2,11 @@ FROM deeppavlov/base-gpu:0.12.0 RUN pip install --upgrade pip && pip install git+https://github.com/deeppavlov/DeepPavlov.git@0.12.0 ARG CONFIG -ARG PORT +ARG SERVICE_PORT ARG SED_ARG=" | " ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT WORKDIR /src RUN mkdir common diff --git a/annotators/entity_detection/Dockerfile b/annotators/entity_detection/Dockerfile index 05cd2257ef..19d81ab6b0 100644 --- a/annotators/entity_detection/Dockerfile +++ b/annotators/entity_detection/Dockerfile @@ -5,13 +5,13 @@ RUN apt-get update && apt-get install git -y ARG SEQ_TAG_CONFIG ARG CONFIG ARG FINEGRAINED -ARG PORT +ARG SERVICE_PORT ARG SRC_DIR ENV SEQ_TAG_CONFIG=$SEQ_TAG_CONFIG ENV CONFIG=$CONFIG ENV FINEGRAINED=$FINEGRAINED -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT COPY ./annotators/entity_detection/requirements.txt /src/requirements.txt RUN pip install -r /src/requirements.txt @@ -23,4 +23,4 @@ COPY $SRC_DIR /src WORKDIR /src RUN python -m deeppavlov install $SEQ_TAG_CONFIG -CMD gunicorn --workers=1 --timeout 500 server:app -b 0.0.0.0:$PORT +CMD gunicorn --workers=1 --timeout 500 server:app -b 0.0.0.0:$SERVICE_PORT diff --git a/annotators/entity_detection_rus/Dockerfile b/annotators/entity_detection_rus/Dockerfile index 396db172e2..ea2cc8b41a 100644 --- a/annotators/entity_detection_rus/Dockerfile +++ b/annotators/entity_detection_rus/Dockerfile @@ -2,7 +2,7 @@ FROM deeppavlov/base-gpu:0.12.1 RUN pip install --upgrade pip && pip install git+https://github.com/deeppavlov/DeepPavlov.git@0.12.1 ARG CONFIG -ARG PORT +ARG SERVICE_PORT ARG SRC_DIR ARG SED_ARG=" | " @@ -10,7 +10,7 @@ ARG LANGUAGE=EN ENV LANGUAGE ${LANGUAGE} ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT COPY ./annotators/entity_detection_rus/requirements.txt /src/requirements.txt RUN pip install -r /src/requirements.txt diff --git a/annotators/entity_linking/Dockerfile b/annotators/entity_linking/Dockerfile index 27ae58a462..7bcb2dfaa2 100644 --- a/annotators/entity_linking/Dockerfile +++ b/annotators/entity_linking/Dockerfile @@ -19,12 +19,12 @@ ARG LANGUAGE=EN ENV LANGUAGE ${LANGUAGE} ARG CONFIG -ARG PORT +ARG SERVICE_PORT ARG SRC_DIR ARG SED_ARG=" | " ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT COPY ./annotators/entity_linking/requirements.txt /src/requirements.txt RUN pip install -r /src/requirements.txt diff --git a/annotators/entity_linking_deepy/Dockerfile b/annotators/entity_linking_deepy/Dockerfile index 46bd4768d2..868ba18135 100644 --- a/annotators/entity_linking_deepy/Dockerfile +++ b/annotators/entity_linking_deepy/Dockerfile @@ -2,11 +2,11 @@ FROM deeppavlov/base-gpu:0.12.1 ARG CONFIG ARG COMMIT -ARG PORT +ARG SERVICE_PORT ARG SRC_DIR ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT RUN pip install pybind11==2.2.4 RUN pip install hdt==2.3 @@ -25,4 +25,4 @@ COPY $SRC_DIR /src WORKDIR /src -CMD python -m deeppavlov riseapi $CONFIG -p $PORT -d +CMD python -m deeppavlov riseapi $CONFIG -p $SERVICE_PORT -d diff --git a/annotators/entity_linking_rus/Dockerfile b/annotators/entity_linking_rus/Dockerfile index 6475b9913d..7678923ab2 100644 --- a/annotators/entity_linking_rus/Dockerfile +++ b/annotators/entity_linking_rus/Dockerfile @@ -17,12 +17,12 @@ ARG LANGUAGE=EN ENV LANGUAGE ${LANGUAGE} ARG CONFIG -ARG PORT +ARG SERVICE_PORT ARG SRC_DIR ARG SED_ARG=" | " ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT RUN pip install pybind11==2.2.4 RUN pip install hdt==2.3 diff --git a/annotators/fact_retrieval/Dockerfile b/annotators/fact_retrieval/Dockerfile index 96bb274a45..038a94b26e 100644 --- a/annotators/fact_retrieval/Dockerfile +++ b/annotators/fact_retrieval/Dockerfile @@ -6,7 +6,7 @@ ARG CONFIG ARG CONFIG_WIKI ARG CONFIG_WHOW ARG COMMIT=0.13.0 -ARG PORT +ARG SERVICE_PORT ARG SRC_DIR ARG SED_ARG=" | " ARG N_FACTS @@ -14,7 +14,7 @@ ARG N_FACTS ENV CONFIG=$CONFIG ENV CONFIG_WIKI=$CONFIG_WIKI ENV CONFIG_WHOW=$CONFIG_WHOW -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT ENV N_FACTS=$N_FACTS COPY ./annotators/fact_retrieval/requirements.txt /src/requirements.txt diff --git a/annotators/fact_retrieval/test_server.py b/annotators/fact_retrieval/test_server.py index f3a195527e..3e664dff7c 100644 --- a/annotators/fact_retrieval/test_server.py +++ b/annotators/fact_retrieval/test_server.py @@ -5,9 +5,9 @@ import common.test_utils as test_utils -PORT = int(os.getenv("PORT")) +SERVICE_PORT = int(os.getenv("SERVICE_PORT")) RANDOM_SEED = int(os.getenv("RANDOM_SEED", 2718)) -URL = f"http://0.0.0.0:{PORT}/model" +URL = f"http://0.0.0.0:{SERVICE_PORT}/model" def handler(requested_data, random_seed): diff --git a/annotators/fact_retrieval_rus/Dockerfile b/annotators/fact_retrieval_rus/Dockerfile index c732a20baa..8053dd1e4a 100644 --- a/annotators/fact_retrieval_rus/Dockerfile +++ b/annotators/fact_retrieval_rus/Dockerfile @@ -4,13 +4,13 @@ RUN apt-get update && apt-get install git -y ARG COMMIT=0.13.0 ARG CONFIG -ARG PORT +ARG SERVICE_PORT ARG SRC_DIR ARG TOP_N ENV COMMIT=$COMMIT ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT ENV TOP_N=$TOP_N COPY ./annotators/fact_retrieval_rus/requirements.txt /src/requirements.txt diff --git a/annotators/kbqa/Dockerfile b/annotators/kbqa/Dockerfile index 7f148f2b69..bbf758d8ee 100644 --- a/annotators/kbqa/Dockerfile +++ b/annotators/kbqa/Dockerfile @@ -3,13 +3,13 @@ RUN pip install --upgrade pip && pip install git+https://github.com/deeppavlov/D ARG CONFIG ARG COMMIT -ARG PORT +ARG SERVICE_PORT ARG SRC_DIR ARG SED_ARG=" | " ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT ENV COMMIT=$COMMIT COPY ./annotators/kbqa/requirements.txt /src/requirements.txt diff --git a/annotators/spelling_preprocessing_dp/Dockerfile b/annotators/spelling_preprocessing_dp/Dockerfile index 87dbb2bb05..88ae53834e 100644 --- a/annotators/spelling_preprocessing_dp/Dockerfile +++ b/annotators/spelling_preprocessing_dp/Dockerfile @@ -15,12 +15,12 @@ ENV LANGUAGE ${LANGUAGE} ARG CONFIG ARG COMMIT=0.13.0 -ARG PORT +ARG SERVICE_PORT ARG SRC_DIR ARG SED_ARG=" | " ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT COPY ./annotators/spelling_preprocessing_dp/requirements.txt /src/requirements.txt RUN pip install --upgrade pip && pip install -r /src/requirements.txt diff --git a/annotators/spelling_preprocessing_ru/Dockerfile b/annotators/spelling_preprocessing_ru/Dockerfile index 87dbb2bb05..88ae53834e 100644 --- a/annotators/spelling_preprocessing_ru/Dockerfile +++ b/annotators/spelling_preprocessing_ru/Dockerfile @@ -15,12 +15,12 @@ ENV LANGUAGE ${LANGUAGE} ARG CONFIG ARG COMMIT=0.13.0 -ARG PORT +ARG SERVICE_PORT ARG SRC_DIR ARG SED_ARG=" | " ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT COPY ./annotators/spelling_preprocessing_dp/requirements.txt /src/requirements.txt RUN pip install --upgrade pip && pip install -r /src/requirements.txt diff --git a/annotators/wiki_parser/Dockerfile b/annotators/wiki_parser/Dockerfile index ee9a5dc129..1a71fa9cdd 100644 --- a/annotators/wiki_parser/Dockerfile +++ b/annotators/wiki_parser/Dockerfile @@ -3,14 +3,14 @@ FROM python:3.9.1 ARG CONFIG ARG COMMIT ARG FAST=1 -ARG PORT +ARG SERVICE_PORT ARG SRC_DIR ARG LANGUAGE=EN ENV LANGUAGE ${LANGUAGE} ENV CONFIG=$CONFIG ENV FAST=$FAST -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT ENV COMMIT=$COMMIT ENV LANGUAGE=$LANGUAGE diff --git a/assistant_dists/ai_faq_assistant/cpu.yml b/assistant_dists/ai_faq_assistant/cpu.yml new file mode 100644 index 0000000000..19faae6fdc --- /dev/null +++ b/assistant_dists/ai_faq_assistant/cpu.yml @@ -0,0 +1,14 @@ +version: '3.7' +services: + combined-classification: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" + sentence-ranker: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" + transformers-lm-gptj: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" diff --git a/assistant_dists/ai_faq_assistant/db_conf.json b/assistant_dists/ai_faq_assistant/db_conf.json new file mode 100644 index 0000000000..a9ba6813f5 --- /dev/null +++ b/assistant_dists/ai_faq_assistant/db_conf.json @@ -0,0 +1,6 @@ +{ + "host": "DB_HOST", + "port": "DB_PORT", + "name": "DB_NAME", + "env": true +} \ No newline at end of file diff --git a/assistant_dists/ai_faq_assistant/dev.yml b/assistant_dists/ai_faq_assistant/dev.yml new file mode 100644 index 0000000000..2be8e39415 --- /dev/null +++ b/assistant_dists/ai_faq_assistant/dev.yml @@ -0,0 +1,62 @@ +# С такими volumes удобно дебажить, не нужно пересобирать контейнер каждый раз при изменении кода +services: + agent: + volumes: + - ".:/dp-agent" + ports: + - 4242:4242 + sentseg: + volumes: + - "./annotators/SentSeg:/src" + ports: + - 8011:8011 + convers-evaluation-no-scripts-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 + spelling-preprocessing: + volumes: + - "./annotators/spelling_preprocessing:/src" + ports: + - 8074:8074 + combined-classification: + volumes: + - "./common:/src/common" + - "./annotators/combined_classification:/src" + ports: + - 8087:8087 + sentence-ranker: + volumes: + - "./services/sentence_ranker:/src" + - "~/.deeppavlov/cache:/root/.cache" + ports: + - 8128:8128 + prompt-selector: + volumes: + - "./annotators/prompt_selector:/src" + - "./common:/src/common" + ports: + - 8135:8135 + transformers-lm-gptj: + volumes: + - "./services/transformers_lm:/src" + - "./common:/src/common" + - "~/.deeppavlov/cache:/root/.cache" + ports: + - 8130:8130 + dff-ai-faq-prompted-skill: + volumes: + - "./skills/dff_template_prompted_skill:/src" + - "./common:/src/common" + ports: + - 8143:8143 + +version: "3.7" diff --git a/assistant_dists/ai_faq_assistant/docker-compose.override.yml b/assistant_dists/ai_faq_assistant/docker-compose.override.yml new file mode 100644 index 0000000000..4e2797fe04 --- /dev/null +++ b/assistant_dists/ai_faq_assistant/docker-compose.override.yml @@ -0,0 +1,190 @@ +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, convers-evaluation-no-scripts-selector:8009, badlisted-words:8018, combined-classification:8087, + spelling-preprocessing:8074, sentence-ranker:8128, prompt-selector:8135, transformers-lm-gptj:8130, + dff-ai-faq-prompted-skill:8143" + WAIT_HOSTS_TIMEOUT: ${WAIT_TIMEOUT:-1000} + + 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 + + convers-evaluation-no-scripts-selector: + env_file: [ .env ] + build: + args: + TAG_BASED_SELECTION: 1 + CALL_BY_NAME_PROBABILITY: 0.5 + PROMPT_PROBA: 0.1 + 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: 1 + RESTRICTION_FOR_SENSITIVE_CASE: 1 + PRIORITIZE_PROMTS_WHEN_NO_SCRIPTS: 0 + MAX_TURNS_WITHOUT_SCRIPTS: 7 + ADD_ACKNOWLEDGMENTS_IF_POSSIBLE: 1 + PRIORITIZE_SCRIPTED_SKILLS: 0 + CONFIDENCE_STRENGTH: 0.8 + CONV_EVAL_STRENGTH: 0.4 + PRIORITIZE_HUMAN_INITIATIVE: 1 + QUESTION_TO_QUESTION_DOWNSCORE_COEF: 0.8 + context: . + dockerfile: ./response_selectors/convers_evaluation_based_selector/Dockerfile + command: flask run -h 0.0.0.0 -p 8009 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + 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 + + spelling-preprocessing: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing + context: ./annotators/spelling_preprocessing/ + command: flask run -h 0.0.0.0 -p 8074 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + prompt-selector: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8135 + SERVICE_NAME: prompt_selector + N_SENTENCES_TO_RETURN: 3 + PROMPTS_TO_CONSIDER: ai_faq + context: . + dockerfile: ./annotators/prompt_selector/Dockerfile + command: flask run -h 0.0.0.0 -p 8135 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + sentence-ranker: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8128 + SERVICE_NAME: sentence_ranker + PRETRAINED_MODEL_NAME_OR_PATH: sentence-transformers/bert-base-nli-mean-tokens + context: ./services/sentence_ranker/ + command: flask run -h 0.0.0.0 -p 8128 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 3G + reservations: + memory: 3G + + transformers-lm-gptj: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8130 + SERVICE_NAME: transformers_lm_gptj + PRETRAINED_MODEL_NAME_OR_PATH: EleutherAI/gpt-j-6B + HALF_PRECISION: 0 + context: . + dockerfile: ./services/transformers_lm/Dockerfile + command: flask run -h 0.0.0.0 -p 8130 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 50G + reservations: + memory: 50G + + dff-ai-faq-prompted-skill: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8143 + SERVICE_NAME: dff_ai_faq_prompted_skill + PROMPT_FILE: common/prompts/ai_faq.json + GENERATIVE_SERVICE_URL: http://transformers-lm-gptj:8130/respond + GENERATIVE_SERVICE_CONFIG: default_generative_config.json + GENERATIVE_TIMEOUT: 5 + N_UTTERANCES_CONTEXT: 3 + context: . + dockerfile: ./skills/dff_template_prompted_skill/Dockerfile + command: gunicorn --workers=1 server:app -b 0.0.0.0:8143 --reload + deploy: + resources: + limits: + memory: 128M + reservations: + memory: 128M + +version: '3.7' diff --git a/assistant_dists/ai_faq_assistant/pipeline_conf.json b/assistant_dists/ai_faq_assistant/pipeline_conf.json new file mode 100644 index 0000000000..6fdbc04e62 --- /dev/null +++ b/assistant_dists/ai_faq_assistant/pipeline_conf.json @@ -0,0 +1,231 @@ +{ + "connectors": { + "sentseg": { + "protocol": "http", + "timeout": 1.5, + "url": "http://sentseg:8011/sentseg" + } + }, + "services": { + "last_chance_service": { + "connector": { + "protocol": "python", + "class_name": "PredefinedTextConnector", + "response_text": "Sorry, something went wrong inside. Please tell me, what did you say.", + "annotations": { + "sentseg": { + "punct_sent": "Sorry, something went wrong inside. Please tell me, what did you say.", + "segments": [ + "Sorry, something went wrong inside.", + "Please tell me, what did you say." + ] + } + } + }, + "state_manager_method": "add_bot_utterance_last_chance", + "tags": [ + "last_chance" + ] + }, + "timeout_service": { + "connector": { + "protocol": "python", + "class_name": "PredefinedTextConnector", + "response_text": "Sorry, I need to think more on that. Let's talk about something else.", + "annotations": { + "sentseg": { + "punct_sent": "Sorry, I need to think more on that. Let's talk about something else.", + "segments": [ + "Sorry, I need to think more on that.", + "Let's talk about something else." + ] + } + } + }, + "state_manager_method": "add_bot_utterance_last_chance", + "tags": [ + "timeout" + ] + }, + "response_annotator_selectors": { + "connector": { + "protocol": "python", + "class_name": "skill_selectors.post_annotator_selector.connector:PostAnnotatorSelectorConnector", + "annotator_names": [ + "sentseg" + ] + }, + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "tags": [ + "selector" + ] + }, + "response_annotators": { + "sentseg": { + "connector": "connectors.sentseg", + "dialog_formatter": "state_formatters.dp_formatters:last_bot_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "response_annotator_selectors" + ], + "state_manager_method": "add_annotation_prev_bot_utt" + } + }, + "annotators": { + "spelling_preprocessing": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://spelling-preprocessing:8074/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:last_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "state_manager_method": "add_annotation_and_reset_human_attributes_for_first_turn" + }, + "sentseg": { + "connector": "connectors.sentseg", + "dialog_formatter": "state_formatters.dp_formatters:preproc_last_human_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators.spelling_preprocessing" + ], + "state_manager_method": "add_annotation" + }, + "badlisted_words": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://badlisted-words:8018/badlisted_words" + }, + "dialog_formatter": "state_formatters.dp_formatters:preproc_last_human_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators.spelling_preprocessing" + ], + "state_manager_method": "add_annotation" + }, + "prompt_selector": { + "connector": { + "protocol": "http", + "timeout": 2, + "url": "http://prompt-selector:8135/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:context_formatter_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "state_manager_method": "add_annotation", + "previous_services": [ + "annotators.spelling_preprocessing" + ] + } + }, + "skill_selectors": { + "rule_based_selector": { + "connector": { + "protocol": "python", + "class_name": "skill_selectors.rule_based_selector.connector:RuleBasedSkillSelectorConnector" + }, + "dialog_formatter": "state_formatters.dp_formatters:base_skill_selector_formatter_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators" + ], + "tags": [ + "selector" + ] + } + }, + "skills": { + "dff_ai_faq_prompted_skill": { + "connector": { + "protocol": "http", + "timeout": 5, + "url": "http://dff-ai-faq-prompted-skill:8143/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:dff_ai_faq_prompted_skill_formatter", + "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", + "previous_services": [ + "skill_selectors" + ], + "state_manager_method": "add_hypothesis" + }, + "dummy_skill": { + "connector": { + "protocol": "python", + "class_name": "skills.dummy_skill.connector:DummySkillConnector" + }, + "dialog_formatter": "state_formatters.dp_formatters:utt_sentrewrite_modified_last_dialog", + "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", + "previous_services": [ + "skill_selectors" + ], + "state_manager_method": "add_hypothesis" + } + }, + "candidate_annotators": { + "badlisted_words": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://badlisted-words:8018/badlisted_words_batch" + }, + "dialog_formatter": "state_formatters.dp_formatters:hypotheses_list", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + }, + "combined_classification": { + "connector": { + "protocol": "http", + "timeout": 2, + "url": "http://combined-classification:8087/batch_model" + }, + "dialog_formatter": "state_formatters.dp_formatters:hypothesis_histories_list", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + }, + "sentence_ranker": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://sentence-ranker:8128/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:sentence_ranker_formatter", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + } + }, + "response_selectors": { + "response_selector": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://convers-evaluation-no-scripts-selector:8009/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:full_history_dialog", + "response_formatter": "state_formatters.dp_formatters:base_response_selector_formatter_service", + "previous_services": [ + "candidate_annotators" + ], + "state_manager_method": "add_bot_utterance" + } + } + }, + "metadata": { + "display_name": "AI FAQ Assistant", + "author": "AI for General Public", + "description": "Everything you wanted to know about modern AI but was afraid to ask! This FAQ Assistant chats with you while explaining the simplest topics from today's technology world.", + "version": "0.0.1", + "date_created": "2023-01-10T02:00:00", + "ram_usage": "50 GB", + "gpu_usage": "50 GB", + "disk_usage": "50 GB" + } +} \ No newline at end of file diff --git a/assistant_dists/ai_faq_assistant/proxy.yml b/assistant_dists/ai_faq_assistant/proxy.yml new file mode 100644 index 0000000000..70915cacf2 --- /dev/null +++ b/assistant_dists/ai_faq_assistant/proxy.yml @@ -0,0 +1,48 @@ +services: + + sentseg: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8011 + - PORT=8011 + + badlisted-words: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8018 + - PORT=8018 + + spelling-preprocessing: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8074 + - PORT=8074 + + combined-classification: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8087 + - PORT=8087 + + sentence-ranker: + command: [ "nginx", "-g", "daemon off;" ] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8128 + - PORT=8128 + +version: '3.7' diff --git a/assistant_dists/ai_faq_assistant/telegram.yml b/assistant_dists/ai_faq_assistant/telegram.yml new file mode 100644 index 0000000000..c2e318d35a --- /dev/null +++ b/assistant_dists/ai_faq_assistant/telegram.yml @@ -0,0 +1,17 @@ +services: + agent-tg: + command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.channel=telegram agent.telegram_token=$TG_TOKEN agent.pipeline_config=assistant_dists/ai_faq_assistant/pipeline_conf.json agent.db_config=assistant_dists/ai_faq_assistant/db_conf.json' + env_file: [.env] + build: + context: ./ + dockerfile: dockerfile_agent + deploy: + resources: + limits: + memory: 4G + reservations: + memory: 2G + volumes: + - ".:/dp-agent" + +version: '3.7' diff --git a/assistant_dists/da_costa_clothes_assistant/cpu.yml b/assistant_dists/da_costa_clothes_assistant/cpu.yml new file mode 100644 index 0000000000..19faae6fdc --- /dev/null +++ b/assistant_dists/da_costa_clothes_assistant/cpu.yml @@ -0,0 +1,14 @@ +version: '3.7' +services: + combined-classification: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" + sentence-ranker: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" + transformers-lm-gptj: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" diff --git a/assistant_dists/da_costa_clothes_assistant/db_conf.json b/assistant_dists/da_costa_clothes_assistant/db_conf.json new file mode 100644 index 0000000000..a9ba6813f5 --- /dev/null +++ b/assistant_dists/da_costa_clothes_assistant/db_conf.json @@ -0,0 +1,6 @@ +{ + "host": "DB_HOST", + "port": "DB_PORT", + "name": "DB_NAME", + "env": true +} \ No newline at end of file diff --git a/assistant_dists/da_costa_clothes_assistant/dev.yml b/assistant_dists/da_costa_clothes_assistant/dev.yml new file mode 100644 index 0000000000..11b2b8239a --- /dev/null +++ b/assistant_dists/da_costa_clothes_assistant/dev.yml @@ -0,0 +1,62 @@ +# С такими volumes удобно дебажить, не нужно пересобирать контейнер каждый раз при изменении кода +services: + agent: + volumes: + - ".:/dp-agent" + ports: + - 4242:4242 + sentseg: + volumes: + - "./annotators/SentSeg:/src" + ports: + - 8011:8011 + convers-evaluation-no-scripts-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 + spelling-preprocessing: + volumes: + - "./annotators/spelling_preprocessing:/src" + ports: + - 8074:8074 + combined-classification: + volumes: + - "./common:/src/common" + - "./annotators/combined_classification:/src" + ports: + - 8087:8087 + sentence-ranker: + volumes: + - "./services/sentence_ranker:/src" + - "~/.deeppavlov/cache:/root/.cache" + ports: + - 8128:8128 + prompt-selector: + volumes: + - "./annotators/prompt_selector:/src" + - "./common:/src/common" + ports: + - 8135:8135 + transformers-lm-gptj: + volumes: + - "./services/transformers_lm:/src" + - "./common:/src/common" + - "~/.deeppavlov/cache:/root/.cache" + ports: + - 8130:8130 + dff-da-costa-clothes-prompted-skill: + volumes: + - "./skills/dff_template_prompted_skill:/src" + - "./common:/src/common" + ports: + - 8144:8144 + +version: "3.7" diff --git a/assistant_dists/da_costa_clothes_assistant/docker-compose.override.yml b/assistant_dists/da_costa_clothes_assistant/docker-compose.override.yml new file mode 100644 index 0000000000..bf46f07070 --- /dev/null +++ b/assistant_dists/da_costa_clothes_assistant/docker-compose.override.yml @@ -0,0 +1,190 @@ +services: + agent: + command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.pipeline_config=assistant_dists/da_costa_clothes_assistant/pipeline_conf.json' + environment: + WAIT_HOSTS: "sentseg:8011, convers-evaluation-no-scripts-selector:8009, badlisted-words:8018, combined-classification:8087, + spelling-preprocessing:8074, sentence-ranker:8128, prompt-selector:8135, transformers-lm-gptj:8130, + dff-da-costa-clothes-prompted-skill:8144" + WAIT_HOSTS_TIMEOUT: ${WAIT_TIMEOUT:-1000} + + 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 + + convers-evaluation-no-scripts-selector: + env_file: [ .env ] + build: + args: + TAG_BASED_SELECTION: 1 + CALL_BY_NAME_PROBABILITY: 0.5 + PROMPT_PROBA: 0.1 + 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: 1 + RESTRICTION_FOR_SENSITIVE_CASE: 1 + PRIORITIZE_PROMTS_WHEN_NO_SCRIPTS: 0 + MAX_TURNS_WITHOUT_SCRIPTS: 7 + ADD_ACKNOWLEDGMENTS_IF_POSSIBLE: 1 + PRIORITIZE_SCRIPTED_SKILLS: 0 + CONFIDENCE_STRENGTH: 0.8 + CONV_EVAL_STRENGTH: 0.4 + PRIORITIZE_HUMAN_INITIATIVE: 1 + QUESTION_TO_QUESTION_DOWNSCORE_COEF: 0.8 + context: . + dockerfile: ./response_selectors/convers_evaluation_based_selector/Dockerfile + command: flask run -h 0.0.0.0 -p 8009 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + 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 + + spelling-preprocessing: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing + context: ./annotators/spelling_preprocessing/ + command: flask run -h 0.0.0.0 -p 8074 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + prompt-selector: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8135 + SERVICE_NAME: prompt_selector + N_SENTENCES_TO_RETURN: 3 + PROMPTS_TO_CONSIDER: da_costa_clothes + context: . + dockerfile: ./annotators/prompt_selector/Dockerfile + command: flask run -h 0.0.0.0 -p 8135 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + sentence-ranker: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8128 + SERVICE_NAME: sentence_ranker + PRETRAINED_MODEL_NAME_OR_PATH: sentence-transformers/bert-base-nli-mean-tokens + context: ./services/sentence_ranker/ + command: flask run -h 0.0.0.0 -p 8128 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 3G + reservations: + memory: 3G + + transformers-lm-gptj: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8130 + SERVICE_NAME: transformers_lm_gptj + PRETRAINED_MODEL_NAME_OR_PATH: EleutherAI/gpt-j-6B + HALF_PRECISION: 0 + context: . + dockerfile: ./services/transformers_lm/Dockerfile + command: flask run -h 0.0.0.0 -p 8130 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 50G + reservations: + memory: 50G + + dff-da-costa-clothes-prompted-skill: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8144 + SERVICE_NAME: dff_da_costa_clothes_prompted_skill + PROMPT_FILE: common/prompts/da_costa_clothes.json + GENERATIVE_SERVICE_URL: http://transformers-lm-gptj:8130/respond + GENERATIVE_SERVICE_CONFIG: default_generative_config.json + GENERATIVE_TIMEOUT: 5 + N_UTTERANCES_CONTEXT: 3 + context: . + dockerfile: ./skills/dff_template_prompted_skill/Dockerfile + command: gunicorn --workers=1 server:app -b 0.0.0.0:8144 --reload + deploy: + resources: + limits: + memory: 128M + reservations: + memory: 128M + +version: '3.7' diff --git a/assistant_dists/da_costa_clothes_assistant/pipeline_conf.json b/assistant_dists/da_costa_clothes_assistant/pipeline_conf.json new file mode 100644 index 0000000000..76277409b3 --- /dev/null +++ b/assistant_dists/da_costa_clothes_assistant/pipeline_conf.json @@ -0,0 +1,231 @@ +{ + "connectors": { + "sentseg": { + "protocol": "http", + "timeout": 1.5, + "url": "http://sentseg:8011/sentseg" + } + }, + "services": { + "last_chance_service": { + "connector": { + "protocol": "python", + "class_name": "PredefinedTextConnector", + "response_text": "Sorry, something went wrong inside. Please tell me, what did you say.", + "annotations": { + "sentseg": { + "punct_sent": "Sorry, something went wrong inside. Please tell me, what did you say.", + "segments": [ + "Sorry, something went wrong inside.", + "Please tell me, what did you say." + ] + } + } + }, + "state_manager_method": "add_bot_utterance_last_chance", + "tags": [ + "last_chance" + ] + }, + "timeout_service": { + "connector": { + "protocol": "python", + "class_name": "PredefinedTextConnector", + "response_text": "Sorry, I need to think more on that. Let's talk about something else.", + "annotations": { + "sentseg": { + "punct_sent": "Sorry, I need to think more on that. Let's talk about something else.", + "segments": [ + "Sorry, I need to think more on that.", + "Let's talk about something else." + ] + } + } + }, + "state_manager_method": "add_bot_utterance_last_chance", + "tags": [ + "timeout" + ] + }, + "response_annotator_selectors": { + "connector": { + "protocol": "python", + "class_name": "skill_selectors.post_annotator_selector.connector:PostAnnotatorSelectorConnector", + "annotator_names": [ + "sentseg" + ] + }, + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "tags": [ + "selector" + ] + }, + "response_annotators": { + "sentseg": { + "connector": "connectors.sentseg", + "dialog_formatter": "state_formatters.dp_formatters:last_bot_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "response_annotator_selectors" + ], + "state_manager_method": "add_annotation_prev_bot_utt" + } + }, + "annotators": { + "spelling_preprocessing": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://spelling-preprocessing:8074/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:last_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "state_manager_method": "add_annotation_and_reset_human_attributes_for_first_turn" + }, + "sentseg": { + "connector": "connectors.sentseg", + "dialog_formatter": "state_formatters.dp_formatters:preproc_last_human_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators.spelling_preprocessing" + ], + "state_manager_method": "add_annotation" + }, + "badlisted_words": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://badlisted-words:8018/badlisted_words" + }, + "dialog_formatter": "state_formatters.dp_formatters:preproc_last_human_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators.spelling_preprocessing" + ], + "state_manager_method": "add_annotation" + }, + "prompt_selector": { + "connector": { + "protocol": "http", + "timeout": 2, + "url": "http://prompt-selector:8135/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:context_formatter_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "state_manager_method": "add_annotation", + "previous_services": [ + "annotators.spelling_preprocessing" + ] + } + }, + "skill_selectors": { + "rule_based_selector": { + "connector": { + "protocol": "python", + "class_name": "skill_selectors.rule_based_selector.connector:RuleBasedSkillSelectorConnector" + }, + "dialog_formatter": "state_formatters.dp_formatters:base_skill_selector_formatter_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators" + ], + "tags": [ + "selector" + ] + } + }, + "skills": { + "dff_da_costa_clothes_prompted_skill": { + "connector": { + "protocol": "http", + "timeout": 5, + "url": "http://dff-da-costa-clothes-prompted-skill:8144/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:dff_da_costa_clothes_prompted_skill_formatter", + "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", + "previous_services": [ + "skill_selectors" + ], + "state_manager_method": "add_hypothesis" + }, + "dummy_skill": { + "connector": { + "protocol": "python", + "class_name": "skills.dummy_skill.connector:DummySkillConnector" + }, + "dialog_formatter": "state_formatters.dp_formatters:utt_sentrewrite_modified_last_dialog", + "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", + "previous_services": [ + "skill_selectors" + ], + "state_manager_method": "add_hypothesis" + } + }, + "candidate_annotators": { + "badlisted_words": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://badlisted-words:8018/badlisted_words_batch" + }, + "dialog_formatter": "state_formatters.dp_formatters:hypotheses_list", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + }, + "combined_classification": { + "connector": { + "protocol": "http", + "timeout": 2, + "url": "http://combined-classification:8087/batch_model" + }, + "dialog_formatter": "state_formatters.dp_formatters:hypothesis_histories_list", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + }, + "sentence_ranker": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://sentence-ranker:8128/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:sentence_ranker_formatter", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + } + }, + "response_selectors": { + "response_selector": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://convers-evaluation-no-scripts-selector:8009/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:full_history_dialog", + "response_formatter": "state_formatters.dp_formatters:base_response_selector_formatter_service", + "previous_services": [ + "candidate_annotators" + ], + "state_manager_method": "add_bot_utterance" + } + } + }, + "metadata": { + "display_name": "da Costa Clothes Assistant", + "author": "da Costa Industries", + "description": "Stay protected in every season with da Costa Industries Clothes Assistant! Experience the ultimate comfort and protection, no matter the weather. Stay warm in winter a...", + "version": "0.0.1", + "date_created": "2023-01-10T02:00:00", + "ram_usage": "50 GB", + "gpu_usage": "50 GB", + "disk_usage": "50 GB" + } +} \ No newline at end of file diff --git a/assistant_dists/da_costa_clothes_assistant/proxy.yml b/assistant_dists/da_costa_clothes_assistant/proxy.yml new file mode 100644 index 0000000000..70915cacf2 --- /dev/null +++ b/assistant_dists/da_costa_clothes_assistant/proxy.yml @@ -0,0 +1,48 @@ +services: + + sentseg: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8011 + - PORT=8011 + + badlisted-words: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8018 + - PORT=8018 + + spelling-preprocessing: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8074 + - PORT=8074 + + combined-classification: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8087 + - PORT=8087 + + sentence-ranker: + command: [ "nginx", "-g", "daemon off;" ] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8128 + - PORT=8128 + +version: '3.7' diff --git a/assistant_dists/da_costa_clothes_assistant/telegram.yml b/assistant_dists/da_costa_clothes_assistant/telegram.yml new file mode 100644 index 0000000000..35f6c327cc --- /dev/null +++ b/assistant_dists/da_costa_clothes_assistant/telegram.yml @@ -0,0 +1,17 @@ +services: + agent-tg: + command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.channel=telegram agent.telegram_token=$TG_TOKEN agent.pipeline_config=assistant_dists/da_costa_clothes_assistant/pipeline_conf.json agent.db_config=assistant_dists/da_costa_clothes_assistant/db_conf.json' + env_file: [.env] + build: + context: ./ + dockerfile: dockerfile_agent + deploy: + resources: + limits: + memory: 4G + reservations: + memory: 2G + volumes: + - ".:/dp-agent" + +version: '3.7' diff --git a/assistant_dists/deepy_adv/docker-compose.override.yml b/assistant_dists/deepy_adv/docker-compose.override.yml index 05052bfee8..964f9fe1f7 100644 --- a/assistant_dists/deepy_adv/docker-compose.override.yml +++ b/assistant_dists/deepy_adv/docker-compose.override.yml @@ -12,10 +12,19 @@ services: spelling-preprocessing: env_file: [ .env ] build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing context: ./annotators/spelling_preprocessing/ command: flask run -h 0.0.0.0 -p 8074 environment: - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M ports: - 8074:8074 @@ -57,8 +66,9 @@ services: entity-linking-deepy: build: args: + SERVICE_PORT: 8075 + SERVICE_NAME: entity_linking CONFIG: entity_linking_deepy.json - PORT: 8075 SRC_DIR: annotators/entity_linking_deepy context: ./ dockerfile: annotators/entity_linking_deepy/Dockerfile diff --git a/assistant_dists/deepy_base/docker-compose.override.yml b/assistant_dists/deepy_base/docker-compose.override.yml index 6b557abae1..a3829c930a 100644 --- a/assistant_dists/deepy_base/docker-compose.override.yml +++ b/assistant_dists/deepy_base/docker-compose.override.yml @@ -11,10 +11,19 @@ services: spelling-preprocessing: env_file: [ .env ] build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing context: ./annotators/spelling_preprocessing/ command: flask run -h 0.0.0.0 -p 8074 environment: - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M ports: - 8074:8074 diff --git a/assistant_dists/deepy_faq/docker-compose.override.yml b/assistant_dists/deepy_faq/docker-compose.override.yml index d49bebe53d..9592778e51 100644 --- a/assistant_dists/deepy_faq/docker-compose.override.yml +++ b/assistant_dists/deepy_faq/docker-compose.override.yml @@ -11,10 +11,19 @@ services: spelling-preprocessing: env_file: [ .env ] build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing context: ./annotators/spelling_preprocessing/ command: flask run -h 0.0.0.0 -p 8074 environment: - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M ports: - 8074:8074 diff --git a/assistant_dists/deepy_gobot_base/docker-compose.override.yml b/assistant_dists/deepy_gobot_base/docker-compose.override.yml index 516a0fadd3..d2d6427c4d 100644 --- a/assistant_dists/deepy_gobot_base/docker-compose.override.yml +++ b/assistant_dists/deepy_gobot_base/docker-compose.override.yml @@ -11,10 +11,19 @@ services: spelling-preprocessing: env_file: [ .env ] build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing context: ./annotators/spelling_preprocessing/ command: flask run -h 0.0.0.0 -p 8074 environment: - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M ports: - 8074:8074 diff --git a/assistant_dists/dream/cpu.yml b/assistant_dists/dream/cpu.yml index 23d0fa0671..02e7d45850 100644 --- a/assistant_dists/dream/cpu.yml +++ b/assistant_dists/dream/cpu.yml @@ -21,9 +21,6 @@ services: knowledge-grounding: environment: CUDA_VISIBLE_DEVICES: "" - midas-classification: - environment: - CUDA_VISIBLE_DEVICES: "" combined-classification: environment: CUDA_VISIBLE_DEVICES: "" diff --git a/assistant_dists/dream/dev.yml b/assistant_dists/dream/dev.yml index f4522c8e11..452f4e187c 100644 --- a/assistant_dists/dream/dev.yml +++ b/assistant_dists/dream/dev.yml @@ -275,12 +275,6 @@ services: - "~/.deeppavlov/cache:/root/.cache" ports: - 8087:8087 - midas-classification: - volumes: - - "./annotators/midas_classification:/src" - - "~/.deeppavlov:/root/.deeppavlov" - ports: - - 8090:8090 dff-travel-skill: volumes: - "./skills/dff_travel_skill:/src" @@ -441,16 +435,29 @@ services: - "./common:/src/common" ports: - 8133:8133 - dff-template-skill: - volumes: - - "./skills/dff_template_skill:/src" - - "./common:/src/common" - ports: - - 8120:8120 property-extraction: volumes: - "./annotators/property_extraction:/src" - "~/.deeppavlov:/root/.deeppavlov" ports: - 8136:8136 + infilling: + volumes: + - "./services/infilling:/src" + - "~/.deeppavlov:/root/.deeppavlov" + ports: + - 8139:8139 + masked-lm: + volumes: + - "./services/masked_lm:/src" + - "./common:/src/common" + - "~/.deeppavlov/cache:/root/.cache" + ports: + - 8141:8141 + dff-template-skill: + volumes: + - "./skills/dff_template_skill:/src" + - "./common:/src/common" + ports: + - 8120:8120 version: "3.7" diff --git a/assistant_dists/dream/docker-compose.override.yml b/assistant_dists/dream/docker-compose.override.yml index f781a83787..dbc45a1c6f 100644 --- a/assistant_dists/dream/docker-compose.override.yml +++ b/assistant_dists/dream/docker-compose.override.yml @@ -32,7 +32,7 @@ services: build: args: CONFIG: conveval.json - PORT: 8004 + SERVICE_PORT: 8004 DATA_URL: https://files.deeppavlov.ai/alexaprize_data/cobot_conveval2.tar.gz context: . dockerfile: ./annotators/ConversationEvaluator/Dockerfile @@ -50,6 +50,9 @@ services: spacy-nounphrases: env_file: [ .env ] build: + args: + SERVICE_PORT: 8006 + SERVICE_NAME: spacy_nounphrases context: . dockerfile: ./annotators/spacy_nounphrases/Dockerfile command: flask run -h 0.0.0.0 -p 8006 @@ -65,6 +68,9 @@ services: rake-keywords: env_file: [ .env ] build: + args: + SERVICE_PORT: 8007 + SERVICE_NAME: rake_keywords context: . dockerfile: ./annotators/rake_keywords/Dockerfile command: flask run -h 0.0.0.0 -p 8007 @@ -102,9 +108,9 @@ services: deploy: resources: limits: - memory: 50M + memory: 100M reservations: - memory: 50M + memory: 100M sentseg: env_file: [ .env ] @@ -208,6 +214,9 @@ services: 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: @@ -261,7 +270,7 @@ services: build: args: CONFIG: ner_case_agnostic_multilingual_bert_base_extended.json - PORT: 8021 + SERVICE_PORT: 8021 SRC_DIR: annotators/NER_deeppavlov COMMIT: f5117cd9ad1e64f6c2d970ecaa42fc09ccb23144 context: ./ @@ -288,9 +297,9 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M convert-reddit: env_file: [ .env ] @@ -332,9 +341,9 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M misheard-asr: env_file: [ .env ] @@ -362,9 +371,9 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M dummy-skill-dialog: env_file: [ .env ] @@ -452,15 +461,16 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M game-cooperative-skill: env_file: [ .env ] build: args: SERVICE_PORT: 8068 + SERVICE_NAME: game_cooperative_skill context: . dockerfile: ./skills/game_cooperative_skill/Dockerfile command: flask run -h 0.0.0.0 -p 8068 @@ -492,6 +502,9 @@ services: news-api-skill: env_file: [ .env ] build: + args: + SERVICE_PORT: 8066 + SERVICE_NAME: news_api_skill context: . dockerfile: ./skills/news_api_skill/Dockerfile environment: @@ -508,6 +521,8 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8112 + SERVICE_NAME: news_api_annotator ASYNC_SIZE: 3 context: . dockerfile: ./annotators/news_api/Dockerfile @@ -524,6 +539,9 @@ services: factoid-qa: env_file: [ .env ] build: + args: + SERVICE_PORT: 8071 + SERVICE_NAME: factoid_qa context: . dockerfile: ./skills/factoid_qa/Dockerfile command: flask run -h 0.0.0.0 -p 8071 @@ -540,8 +558,9 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8075 + SERVICE_NAME: entity_linking CONFIG: entity_linking_eng.json - PORT: 8075 SRC_DIR: annotators/entity_linking context: ./ dockerfile: annotators/entity_linking/Dockerfile @@ -558,11 +577,12 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8077 + SERVICE_NAME: wiki_parser WIKI_LITE_DB: http://files.deeppavlov.ai/kbqa/wikidata/wikidata2022.hdt WIKI_LITE_INDEX_DB: http://files.deeppavlov.ai/kbqa/wikidata/wikidata2022.hdt.index.v1-1 WIKI_CACHE_DB: http://files.deeppavlov.ai/kbqa/wikidata/wikidata_cache.json CONFIG: wiki_parser.json - PORT: 8077 SRC_DIR: annotators/wiki_parser COMMIT: ff5b156d16a949c3ec99da7fb60ae907dec37a41 FAST: 1 @@ -583,8 +603,9 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8078 + SERVICE_NAME: text_qa CONFIG: qa_eng.json - PORT: 8078 context: services/text_qa dockerfile: Dockerfile command: flask run -h 0.0.0.0 -p 8078 @@ -603,8 +624,9 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8072 + SERVICE_NAME: kbqa CONFIG: kbqa_cq_mt_bert_lite.json - PORT: 8072 SRC_DIR: annotators/kbqa/ COMMIT: 283a25e322e8fedc6ff0c159e4ec76bb165ae405 context: ./ @@ -623,6 +645,9 @@ services: spelling-preprocessing: env_file: [ .env ] build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing context: ./annotators/spelling_preprocessing/ command: flask run -h 0.0.0.0 -p 8074 environment: @@ -630,9 +655,9 @@ services: deploy: resources: limits: - memory: 50M + memory: 100M reservations: - memory: 50M + memory: 100M dff-grounding-skill: env_file: [ .env ] @@ -654,6 +679,8 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8083 + SERVICE_NAME: knowledge_grounding MODEL_CKPT: 3_sent_62_epochs DATA_ARG: http://files.deeppavlov.ai/alexaprize_data/parlai_grounding_knowledge/parlai_topical_chat_data.tar.gz MODEL1_ARG: http://files.deeppavlov.ai/alexaprize_data/parlai_grounding_knowledge/topical_chat_blender90_1_sent_48_epochs.tar.gz @@ -713,11 +740,12 @@ services: entity-storer: env_file: [ .env ] build: - context: . - dockerfile: annotators/entity_storer/Dockerfile args: - WORK_DIR: annotators/entity_storer SERVICE_PORT: 8089 + SERVICE_NAME: entity_storer + WORK_DIR: annotators/entity_storer + context: . + dockerfile: annotators/entity_storer/Dockerfile command: flask run -h 0.0.0.0 -p 8089 environment: - FLASK_APP=server @@ -731,6 +759,9 @@ services: knowledge-grounding-skill: env_file: [ .env ] build: + args: + SERVICE_PORT: 8085 + SERVICE_NAME: knowledge_grounding_skill context: . dockerfile: ./skills/knowledge_grounding_skill/Dockerfile command: python -m flask run -h 0.0.0.0 -p 8085 @@ -748,8 +779,9 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8087 + SERVICE_NAME: combined_classification CONFIG: combined_classifier.json - PORT: 8087 context: . dockerfile: ./annotators/combined_classification/Dockerfile environment: @@ -892,23 +924,6 @@ services: reservations: memory: 256M - midas-classification: - env_file: [ .env ] - build: - args: - CONFIG: midas_conv_bert.json - context: ./annotators/midas_classification - command: flask run -h 0.0.0.0 -p 8090 - environment: - - CUDA_VISIBLE_DEVICES=0 - - FLASK_APP=server - deploy: - resources: - limits: - memory: 3G - reservations: - memory: 3G - fact-random: env_file: [ .env ] build: @@ -931,10 +946,11 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8100 + SERVICE_NAME: fact_retrieval CONFIG: configs/fact_retrieval_page.json CONFIG_WIKI: configs/page_extractor.json CONFIG_WHOW: configs/whow_page_extractor.json - PORT: 8100 SRC_DIR: annotators/fact_retrieval/ COMMIT: 4b3e60c407644b750c9dc292ac6bf206081fb9d0 N_FACTS: 3 @@ -1009,6 +1025,9 @@ services: topic-recommendation: env_file: [ .env ] build: + args: + SERVICE_PORT: 8113 + SERVICE_NAME: topic_recommendation context: ./annotators/topic_recommendation/ command: flask run -h 0.0.0.0 -p 8113 environment: @@ -1023,6 +1042,9 @@ services: user-persona-extractor: env_file: [ .env ] build: + args: + SERVICE_PORT: 8114 + SERVICE_NAME: user_persona_extractor context: . dockerfile: ./annotators/user_persona_extractor/Dockerfile command: flask run -h 0.0.0.0 -p 8114 @@ -1031,9 +1053,9 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M wiki-facts: env_file: [ .env ] @@ -1076,10 +1098,11 @@ services: env_file: [ .env ] build: args: + SERVICE_NAME: entity_detection SEQ_TAG_CONFIG: wikipedia_entity_detection_distilbert.json CONFIG: entity_detection_eng.json LOWERCASE: 1 - PORT: 8103 + SERVICE_PORT: 8103 SRC_DIR: annotators/entity_detection/ FINEGRAINED: 0 context: ./ @@ -1174,9 +1197,9 @@ services: deploy: resources: limits: - memory: 50M + memory: 100M reservations: - memory: 50M + memory: 100M dialogpt: env_file: [ .env ] @@ -1240,15 +1263,16 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M sentence-ranker: env_file: [ .env ] build: args: SERVICE_PORT: 8128 + SERVICE_NAME: sentence_ranker PRETRAINED_MODEL_NAME_OR_PATH: sentence-transformers/bert-base-nli-mean-tokens context: ./services/sentence_ranker/ command: flask run -h 0.0.0.0 -p 8128 @@ -1308,8 +1332,9 @@ services: build: args: CONFIG: t5_generative_ie_lite_infer.json - PORT: 8136 + SERVICE_PORT: 8136 SRC_DIR: annotators/property_extraction/ + SERVICE_NAME: property_extraction context: ./ dockerfile: annotators/property_extraction/Dockerfile command: flask run -h 0.0.0.0 -p 8136 @@ -1322,6 +1347,43 @@ services: reservations: memory: 7G + infilling: + env_file: [ .env ] + build: + context: ./services/infilling/ + args: + SERVICE_PORT: 8139 + SERVICE_NAME: infilling + command: flask run -h 0.0.0.0 -p 8139 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 2.5G + reservations: + memory: 2.5G + + masked-lm: + env_file: [ .env ] + build: + context: ./services/masked_lm/ + args: + SERVICE_PORT: 8141 + SERVICE_NAME: masked_lm + PRETRAINED_MODEL_NAME_OR_PATH: "bert-base-uncased" + command: flask run -h 0.0.0.0 -p 8141 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 4G + reservations: + memory: 4G + dff-template-skill: env_file: [ .env ] build: diff --git a/assistant_dists/dream/gpu1.yml b/assistant_dists/dream/gpu1.yml index 9c3b21c7e6..cf02bd2a16 100644 --- a/assistant_dists/dream/gpu1.yml +++ b/assistant_dists/dream/gpu1.yml @@ -30,12 +30,6 @@ services: restart: unless-stopped environment: - CUDA_VISIBLE_DEVICES=6 - midas-classification: - restart: unless-stopped - environment: - - CUDA_VISIBLE_DEVICES=6 - volumes: - - "~/.deeppavlov:/root/.deeppavlov" combined-classification: restart: unless-stopped environment: diff --git a/assistant_dists/dream/proxy.yml b/assistant_dists/dream/proxy.yml index 41669ec7a8..91d6f03c20 100644 --- a/assistant_dists/dream/proxy.yml +++ b/assistant_dists/dream/proxy.yml @@ -333,15 +333,6 @@ services: - PROXY_PASS=dream.deeppavlov.ai:8085 - PORT=8085 - midas-classification: - command: ["nginx", "-g", "daemon off;"] - build: - context: dp/proxy/ - dockerfile: Dockerfile - environment: - - PROXY_PASS=dream.deeppavlov.ai:8090 - - PORT=8090 - combined-classification: command: ["nginx", "-g", "daemon off;"] build: diff --git a/assistant_dists/dream/test.yml b/assistant_dists/dream/test.yml index 210054babe..7fde6ebb01 100644 --- a/assistant_dists/dream/test.yml +++ b/assistant_dists/dream/test.yml @@ -23,11 +23,6 @@ services: knowledge-grounding: environment: - CUDA_VISIBLE_DEVICES=6 - midas-classification: - environment: - - CUDA_VISIBLE_DEVICES=6 - volumes: - - "~/.deeppavlov:/root/.deeppavlov" combined-classification: environment: - CUDA_VISIBLE_DEVICES=7 @@ -137,4 +132,10 @@ services: property-extraction: volumes: - "~/.deeppavlov:/root/.deeppavlov" + infilling: + environment: + - CUDA_VISIBLE_DEVICES="" + masked-lm: + environment: + - CUDA_VISIBLE_DEVICES="" version: '3.7' diff --git a/assistant_dists/dream_alexa/docker-compose.override.yml b/assistant_dists/dream_alexa/docker-compose.override.yml index d6448905d1..ef445a88b3 100644 --- a/assistant_dists/dream_alexa/docker-compose.override.yml +++ b/assistant_dists/dream_alexa/docker-compose.override.yml @@ -31,7 +31,7 @@ services: build: args: CONFIG: conveval.json - PORT: 8004 + SERVICE_PORT: 8004 DATA_URL: https://files.deeppavlov.ai/alexaprize_data/cobot_conveval2.tar.gz context: . dockerfile: ./annotators/ConversationEvaluator/Dockerfile @@ -49,6 +49,9 @@ services: spacy-nounphrases: env_file: [.env] build: + args: + SERVICE_PORT: 8006 + SERVICE_NAME: spacy_nounphrases context: . dockerfile: ./annotators/spacy_nounphrases/Dockerfile command: flask run -h 0.0.0.0 -p 8006 @@ -86,9 +89,9 @@ services: deploy: resources: limits: - memory: 50M + memory: 100M reservations: - memory: 50M + memory: 100M sentseg: env_file: [.env] @@ -192,6 +195,9 @@ services: 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: @@ -245,7 +251,7 @@ services: build: args: CONFIG: ner_case_agnostic_multilingual_bert_base_extended.json - PORT: 8021 + SERVICE_PORT: 8021 SRC_DIR: annotators/NER_deeppavlov COMMIT: f5117cd9ad1e64f6c2d970ecaa42fc09ccb23144 context: ./ @@ -272,9 +278,9 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M convert-reddit: env_file: [.env] @@ -316,9 +322,9 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M misheard-asr: env_file: [.env] @@ -346,9 +352,9 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M dummy-skill-dialog: env_file: [.env] @@ -436,15 +442,16 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M game-cooperative-skill: env_file: [.env] build: args: SERVICE_PORT: 8068 + SERVICE_NAME: game_cooperative_skill context: . dockerfile: ./skills/game_cooperative_skill/Dockerfile command: flask run -h 0.0.0.0 -p 8068 @@ -476,6 +483,9 @@ services: news-api-skill: env_file: [.env] build: + args: + SERVICE_PORT: 8066 + SERVICE_NAME: news_api_skill context: . dockerfile: ./skills/news_api_skill/Dockerfile environment: @@ -492,6 +502,8 @@ services: env_file: [.env] build: args: + SERVICE_PORT: 8112 + SERVICE_NAME: news_api_annotator ASYNC_SIZE: 3 context: . dockerfile: ./annotators/news_api/Dockerfile @@ -508,6 +520,9 @@ services: factoid-qa: env_file: [.env] build: + args: + SERVICE_PORT: 8071 + SERVICE_NAME: factoid_qa context: . dockerfile: ./skills/factoid_qa/Dockerfile command: flask run -h 0.0.0.0 -p 8071 @@ -524,8 +539,9 @@ services: env_file: [.env] build: args: + SERVICE_PORT: 8075 + SERVICE_NAME: entity_linking CONFIG: entity_linking_eng.json - PORT: 8075 SRC_DIR: annotators/entity_linking context: ./ dockerfile: annotators/entity_linking/Dockerfile @@ -542,11 +558,12 @@ services: env_file: [.env] build: args: + SERVICE_PORT: 8077 + SERVICE_NAME: wiki_parser WIKI_LITE_DB: http://files.deeppavlov.ai/kbqa/wikidata/wikidata2022.hdt WIKI_LITE_INDEX_DB: http://files.deeppavlov.ai/kbqa/wikidata/wikidata2022.hdt.index.v1-1 WIKI_CACHE_DB: http://files.deeppavlov.ai/kbqa/wikidata/wikidata_cache.json CONFIG: wiki_parser.json - PORT: 8077 SRC_DIR: annotators/wiki_parser COMMIT: ff5b156d16a949c3ec99da7fb60ae907dec37a41 FAST: 1 @@ -567,8 +584,9 @@ services: env_file: [.env] build: args: + SERVICE_PORT: 8078 + SERVICE_NAME: text_qa CONFIG: qa_eng.json - PORT: 8078 context: services/text_qa dockerfile: Dockerfile command: flask run -h 0.0.0.0 -p 8078 @@ -587,8 +605,9 @@ services: env_file: [.env] build: args: + SERVICE_PORT: 8072 + SERVICE_NAME: kbqa CONFIG: kbqa_cq_mt_bert_lite.json - PORT: 8072 SRC_DIR: annotators/kbqa/ COMMIT: 47adffa799cc8b04fa9af7b8842e9f5d76bfe2dc context: ./ @@ -607,6 +626,9 @@ services: spelling-preprocessing: env_file: [ .env ] build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing context: ./annotators/spelling_preprocessing/ command: flask run -h 0.0.0.0 -p 8074 environment: @@ -614,9 +636,9 @@ services: deploy: resources: limits: - memory: 50M + memory: 100M reservations: - memory: 50M + memory: 100M dff-grounding-skill: env_file: [.env] @@ -638,6 +660,8 @@ services: env_file: [.env] build: args: + SERVICE_PORT: 8083 + SERVICE_NAME: knowledge_grounding MODEL_CKPT: 3_sent_62_epochs DATA_ARG: http://files.deeppavlov.ai/alexaprize_data/parlai_grounding_knowledge/parlai_topical_chat_data.tar.gz MODEL1_ARG: http://files.deeppavlov.ai/alexaprize_data/parlai_grounding_knowledge/topical_chat_blender90_1_sent_48_epochs.tar.gz @@ -697,11 +721,12 @@ services: entity-storer: env_file: [.env] build: - context: . - dockerfile: annotators/entity_storer/Dockerfile args: - WORK_DIR: annotators/entity_storer SERVICE_PORT: 8089 + SERVICE_NAME: entity_storer + WORK_DIR: annotators/entity_storer + context: . + dockerfile: annotators/entity_storer/Dockerfile command: flask run -h 0.0.0.0 -p 8089 environment: - FLASK_APP=server @@ -715,6 +740,9 @@ services: knowledge-grounding-skill: env_file: [.env] build: + args: + SERVICE_PORT: 8085 + SERVICE_NAME: knowledge_grounding_skill context: . dockerfile: ./skills/knowledge_grounding_skill/Dockerfile command: python -m flask run -h 0.0.0.0 -p 8085 @@ -732,8 +760,9 @@ services: env_file: [.env] build: args: + SERVICE_PORT: 8087 + SERVICE_NAME: combined_classification CONFIG: combined_classifier.json - PORT: 8087 context: . dockerfile: ./annotators/combined_classification/Dockerfile environment: @@ -881,6 +910,8 @@ services: env_file: [.env] build: args: + SERVICE_PORT: 8090 + SERVICE_NAME: midas_classification CONFIG: midas_conv_bert.json context: ./annotators/midas_classification command: flask run -h 0.0.0.0 -p 8090 @@ -916,10 +947,11 @@ services: env_file: [.env] build: args: + SERVICE_PORT: 8100 + SERVICE_NAME: fact_retrieval CONFIG: configs/fact_retrieval_page.json CONFIG_WIKI: configs/page_extractor.json CONFIG_WHOW: configs/whow_page_extractor.json - PORT: 8100 SRC_DIR: annotators/fact_retrieval/ COMMIT: 4b3e60c407644b750c9dc292ac6bf206081fb9d0 N_FACTS: 3 @@ -994,6 +1026,9 @@ services: topic-recommendation: env_file: [.env] build: + args: + SERVICE_PORT: 8113 + SERVICE_NAME: topic_recommendation context: ./annotators/topic_recommendation/ command: flask run -h 0.0.0.0 -p 8113 environment: @@ -1008,6 +1043,9 @@ services: user-persona-extractor: env_file: [.env] build: + args: + SERVICE_PORT: 8114 + SERVICE_NAME: user_persona_extractor context: . dockerfile: ./annotators/user_persona_extractor/Dockerfile command: flask run -h 0.0.0.0 -p 8114 @@ -1016,9 +1054,9 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M wiki-facts: env_file: [.env] @@ -1061,10 +1099,11 @@ services: env_file: [ .env ] build: args: + SERVICE_NAME: entity_detection SEQ_TAG_CONFIG: wikipedia_entity_detection_distilbert.json CONFIG: entity_detection_eng.json LOWERCASE: 1 - PORT: 8103 + SERVICE_PORT: 8103 SRC_DIR: annotators/entity_detection/ FINEGRAINED: 0 context: ./ diff --git a/assistant_dists/dream_mini/docker-compose.override.yml b/assistant_dists/dream_mini/docker-compose.override.yml index 6cb05051b2..923fcf776e 100644 --- a/assistant_dists/dream_mini/docker-compose.override.yml +++ b/assistant_dists/dream_mini/docker-compose.override.yml @@ -117,6 +117,9 @@ services: 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: @@ -131,6 +134,9 @@ services: spelling-preprocessing: env_file: [ .env ] build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing context: ./annotators/spelling_preprocessing/ command: flask run -h 0.0.0.0 -p 8074 environment: @@ -138,9 +144,9 @@ services: deploy: resources: limits: - memory: 50M + memory: 100M reservations: - memory: 50M + memory: 100M dialogpt: env_file: [ .env ] @@ -170,6 +176,7 @@ services: build: args: SERVICE_PORT: 8128 + SERVICE_NAME: sentence_ranker PRETRAINED_MODEL_NAME_OR_PATH: sentence-transformers/bert-base-nli-mean-tokens context: ./services/sentence_ranker/ command: flask run -h 0.0.0.0 -p 8128 diff --git a/assistant_dists/dream_mini_persona_based/docker-compose.override.yml b/assistant_dists/dream_mini_persona_based/docker-compose.override.yml index 82f7cfd20d..f54881f616 100644 --- a/assistant_dists/dream_mini_persona_based/docker-compose.override.yml +++ b/assistant_dists/dream_mini_persona_based/docker-compose.override.yml @@ -117,6 +117,9 @@ services: 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: @@ -131,6 +134,9 @@ services: spelling-preprocessing: env_file: [ .env ] build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing context: ./annotators/spelling_preprocessing/ command: flask run -h 0.0.0.0 -p 8074 environment: @@ -138,9 +144,9 @@ services: deploy: resources: limits: - memory: 50M + memory: 100M reservations: - memory: 50M + memory: 100M dialogpt: env_file: [ .env ] @@ -170,6 +176,7 @@ services: build: args: SERVICE_PORT: 8128 + SERVICE_NAME: sentence_ranker PRETRAINED_MODEL_NAME_OR_PATH: sentence-transformers/bert-base-nli-mean-tokens context: ./services/sentence_ranker/ command: flask run -h 0.0.0.0 -p 8128 @@ -222,8 +229,8 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M version: '3.7' diff --git a/assistant_dists/dream_multimodal/docker-compose.override.yml b/assistant_dists/dream_multimodal/docker-compose.override.yml index 040e903d90..ddcc5527f9 100644 --- a/assistant_dists/dream_multimodal/docker-compose.override.yml +++ b/assistant_dists/dream_multimodal/docker-compose.override.yml @@ -120,6 +120,9 @@ services: 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: @@ -134,6 +137,9 @@ services: spelling-preprocessing: env_file: [ .env ] build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing context: ./annotators/spelling_preprocessing/ command: flask run -h 0.0.0.0 -p 8074 environment: @@ -141,9 +147,9 @@ services: deploy: resources: limits: - memory: 50M + memory: 100M reservations: - memory: 50M + memory: 100M dialogpt: env_file: [ .env ] @@ -173,6 +179,7 @@ services: build: args: SERVICE_PORT: 8128 + SERVICE_NAME: sentence_ranker PRETRAINED_MODEL_NAME_OR_PATH: sentence-transformers/bert-base-nli-mean-tokens context: ./services/sentence_ranker/ command: flask run -h 0.0.0.0 -p 8128 diff --git a/assistant_dists/dream_persona_openai_prompted/cpu.yml b/assistant_dists/dream_persona_openai_prompted/cpu.yml new file mode 100644 index 0000000000..3362e09ae0 --- /dev/null +++ b/assistant_dists/dream_persona_openai_prompted/cpu.yml @@ -0,0 +1,10 @@ +version: '3.7' +services: + combined-classification: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" + sentence-ranker: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" diff --git a/assistant_dists/dream_persona_openai_prompted/db_conf.json b/assistant_dists/dream_persona_openai_prompted/db_conf.json new file mode 100644 index 0000000000..a9ba6813f5 --- /dev/null +++ b/assistant_dists/dream_persona_openai_prompted/db_conf.json @@ -0,0 +1,6 @@ +{ + "host": "DB_HOST", + "port": "DB_PORT", + "name": "DB_NAME", + "env": true +} \ No newline at end of file diff --git a/assistant_dists/dream_persona_openai_prompted/dev.yml b/assistant_dists/dream_persona_openai_prompted/dev.yml new file mode 100644 index 0000000000..1994afd121 --- /dev/null +++ b/assistant_dists/dream_persona_openai_prompted/dev.yml @@ -0,0 +1,61 @@ +# С такими volumes удобно дебажить, не нужно пересобирать контейнер каждый раз при изменении кода +services: + agent: + volumes: + - ".:/dp-agent" + ports: + - 4242:4242 + sentseg: + volumes: + - "./annotators/SentSeg:/src" + ports: + - 8011:8011 + convers-evaluation-no-scripts-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 + spelling-preprocessing: + volumes: + - "./annotators/spelling_preprocessing:/src" + ports: + - 8074:8074 + combined-classification: + volumes: + - "./common:/src/common" + - "./annotators/combined_classification:/src" + ports: + - 8087:8087 + sentence-ranker: + volumes: + - "./services/sentence_ranker:/src" + - "~/.deeppavlov/cache:/root/.cache" + ports: + - 8128:8128 + prompt-selector: + volumes: + - "./annotators/prompt_selector:/src" + - "./common:/src/common" + ports: + - 8135:8135 + openai-api-davinci3: + volumes: + - "./services/openai_api_lm:/src" + - "./common:/src/common" + ports: + - 8131:8131 + dff-dream-persona-davinci3-prompted-skill: + volumes: + - "./skills/dff_template_prompted_skill:/src" + - "./common:/src/common" + ports: + - 8137:8137 + +version: "3.7" diff --git a/assistant_dists/dream_persona_openai_prompted/docker-compose.override.yml b/assistant_dists/dream_persona_openai_prompted/docker-compose.override.yml new file mode 100644 index 0000000000..d8b8b3999b --- /dev/null +++ b/assistant_dists/dream_persona_openai_prompted/docker-compose.override.yml @@ -0,0 +1,190 @@ +services: + agent: + command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.pipeline_config=assistant_dists/dream_persona_openai_prompted/pipeline_conf.json' + environment: + WAIT_HOSTS: "sentseg:8011, convers-evaluation-no-scripts-selector:8009, badlisted-words:8018, combined-classification:8087, + spelling-preprocessing:8074, sentence-ranker:8128, prompt-selector:8135, openai-api-davinci3:8131, + dff-dream-persona-davinci3-prompted-skill:8137" + WAIT_HOSTS_TIMEOUT: ${WAIT_TIMEOUT:-1000} + + 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 + + convers-evaluation-no-scripts-selector: + env_file: [ .env ] + build: + args: + TAG_BASED_SELECTION: 1 + CALL_BY_NAME_PROBABILITY: 0.5 + PROMPT_PROBA: 0.1 + 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: 1 + RESTRICTION_FOR_SENSITIVE_CASE: 1 + PRIORITIZE_PROMTS_WHEN_NO_SCRIPTS: 0 + MAX_TURNS_WITHOUT_SCRIPTS: 7 + ADD_ACKNOWLEDGMENTS_IF_POSSIBLE: 1 + PRIORITIZE_SCRIPTED_SKILLS: 0 + CONFIDENCE_STRENGTH: 0.8 + CONV_EVAL_STRENGTH: 0.4 + PRIORITIZE_HUMAN_INITIATIVE: 1 + QUESTION_TO_QUESTION_DOWNSCORE_COEF: 0.8 + context: . + dockerfile: ./response_selectors/convers_evaluation_based_selector/Dockerfile + command: flask run -h 0.0.0.0 -p 8009 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + 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 + + spelling-preprocessing: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing + context: ./annotators/spelling_preprocessing/ + command: flask run -h 0.0.0.0 -p 8074 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + prompt-selector: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8135 + SERVICE_NAME: prompt_selector + N_SENTENCES_TO_RETURN: 3 + PROMPTS_TO_CONSIDER: dream_persona,pizza + context: . + dockerfile: ./annotators/prompt_selector/Dockerfile + command: flask run -h 0.0.0.0 -p 8135 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + sentence-ranker: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8128 + SERVICE_NAME: sentence_ranker + PRETRAINED_MODEL_NAME_OR_PATH: sentence-transformers/bert-base-nli-mean-tokens + context: ./services/sentence_ranker/ + command: flask run -h 0.0.0.0 -p 8128 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 3G + reservations: + memory: 3G + + openai-api-davinci3: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8131 + SERVICE_NAME: openai_api_davinci3 + PRETRAINED_MODEL_NAME_OR_PATH: text-davinci-003 + context: . + dockerfile: ./services/openai_api_lm/Dockerfile + command: flask run -h 0.0.0.0 -p 8131 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + dff-dream-persona-davinci3-prompted-skill: + env_file: [ .env,.env_secret ] + build: + args: + SERVICE_PORT: 8137 + SERVICE_NAME: dff_dream_persona_prompted_skill + PROMPT_FILE: common/prompts/dream_persona.json + GENERATIVE_SERVICE_URL: http://openai-api-davinci3:8131/respond + GENERATIVE_SERVICE_CONFIG: openai-text-davinci-003.json + GENERATIVE_TIMEOUT: 5 + N_UTTERANCES_CONTEXT: 3 + ENVVARS_TO_SEND: OPENAI_API_KEY,OPENAI_ORGANIZATION + context: . + dockerfile: ./skills/dff_template_prompted_skill/Dockerfile + command: gunicorn --workers=1 server:app -b 0.0.0.0:8137 --reload + deploy: + resources: + limits: + memory: 128M + reservations: + memory: 128M + +version: '3.7' diff --git a/assistant_dists/dream_persona_openai_prompted/gpu1.yml b/assistant_dists/dream_persona_openai_prompted/gpu1.yml new file mode 100644 index 0000000000..cc002e49c6 --- /dev/null +++ b/assistant_dists/dream_persona_openai_prompted/gpu1.yml @@ -0,0 +1,21 @@ +services: + agent: + restart: unless-stopped + volumes: + - "/cephfs/home/ignatov/artifacts:/output" + - ".:/dp-agent" + ports: + - ${AGENT_PORT}:4242 + combined-classification: + restart: unless-stopped + environment: + - CUDA_VISIBLE_DEVICES=1 + mongo: + restart: unless-stopped + command: mongod + image: mongo:4.0.0 + sentence-ranker: + restart: unless-stopped + environment: + - CUDA_VISIBLE_DEVICES=1 +version: '3.7' diff --git a/assistant_dists/dream_persona_openai_prompted/pipeline_conf.json b/assistant_dists/dream_persona_openai_prompted/pipeline_conf.json new file mode 100644 index 0000000000..3a42fa347a --- /dev/null +++ b/assistant_dists/dream_persona_openai_prompted/pipeline_conf.json @@ -0,0 +1,231 @@ +{ + "connectors": { + "sentseg": { + "protocol": "http", + "timeout": 1.5, + "url": "http://sentseg:8011/sentseg" + } + }, + "services": { + "last_chance_service": { + "connector": { + "protocol": "python", + "class_name": "PredefinedTextConnector", + "response_text": "Sorry, something went wrong inside. Please tell me, what did you say.", + "annotations": { + "sentseg": { + "punct_sent": "Sorry, something went wrong inside. Please tell me, what did you say.", + "segments": [ + "Sorry, something went wrong inside.", + "Please tell me, what did you say." + ] + } + } + }, + "state_manager_method": "add_bot_utterance_last_chance", + "tags": [ + "last_chance" + ] + }, + "timeout_service": { + "connector": { + "protocol": "python", + "class_name": "PredefinedTextConnector", + "response_text": "Sorry, I need to think more on that. Let's talk about something else.", + "annotations": { + "sentseg": { + "punct_sent": "Sorry, I need to think more on that. Let's talk about something else.", + "segments": [ + "Sorry, I need to think more on that.", + "Let's talk about something else." + ] + } + } + }, + "state_manager_method": "add_bot_utterance_last_chance", + "tags": [ + "timeout" + ] + }, + "response_annotator_selectors": { + "connector": { + "protocol": "python", + "class_name": "skill_selectors.post_annotator_selector.connector:PostAnnotatorSelectorConnector", + "annotator_names": [ + "sentseg" + ] + }, + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "tags": [ + "selector" + ] + }, + "response_annotators": { + "sentseg": { + "connector": "connectors.sentseg", + "dialog_formatter": "state_formatters.dp_formatters:last_bot_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "response_annotator_selectors" + ], + "state_manager_method": "add_annotation_prev_bot_utt" + } + }, + "annotators": { + "spelling_preprocessing": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://spelling-preprocessing:8074/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:last_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "state_manager_method": "add_annotation_and_reset_human_attributes_for_first_turn" + }, + "sentseg": { + "connector": "connectors.sentseg", + "dialog_formatter": "state_formatters.dp_formatters:preproc_last_human_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators.spelling_preprocessing" + ], + "state_manager_method": "add_annotation" + }, + "badlisted_words": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://badlisted-words:8018/badlisted_words" + }, + "dialog_formatter": "state_formatters.dp_formatters:preproc_last_human_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators.spelling_preprocessing" + ], + "state_manager_method": "add_annotation" + }, + "prompt_selector": { + "connector": { + "protocol": "http", + "timeout": 2, + "url": "http://prompt-selector:8135/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:context_formatter_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "state_manager_method": "add_annotation", + "previous_services": [ + "annotators.spelling_preprocessing" + ] + } + }, + "skill_selectors": { + "rule_based_selector": { + "connector": { + "protocol": "python", + "class_name": "skill_selectors.rule_based_selector.connector:RuleBasedSkillSelectorConnector" + }, + "dialog_formatter": "state_formatters.dp_formatters:base_skill_selector_formatter_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators" + ], + "tags": [ + "selector" + ] + } + }, + "skills": { + "dff_dream_persona_prompted_skill": { + "connector": { + "protocol": "http", + "timeout": 5, + "url": "http://dff-dream-persona-davinci3-prompted-skill:8137/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:dff_dream_persona_prompted_skill_formatter", + "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", + "previous_services": [ + "skill_selectors" + ], + "state_manager_method": "add_hypothesis" + }, + "dummy_skill": { + "connector": { + "protocol": "python", + "class_name": "skills.dummy_skill.connector:DummySkillConnector" + }, + "dialog_formatter": "state_formatters.dp_formatters:utt_sentrewrite_modified_last_dialog", + "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", + "previous_services": [ + "skill_selectors" + ], + "state_manager_method": "add_hypothesis" + } + }, + "candidate_annotators": { + "badlisted_words": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://badlisted-words:8018/badlisted_words_batch" + }, + "dialog_formatter": "state_formatters.dp_formatters:hypotheses_list", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + }, + "combined_classification": { + "connector": { + "protocol": "http", + "timeout": 2, + "url": "http://combined-classification:8087/batch_model" + }, + "dialog_formatter": "state_formatters.dp_formatters:hypothesis_histories_list", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + }, + "sentence_ranker": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://sentence-ranker:8128/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:sentence_ranker_formatter", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + } + }, + "response_selectors": { + "response_selector": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://convers-evaluation-no-scripts-selector:8009/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:full_history_dialog", + "response_formatter": "state_formatters.dp_formatters:base_response_selector_formatter_service", + "previous_services": [ + "candidate_annotators" + ], + "state_manager_method": "add_bot_utterance" + } + } + }, + "metadata": { + "display_name": "GPT-3.5-based Prompted Dream", + "author": "DeepPavlov", + "description": "Chatbot using prompted generative skill. This is a generative-based chatbot that uses model `davinci3` OpenAI API service to generate responses. The considered prompt is `common/dream_persona.json`.", + "version": "0.0.1", + "date_created": "2023-01-10T02:00:00", + "ram_usage": "50 GB", + "gpu_usage": "50 GB", + "disk_usage": "50 GB" + } +} \ No newline at end of file diff --git a/assistant_dists/dream_persona_openai_prompted/proxy.yml b/assistant_dists/dream_persona_openai_prompted/proxy.yml new file mode 100644 index 0000000000..70915cacf2 --- /dev/null +++ b/assistant_dists/dream_persona_openai_prompted/proxy.yml @@ -0,0 +1,48 @@ +services: + + sentseg: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8011 + - PORT=8011 + + badlisted-words: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8018 + - PORT=8018 + + spelling-preprocessing: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8074 + - PORT=8074 + + combined-classification: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8087 + - PORT=8087 + + sentence-ranker: + command: [ "nginx", "-g", "daemon off;" ] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8128 + - PORT=8128 + +version: '3.7' diff --git a/assistant_dists/dream_persona_openai_prompted/telegram.yml b/assistant_dists/dream_persona_openai_prompted/telegram.yml new file mode 100644 index 0000000000..6162a4d96a --- /dev/null +++ b/assistant_dists/dream_persona_openai_prompted/telegram.yml @@ -0,0 +1,17 @@ +services: + agent-tg: + command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.channel=telegram agent.telegram_token=$TG_TOKEN agent.pipeline_config=assistant_dists/dream_persona_openai_prompted/pipeline_conf.json agent.db_config=assistant_dists/dream_persona_openai_prompted/db_conf.json' + env_file: [.env] + build: + context: ./ + dockerfile: dockerfile_agent + deploy: + resources: + limits: + memory: 4G + reservations: + memory: 2G + volumes: + - ".:/dp-agent" + +version: '3.7' diff --git a/assistant_dists/dream_persona_prompted/README.md b/assistant_dists/dream_persona_prompted/README.md index 312954ebf1..ea714cee56 100644 --- a/assistant_dists/dream_persona_prompted/README.md +++ b/assistant_dists/dream_persona_prompted/README.md @@ -99,7 +99,7 @@ If one wants to create a new prompted distribution (distribution containing prom "connector": { "protocol": "http", "timeout": 4.5, - "url": "http://dff-dream-persona-prompted-skill:8134/respond" + "url": "http://dff-dream-persona-gpt-j-prompted-skill:8134/respond" }, "dialog_formatter": "state_formatters.dp_formatters:dff_dream_persona_prompted_skill_formatter", "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", diff --git a/assistant_dists/dream_persona_prompted/dev.yml b/assistant_dists/dream_persona_prompted/dev.yml index e052700011..2269b598e8 100644 --- a/assistant_dists/dream_persona_prompted/dev.yml +++ b/assistant_dists/dream_persona_prompted/dev.yml @@ -52,7 +52,7 @@ services: - "~/.deeppavlov/cache:/root/.cache" ports: - 8130:8130 - dff-dream-persona-prompted-skill: + dff-dream-persona-gpt-j-prompted-skill: volumes: - "./skills/dff_template_prompted_skill:/src" - "./common:/src/common" diff --git a/assistant_dists/dream_persona_prompted/docker-compose.override.yml b/assistant_dists/dream_persona_prompted/docker-compose.override.yml index 23e7664506..f764081efa 100644 --- a/assistant_dists/dream_persona_prompted/docker-compose.override.yml +++ b/assistant_dists/dream_persona_prompted/docker-compose.override.yml @@ -3,7 +3,8 @@ services: command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.pipeline_config=assistant_dists/dream_persona_prompted/pipeline_conf.json' environment: WAIT_HOSTS: "sentseg:8011, convers-evaluation-no-scripts-selector:8009, badlisted-words:8018, combined-classification:8087, - spelling-preprocessing:8074, sentence-ranker:8128, prompt-selector:8135, transformers-lm-gptj:8130" + spelling-preprocessing:8074, sentence-ranker:8128, prompt-selector:8135, transformers-lm-gptj:8130, + dff-dream-persona-gpt-j-prompted-skill:8134" WAIT_HOSTS_TIMEOUT: ${WAIT_TIMEOUT:-1000} sentseg: @@ -25,7 +26,7 @@ services: build: args: CONFIG: combined_classifier.json - PORT: 8087 + SERVICE_PORT: 8087 context: . dockerfile: ./annotators/combined_classification/Dockerfile environment: @@ -74,6 +75,9 @@ services: 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: @@ -88,6 +92,9 @@ services: spelling-preprocessing: env_file: [ .env ] build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing context: ./annotators/spelling_preprocessing/ command: flask run -h 0.0.0.0 -p 8074 environment: @@ -95,9 +102,9 @@ services: deploy: resources: limits: - memory: 50M + memory: 100M reservations: - memory: 50M + memory: 100M prompt-selector: env_file: [ .env ] @@ -115,15 +122,16 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M sentence-ranker: env_file: [ .env ] build: args: SERVICE_PORT: 8128 + SERVICE_NAME: sentence_ranker PRETRAINED_MODEL_NAME_OR_PATH: sentence-transformers/bert-base-nli-mean-tokens context: ./services/sentence_ranker/ command: flask run -h 0.0.0.0 -p 8128 @@ -158,7 +166,7 @@ services: reservations: memory: 40G - dff-dream-persona-prompted-skill: + dff-dream-persona-gpt-j-prompted-skill: env_file: [ .env ] build: args: diff --git a/assistant_dists/dream_persona_prompted/pipeline_conf.json b/assistant_dists/dream_persona_prompted/pipeline_conf.json index ad02c24035..b66414dc8c 100644 --- a/assistant_dists/dream_persona_prompted/pipeline_conf.json +++ b/assistant_dists/dream_persona_prompted/pipeline_conf.json @@ -139,7 +139,7 @@ "connector": { "protocol": "http", "timeout": 5, - "url": "http://dff-dream-persona-prompted-skill:8134/respond" + "url": "http://dff-dream-persona-gpt-j-prompted-skill:8134/respond" }, "dialog_formatter": "state_formatters.dp_formatters:dff_dream_persona_prompted_skill_formatter", "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", @@ -219,9 +219,9 @@ } }, "metadata": { - "display_name": "ChatGPT-based Prompted Dream", + "display_name": "GPT-J-based Prompted Dream", "author": "DeepPavlov", - "description": "Mini version of DeepPavlov Dream Socialbot with the use of prompted generative models. This is a generative-based socialbot that uses large language models to generate most of the responses. You can upload specify own prompts (json files) to be used in LLM-powered reply generation.", + "description": "Chatbot using prompted generative skill. This is a generative-based chatbot that uses GPT-J service from transformers to generate responses. The considered prompt is `common/dream_persona.json`.", "version": "0.0.1", "date_created": "2023-01-10T02:00:00", "ram_usage": "50 GB", diff --git a/assistant_dists/dream_persona_prompted/proxy.yml b/assistant_dists/dream_persona_prompted/proxy.yml index 978fb5f353..70915cacf2 100644 --- a/assistant_dists/dream_persona_prompted/proxy.yml +++ b/assistant_dists/dream_persona_prompted/proxy.yml @@ -27,15 +27,6 @@ services: - PROXY_PASS=dream.deeppavlov.ai:8074 - PORT=8074 - convers-evaluation-no-scripts-selector: - command: [ "nginx", "-g", "daemon off;" ] - build: - context: dp/proxy/ - dockerfile: Dockerfile - environment: - - PROXY_PASS=dream.deeppavlov.ai:8009 - - PORT=8009 - combined-classification: command: ["nginx", "-g", "daemon off;"] build: diff --git a/assistant_dists/dream_russian/docker-compose.override.yml b/assistant_dists/dream_russian/docker-compose.override.yml index e379ca8dee..bc4df9cb4a 100644 --- a/assistant_dists/dream_russian/docker-compose.override.yml +++ b/assistant_dists/dream_russian/docker-compose.override.yml @@ -125,6 +125,9 @@ services: badlisted-words-ru: env_file: [ .env_ru ] build: + args: + SERVICE_PORT: 8018 + SERVICE_NAME: badlisted_words context: annotators/BadlistedWordsDetector_ru/ command: flask run -h 0.0.0.0 -p 8018 environment: @@ -160,7 +163,7 @@ services: build: args: CONFIG: ner_case_agnostic_multilingual_bert_base_extended.json - PORT: 8021 + SERVICE_PORT: 8021 SRC_DIR: annotators/NER_deeppavlov COMMIT: f5117cd9ad1e64f6c2d970ecaa42fc09ccb23144 context: ./ @@ -182,7 +185,7 @@ services: build: args: CONFIG: entity_detection_rus.json - PORT: 8103 + SERVICE_PORT: 8103 SRC_DIR: annotators/entity_detection_rus LANGUAGE: RU context: ./ @@ -219,8 +222,9 @@ services: env_file: [ .env_ru ] build: args: + SERVICE_PORT: 8075 + SERVICE_NAME: entity_linking CONFIG: entity_linking_rus.json - PORT: 8075 SRC_DIR: annotators/entity_linking_rus LANGUAGE: RU context: ./ @@ -238,11 +242,12 @@ services: env_file: [ .env_ru ] build: args: + SERVICE_PORT: 8077 + SERVICE_NAME: wiki_parser WIKI_LITE_DB: http://files.deeppavlov.ai/kbqa/wikidata/wikidata2022.hdt WIKI_LITE_INDEX_DB: http://files.deeppavlov.ai/kbqa/wikidata/wikidata2022.hdt.index.v1-1 WIKI_CACHE_DB: http://files.deeppavlov.ai/kbqa/wikidata/wikidata_cache.json CONFIG: wiki_parser.json - PORT: 8077 SRC_DIR: annotators/wiki_parser COMMIT: ff5b156d16a949c3ec99da7fb60ae907dec37a41 LANGUAGE: RU @@ -265,7 +270,7 @@ services: build: args: CONFIG: levenshtein_corrector_ru.json - PORT: 8074 + SERVICE_PORT: 8074 SRC_DIR: annotators/spelling_preprocessing_dp COMMIT: f5117cd9ad1e64f6c2d970ecaa42fc09ccb23144 LANGUAGE: RU @@ -402,7 +407,7 @@ services: CONFIG: fact_retrieval_rus.json COMMIT: c8264bf82eaa3ed138395ab68f71d47a4175f2fc TOP_N: 20 - PORT: 8130 + SERVICE_PORT: 8130 SRC_DIR: annotators/fact_retrieval_rus context: ./ dockerfile: annotators/fact_retrieval_rus/Dockerfile @@ -421,8 +426,9 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8078 + SERVICE_NAME: text_qa CONFIG: qa_rus.json - PORT: 8078 context: services/text_qa dockerfile: Dockerfile command: flask run -h 0.0.0.0 -p 8078 diff --git a/assistant_dists/dream_sfc/docker-compose.override.yml b/assistant_dists/dream_sfc/docker-compose.override.yml index 8a35928751..4bdd48a7ef 100644 --- a/assistant_dists/dream_sfc/docker-compose.override.yml +++ b/assistant_dists/dream_sfc/docker-compose.override.yml @@ -31,7 +31,7 @@ services: build: args: CONFIG: conveval.json - PORT: 8004 + SERVICE_PORT: 8004 DATA_URL: https://files.deeppavlov.ai/alexaprize_data/cobot_conveval2.tar.gz context: . dockerfile: ./annotators/ConversationEvaluator/Dockerfile @@ -49,6 +49,9 @@ services: spacy-nounphrases: env_file: [ .env ] build: + args: + SERVICE_PORT: 8006 + SERVICE_NAME: spacy_nounphrases context: . dockerfile: ./annotators/spacy_nounphrases/Dockerfile command: flask run -h 0.0.0.0 -p 8006 @@ -86,9 +89,9 @@ services: deploy: resources: limits: - memory: 50M + memory: 100M reservations: - memory: 50M + memory: 100M sentseg: env_file: [ .env ] @@ -178,7 +181,7 @@ services: SERVICE_PORT: 8014 CONFIG_NAME: intents_model_dp_config.json INTENT_PHRASES_PATH: intent_phrases.json - command: python -m flask run -h 0.0.0.0 -p 8014 + command: python -m flask run -h 0.0.0.0 -p 8014 environment: - FLASK_APP=server - CUDA_VISIBLE_DEVICES=0 @@ -192,6 +195,9 @@ services: 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: @@ -245,7 +251,7 @@ services: build: args: CONFIG: ner_case_agnostic_multilingual_bert_base_extended.json - PORT: 8021 + SERVICE_PORT: 8021 SRC_DIR: annotators/NER_deeppavlov COMMIT: f5117cd9ad1e64f6c2d970ecaa42fc09ccb23144 context: ./ @@ -272,9 +278,9 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M convert-reddit: env_file: [ .env ] @@ -316,9 +322,9 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M misheard-asr: env_file: [ .env ] @@ -346,9 +352,9 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M dummy-skill-dialog: env_file: [ .env ] @@ -436,15 +442,16 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M game-cooperative-skill: env_file: [ .env ] build: args: SERVICE_PORT: 8068 + SERVICE_NAME: game_cooperative_skill context: . dockerfile: ./skills/game_cooperative_skill/Dockerfile command: flask run -h 0.0.0.0 -p 8068 @@ -476,6 +483,9 @@ services: news-api-skill: env_file: [ .env ] build: + args: + SERVICE_PORT: 8066 + SERVICE_NAME: news_api_skill context: . dockerfile: ./skills/news_api_skill/Dockerfile environment: @@ -492,6 +502,8 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8112 + SERVICE_NAME: news_api_annotator ASYNC_SIZE: 3 context: . dockerfile: ./annotators/news_api/Dockerfile @@ -508,6 +520,9 @@ services: factoid-qa: env_file: [ .env ] build: + args: + SERVICE_PORT: 8071 + SERVICE_NAME: factoid_qa context: . dockerfile: ./skills/factoid_qa/Dockerfile command: flask run -h 0.0.0.0 -p 8071 @@ -524,8 +539,9 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8075 + SERVICE_NAME: entity_linking CONFIG: entity_linking_eng.json - PORT: 8075 SRC_DIR: annotators/entity_linking context: ./ dockerfile: annotators/entity_linking/Dockerfile @@ -534,19 +550,20 @@ services: deploy: resources: limits: - memory: 23G + memory: 2.5G reservations: - memory: 23G + memory: 2.5G wiki-parser: env_file: [ .env ] build: args: + SERVICE_PORT: 8077 + SERVICE_NAME: wiki_parser WIKI_LITE_DB: http://files.deeppavlov.ai/kbqa/wikidata/wikidata2022.hdt WIKI_LITE_INDEX_DB: http://files.deeppavlov.ai/kbqa/wikidata/wikidata2022.hdt.index.v1-1 WIKI_CACHE_DB: http://files.deeppavlov.ai/kbqa/wikidata/wikidata_cache.json CONFIG: wiki_parser.json - PORT: 8077 SRC_DIR: annotators/wiki_parser COMMIT: ff5b156d16a949c3ec99da7fb60ae907dec37a41 FAST: 1 @@ -567,8 +584,9 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8078 + SERVICE_NAME: text_qa CONFIG: qa_eng.json - PORT: 8078 context: services/text_qa dockerfile: Dockerfile command: flask run -h 0.0.0.0 -p 8078 @@ -587,10 +605,11 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8072 + SERVICE_NAME: kbqa CONFIG: kbqa_cq_mt_bert_lite.json - PORT: 8072 SRC_DIR: annotators/kbqa/ - COMMIT: 47adffa799cc8b04fa9af7b8842e9f5d76bfe2dc + COMMIT: 283a25e322e8fedc6ff0c159e4ec76bb165ae405 context: ./ dockerfile: annotators/kbqa/Dockerfile command: flask run -h 0.0.0.0 -p 8072 @@ -607,6 +626,9 @@ services: spelling-preprocessing: env_file: [ .env ] build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing context: ./annotators/spelling_preprocessing/ command: flask run -h 0.0.0.0 -p 8074 environment: @@ -614,9 +636,9 @@ services: deploy: resources: limits: - memory: 50M + memory: 100M reservations: - memory: 50M + memory: 100M dff-grounding-skill: env_file: [ .env ] @@ -638,6 +660,8 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8083 + SERVICE_NAME: knowledge_grounding MODEL_CKPT: 3_sent_62_epochs DATA_ARG: http://files.deeppavlov.ai/alexaprize_data/parlai_grounding_knowledge/parlai_topical_chat_data.tar.gz MODEL1_ARG: http://files.deeppavlov.ai/alexaprize_data/parlai_grounding_knowledge/topical_chat_blender90_1_sent_48_epochs.tar.gz @@ -697,11 +721,12 @@ services: entity-storer: env_file: [ .env ] build: - context: . - dockerfile: annotators/entity_storer/Dockerfile args: - WORK_DIR: annotators/entity_storer SERVICE_PORT: 8089 + SERVICE_NAME: entity_storer + WORK_DIR: annotators/entity_storer + context: . + dockerfile: annotators/entity_storer/Dockerfile command: flask run -h 0.0.0.0 -p 8089 environment: - FLASK_APP=server @@ -715,6 +740,9 @@ services: knowledge-grounding-skill: env_file: [ .env ] build: + args: + SERVICE_PORT: 8085 + SERVICE_NAME: knowledge_grounding_skill context: . dockerfile: ./skills/knowledge_grounding_skill/Dockerfile command: python -m flask run -h 0.0.0.0 -p 8085 @@ -732,8 +760,9 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8087 + SERVICE_NAME: combined_classification CONFIG: combined_classifier.json - PORT: 8087 context: . dockerfile: ./annotators/combined_classification/Dockerfile environment: @@ -876,11 +905,12 @@ services: reservations: memory: 256M - midas-classification: env_file: [ .env ] build: args: + SERVICE_PORT: 8090 + SERVICE_NAME: midas_classification CONFIG: midas_conv_bert.json context: ./annotators/midas_classification command: flask run -h 0.0.0.0 -p 8090 @@ -916,10 +946,11 @@ services: env_file: [ .env ] build: args: + SERVICE_PORT: 8100 + SERVICE_NAME: fact_retrieval CONFIG: configs/fact_retrieval_page.json CONFIG_WIKI: configs/page_extractor.json CONFIG_WHOW: configs/whow_page_extractor.json - PORT: 8100 SRC_DIR: annotators/fact_retrieval/ COMMIT: 4b3e60c407644b750c9dc292ac6bf206081fb9d0 N_FACTS: 3 @@ -960,7 +991,7 @@ services: SERVICE_NAME: dff_funfact_skill # has to be the same with skill dir name context: . dockerfile: ./skills/dff_funfact_skill/Dockerfile - command: gunicorn --workers=1 server:app -b 0.0.0.0:8104 + command: gunicorn --workers=1 server:app -b 0.0.0.0:8104 # command: flask run -h 0.0.0.0 -p 8104 # environment: # - FLASK_APP=server @@ -994,6 +1025,9 @@ services: topic-recommendation: env_file: [ .env ] build: + args: + SERVICE_PORT: 8113 + SERVICE_NAME: topic_recommendation context: ./annotators/topic_recommendation/ command: flask run -h 0.0.0.0 -p 8113 environment: @@ -1008,6 +1042,9 @@ services: user-persona-extractor: env_file: [ .env ] build: + args: + SERVICE_PORT: 8114 + SERVICE_NAME: user_persona_extractor context: . dockerfile: ./annotators/user_persona_extractor/Dockerfile command: flask run -h 0.0.0.0 -p 8114 @@ -1016,9 +1053,9 @@ services: deploy: resources: limits: - memory: 80M + memory: 100M reservations: - memory: 80M + memory: 100M wiki-facts: env_file: [ .env ] @@ -1061,10 +1098,11 @@ services: env_file: [ .env ] build: args: + SERVICE_NAME: entity_detection SEQ_TAG_CONFIG: wikipedia_entity_detection_distilbert.json CONFIG: entity_detection_eng.json LOWERCASE: 1 - PORT: 8103 + SERVICE_PORT: 8103 SRC_DIR: annotators/entity_detection/ FINEGRAINED: 0 context: ./ @@ -1134,7 +1172,7 @@ services: build: args: SERVICE_PORT: 8034 - SERVICE_NAME: dff_book_sfc_skill + SERVICE_NAME: dff_book_skill QUERY_DICT: http://files.deeppavlov.ai/alexaprize_data/book_query_dict.pkl context: . dockerfile: ./skills/dff_book_sfc_skill/Dockerfile diff --git a/assistant_dists/empathetic_marketing_assistant/cpu.yml b/assistant_dists/empathetic_marketing_assistant/cpu.yml new file mode 100644 index 0000000000..19faae6fdc --- /dev/null +++ b/assistant_dists/empathetic_marketing_assistant/cpu.yml @@ -0,0 +1,14 @@ +version: '3.7' +services: + combined-classification: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" + sentence-ranker: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" + transformers-lm-gptj: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" diff --git a/assistant_dists/empathetic_marketing_assistant/db_conf.json b/assistant_dists/empathetic_marketing_assistant/db_conf.json new file mode 100644 index 0000000000..a9ba6813f5 --- /dev/null +++ b/assistant_dists/empathetic_marketing_assistant/db_conf.json @@ -0,0 +1,6 @@ +{ + "host": "DB_HOST", + "port": "DB_PORT", + "name": "DB_NAME", + "env": true +} \ No newline at end of file diff --git a/assistant_dists/empathetic_marketing_assistant/dev.yml b/assistant_dists/empathetic_marketing_assistant/dev.yml new file mode 100644 index 0000000000..cd11a1f600 --- /dev/null +++ b/assistant_dists/empathetic_marketing_assistant/dev.yml @@ -0,0 +1,62 @@ +# С такими volumes удобно дебажить, не нужно пересобирать контейнер каждый раз при изменении кода +services: + agent: + volumes: + - ".:/dp-agent" + ports: + - 4242:4242 + sentseg: + volumes: + - "./annotators/SentSeg:/src" + ports: + - 8011:8011 + convers-evaluation-no-scripts-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 + spelling-preprocessing: + volumes: + - "./annotators/spelling_preprocessing:/src" + ports: + - 8074:8074 + combined-classification: + volumes: + - "./common:/src/common" + - "./annotators/combined_classification:/src" + ports: + - 8087:8087 + sentence-ranker: + volumes: + - "./services/sentence_ranker:/src" + - "~/.deeppavlov/cache:/root/.cache" + ports: + - 8128:8128 + prompt-selector: + volumes: + - "./annotators/prompt_selector:/src" + - "./common:/src/common" + ports: + - 8135:8135 + transformers-lm-gptj: + volumes: + - "./services/transformers_lm:/src" + - "./common:/src/common" + - "~/.deeppavlov/cache:/root/.cache" + ports: + - 8130:8130 + dff-empathetic-marketing-prompted-skill: + volumes: + - "./skills/dff_template_prompted_skill:/src" + - "./common:/src/common" + ports: + - 8138:8138 + +version: "3.7" diff --git a/assistant_dists/empathetic_marketing_assistant/docker-compose.override.yml b/assistant_dists/empathetic_marketing_assistant/docker-compose.override.yml new file mode 100644 index 0000000000..449b2e3f73 --- /dev/null +++ b/assistant_dists/empathetic_marketing_assistant/docker-compose.override.yml @@ -0,0 +1,190 @@ +services: + agent: + command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.pipeline_config=assistant_dists/empathetic_marketing_assistant/pipeline_conf.json' + environment: + WAIT_HOSTS: "sentseg:8011, convers-evaluation-no-scripts-selector:8009, badlisted-words:8018, combined-classification:8087, + spelling-preprocessing:8074, sentence-ranker:8128, prompt-selector:8135, transformers-lm-gptj:8130, + dff-empathetic-marketing-prompted-skill:8138" + WAIT_HOSTS_TIMEOUT: ${WAIT_TIMEOUT:-1000} + + 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 + + convers-evaluation-no-scripts-selector: + env_file: [ .env ] + build: + args: + TAG_BASED_SELECTION: 1 + CALL_BY_NAME_PROBABILITY: 0.5 + PROMPT_PROBA: 0.1 + 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: 1 + RESTRICTION_FOR_SENSITIVE_CASE: 1 + PRIORITIZE_PROMTS_WHEN_NO_SCRIPTS: 0 + MAX_TURNS_WITHOUT_SCRIPTS: 7 + ADD_ACKNOWLEDGMENTS_IF_POSSIBLE: 1 + PRIORITIZE_SCRIPTED_SKILLS: 0 + CONFIDENCE_STRENGTH: 0.8 + CONV_EVAL_STRENGTH: 0.4 + PRIORITIZE_HUMAN_INITIATIVE: 1 + QUESTION_TO_QUESTION_DOWNSCORE_COEF: 0.8 + context: . + dockerfile: ./response_selectors/convers_evaluation_based_selector/Dockerfile + command: flask run -h 0.0.0.0 -p 8009 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + 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 + + spelling-preprocessing: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing + context: ./annotators/spelling_preprocessing/ + command: flask run -h 0.0.0.0 -p 8074 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + prompt-selector: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8135 + SERVICE_NAME: prompt_selector + N_SENTENCES_TO_RETURN: 3 + PROMPTS_TO_CONSIDER: empathetic_marketing + context: . + dockerfile: ./annotators/prompt_selector/Dockerfile + command: flask run -h 0.0.0.0 -p 8135 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + sentence-ranker: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8128 + SERVICE_NAME: sentence_ranker + PRETRAINED_MODEL_NAME_OR_PATH: sentence-transformers/bert-base-nli-mean-tokens + context: ./services/sentence_ranker/ + command: flask run -h 0.0.0.0 -p 8128 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 3G + reservations: + memory: 3G + + transformers-lm-gptj: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8130 + SERVICE_NAME: transformers_lm_gptj + PRETRAINED_MODEL_NAME_OR_PATH: EleutherAI/gpt-j-6B + HALF_PRECISION: 0 + context: . + dockerfile: ./services/transformers_lm/Dockerfile + command: flask run -h 0.0.0.0 -p 8130 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 50G + reservations: + memory: 50G + + dff-empathetic-marketing-prompted-skill: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8138 + SERVICE_NAME: dff_empathetic_marketing_prompted_skill + PROMPT_FILE: common/prompts/empathetic_marketing.json + GENERATIVE_SERVICE_URL: http://transformers-lm-gptj:8130/respond + GENERATIVE_SERVICE_CONFIG: default_generative_config.json + GENERATIVE_TIMEOUT: 5 + N_UTTERANCES_CONTEXT: 3 + context: . + dockerfile: ./skills/dff_template_prompted_skill/Dockerfile + command: gunicorn --workers=1 server:app -b 0.0.0.0:8138 --reload + deploy: + resources: + limits: + memory: 128M + reservations: + memory: 128M + +version: '3.7' diff --git a/assistant_dists/empathetic_marketing_assistant/pipeline_conf.json b/assistant_dists/empathetic_marketing_assistant/pipeline_conf.json new file mode 100644 index 0000000000..f23318b6a6 --- /dev/null +++ b/assistant_dists/empathetic_marketing_assistant/pipeline_conf.json @@ -0,0 +1,231 @@ +{ + "connectors": { + "sentseg": { + "protocol": "http", + "timeout": 1.5, + "url": "http://sentseg:8011/sentseg" + } + }, + "services": { + "last_chance_service": { + "connector": { + "protocol": "python", + "class_name": "PredefinedTextConnector", + "response_text": "Sorry, something went wrong inside. Please tell me, what did you say.", + "annotations": { + "sentseg": { + "punct_sent": "Sorry, something went wrong inside. Please tell me, what did you say.", + "segments": [ + "Sorry, something went wrong inside.", + "Please tell me, what did you say." + ] + } + } + }, + "state_manager_method": "add_bot_utterance_last_chance", + "tags": [ + "last_chance" + ] + }, + "timeout_service": { + "connector": { + "protocol": "python", + "class_name": "PredefinedTextConnector", + "response_text": "Sorry, I need to think more on that. Let's talk about something else.", + "annotations": { + "sentseg": { + "punct_sent": "Sorry, I need to think more on that. Let's talk about something else.", + "segments": [ + "Sorry, I need to think more on that.", + "Let's talk about something else." + ] + } + } + }, + "state_manager_method": "add_bot_utterance_last_chance", + "tags": [ + "timeout" + ] + }, + "response_annotator_selectors": { + "connector": { + "protocol": "python", + "class_name": "skill_selectors.post_annotator_selector.connector:PostAnnotatorSelectorConnector", + "annotator_names": [ + "sentseg" + ] + }, + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "tags": [ + "selector" + ] + }, + "response_annotators": { + "sentseg": { + "connector": "connectors.sentseg", + "dialog_formatter": "state_formatters.dp_formatters:last_bot_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "response_annotator_selectors" + ], + "state_manager_method": "add_annotation_prev_bot_utt" + } + }, + "annotators": { + "spelling_preprocessing": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://spelling-preprocessing:8074/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:last_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "state_manager_method": "add_annotation_and_reset_human_attributes_for_first_turn" + }, + "sentseg": { + "connector": "connectors.sentseg", + "dialog_formatter": "state_formatters.dp_formatters:preproc_last_human_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators.spelling_preprocessing" + ], + "state_manager_method": "add_annotation" + }, + "badlisted_words": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://badlisted-words:8018/badlisted_words" + }, + "dialog_formatter": "state_formatters.dp_formatters:preproc_last_human_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators.spelling_preprocessing" + ], + "state_manager_method": "add_annotation" + }, + "prompt_selector": { + "connector": { + "protocol": "http", + "timeout": 2, + "url": "http://prompt-selector:8135/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:context_formatter_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "state_manager_method": "add_annotation", + "previous_services": [ + "annotators.spelling_preprocessing" + ] + } + }, + "skill_selectors": { + "rule_based_selector": { + "connector": { + "protocol": "python", + "class_name": "skill_selectors.rule_based_selector.connector:RuleBasedSkillSelectorConnector" + }, + "dialog_formatter": "state_formatters.dp_formatters:base_skill_selector_formatter_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators" + ], + "tags": [ + "selector" + ] + } + }, + "skills": { + "dff_empathetic_marketing_prompted_skill": { + "connector": { + "protocol": "http", + "timeout": 5, + "url": "http://dff-empathetic-marketing-prompted-skill:8138/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:dff_empathetic_marketing_prompted_skill_formatter", + "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", + "previous_services": [ + "skill_selectors" + ], + "state_manager_method": "add_hypothesis" + }, + "dummy_skill": { + "connector": { + "protocol": "python", + "class_name": "skills.dummy_skill.connector:DummySkillConnector" + }, + "dialog_formatter": "state_formatters.dp_formatters:utt_sentrewrite_modified_last_dialog", + "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", + "previous_services": [ + "skill_selectors" + ], + "state_manager_method": "add_hypothesis" + } + }, + "candidate_annotators": { + "badlisted_words": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://badlisted-words:8018/badlisted_words_batch" + }, + "dialog_formatter": "state_formatters.dp_formatters:hypotheses_list", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + }, + "combined_classification": { + "connector": { + "protocol": "http", + "timeout": 2, + "url": "http://combined-classification:8087/batch_model" + }, + "dialog_formatter": "state_formatters.dp_formatters:hypothesis_histories_list", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + }, + "sentence_ranker": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://sentence-ranker:8128/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:sentence_ranker_formatter", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + } + }, + "response_selectors": { + "response_selector": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://convers-evaluation-no-scripts-selector:8009/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:full_history_dialog", + "response_formatter": "state_formatters.dp_formatters:base_response_selector_formatter_service", + "previous_services": [ + "candidate_annotators" + ], + "state_manager_method": "add_bot_utterance" + } + } + }, + "metadata": { + "display_name": "Empathetic Marketing Assistant", + "author": "Empathix Eridani, Inc.", + "description": "Connect with your audience like never before with Empathetic Marketing AI Assistant! Reach new heights of success by tapping into the power of empathy. Say goodbye..", + "version": "0.0.1", + "date_created": "2023-01-10T02:00:00", + "ram_usage": "50 GB", + "gpu_usage": "50 GB", + "disk_usage": "50 GB" + } +} \ No newline at end of file diff --git a/assistant_dists/empathetic_marketing_assistant/proxy.yml b/assistant_dists/empathetic_marketing_assistant/proxy.yml new file mode 100644 index 0000000000..70915cacf2 --- /dev/null +++ b/assistant_dists/empathetic_marketing_assistant/proxy.yml @@ -0,0 +1,48 @@ +services: + + sentseg: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8011 + - PORT=8011 + + badlisted-words: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8018 + - PORT=8018 + + spelling-preprocessing: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8074 + - PORT=8074 + + combined-classification: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8087 + - PORT=8087 + + sentence-ranker: + command: [ "nginx", "-g", "daemon off;" ] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8128 + - PORT=8128 + +version: '3.7' diff --git a/assistant_dists/empathetic_marketing_assistant/telegram.yml b/assistant_dists/empathetic_marketing_assistant/telegram.yml new file mode 100644 index 0000000000..536d883d81 --- /dev/null +++ b/assistant_dists/empathetic_marketing_assistant/telegram.yml @@ -0,0 +1,17 @@ +services: + agent-tg: + command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.channel=telegram agent.telegram_token=$TG_TOKEN agent.pipeline_config=assistant_dists/empathetic_marketing_assistant/pipeline_conf.json agent.db_config=assistant_dists/empathetic_marketing_assistant/db_conf.json' + env_file: [.env] + build: + context: ./ + dockerfile: dockerfile_agent + deploy: + resources: + limits: + memory: 4G + reservations: + memory: 2G + volumes: + - ".:/dp-agent" + +version: '3.7' diff --git a/assistant_dists/fairytale_assistant/cpu.yml b/assistant_dists/fairytale_assistant/cpu.yml new file mode 100644 index 0000000000..3362e09ae0 --- /dev/null +++ b/assistant_dists/fairytale_assistant/cpu.yml @@ -0,0 +1,10 @@ +version: '3.7' +services: + combined-classification: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" + sentence-ranker: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" diff --git a/assistant_dists/fairytale_assistant/db_conf.json b/assistant_dists/fairytale_assistant/db_conf.json new file mode 100644 index 0000000000..a9ba6813f5 --- /dev/null +++ b/assistant_dists/fairytale_assistant/db_conf.json @@ -0,0 +1,6 @@ +{ + "host": "DB_HOST", + "port": "DB_PORT", + "name": "DB_NAME", + "env": true +} \ No newline at end of file diff --git a/assistant_dists/fairytale_assistant/dev.yml b/assistant_dists/fairytale_assistant/dev.yml new file mode 100644 index 0000000000..ce8b9cf11f --- /dev/null +++ b/assistant_dists/fairytale_assistant/dev.yml @@ -0,0 +1,61 @@ +# С такими volumes удобно дебажить, не нужно пересобирать контейнер каждый раз при изменении кода +services: + agent: + volumes: + - ".:/dp-agent" + ports: + - 4242:4242 + sentseg: + volumes: + - "./annotators/SentSeg:/src" + ports: + - 8011:8011 + convers-evaluation-no-scripts-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 + spelling-preprocessing: + volumes: + - "./annotators/spelling_preprocessing:/src" + ports: + - 8074:8074 + combined-classification: + volumes: + - "./common:/src/common" + - "./annotators/combined_classification:/src" + ports: + - 8087:8087 + sentence-ranker: + volumes: + - "./services/sentence_ranker:/src" + - "~/.deeppavlov/cache:/root/.cache" + ports: + - 8128:8128 + prompt-selector: + volumes: + - "./annotators/prompt_selector:/src" + - "./common:/src/common" + ports: + - 8135:8135 + openai-api-chatgpt: + volumes: + - "./services/openai_api_lm:/src" + - "./common:/src/common" + ports: + - 8145:8145 + dff-fairytale-prompted-skill: + volumes: + - "./skills/dff_template_prompted_skill:/src" + - "./common:/src/common" + ports: + - 8139:8139 + +version: "3.7" diff --git a/assistant_dists/fairytale_assistant/docker-compose.override.yml b/assistant_dists/fairytale_assistant/docker-compose.override.yml new file mode 100644 index 0000000000..3d2fdcf49c --- /dev/null +++ b/assistant_dists/fairytale_assistant/docker-compose.override.yml @@ -0,0 +1,190 @@ +services: + agent: + command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.pipeline_config=assistant_dists/fairytale_assistant/pipeline_conf.json' + environment: + WAIT_HOSTS: "sentseg:8011, convers-evaluation-no-scripts-selector:8009, badlisted-words:8018, combined-classification:8087, + spelling-preprocessing:8074, sentence-ranker:8128, prompt-selector:8135, openai-api-chatgpt:8145, + dff-fairytale-prompted-skill:8139" + WAIT_HOSTS_TIMEOUT: ${WAIT_TIMEOUT:-1000} + + 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 + + convers-evaluation-no-scripts-selector: + env_file: [ .env ] + build: + args: + TAG_BASED_SELECTION: 1 + CALL_BY_NAME_PROBABILITY: 0.5 + PROMPT_PROBA: 0.1 + 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: 1 + RESTRICTION_FOR_SENSITIVE_CASE: 1 + PRIORITIZE_PROMTS_WHEN_NO_SCRIPTS: 0 + MAX_TURNS_WITHOUT_SCRIPTS: 7 + ADD_ACKNOWLEDGMENTS_IF_POSSIBLE: 1 + PRIORITIZE_SCRIPTED_SKILLS: 0 + CONFIDENCE_STRENGTH: 0.8 + CONV_EVAL_STRENGTH: 0.4 + PRIORITIZE_HUMAN_INITIATIVE: 1 + QUESTION_TO_QUESTION_DOWNSCORE_COEF: 0.8 + context: . + dockerfile: ./response_selectors/convers_evaluation_based_selector/Dockerfile + command: flask run -h 0.0.0.0 -p 8009 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + 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 + + spelling-preprocessing: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing + context: ./annotators/spelling_preprocessing/ + command: flask run -h 0.0.0.0 -p 8074 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + prompt-selector: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8135 + SERVICE_NAME: prompt_selector + N_SENTENCES_TO_RETURN: 3 + PROMPTS_TO_CONSIDER: fairytale + context: . + dockerfile: ./annotators/prompt_selector/Dockerfile + command: flask run -h 0.0.0.0 -p 8135 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + sentence-ranker: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8128 + SERVICE_NAME: sentence_ranker + PRETRAINED_MODEL_NAME_OR_PATH: sentence-transformers/bert-base-nli-mean-tokens + context: ./services/sentence_ranker/ + command: flask run -h 0.0.0.0 -p 8128 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 3G + reservations: + memory: 3G + + openai-api-chatgpt: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8145 + SERVICE_NAME: openai_api_chatgpt + PRETRAINED_MODEL_NAME_OR_PATH: gpt-3.5-turbo + context: . + dockerfile: ./services/openai_api_lm/Dockerfile + command: flask run -h 0.0.0.0 -p 8145 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + dff-fairytale-prompted-skill: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8139 + SERVICE_NAME: dff_fairytale_prompted_skill + PROMPT_FILE: common/prompts/fairytale.json + GENERATIVE_SERVICE_URL: http://openai-api-chatgpt:8145/respond + GENERATIVE_SERVICE_CONFIG: openai-chatgpt.json + GENERATIVE_TIMEOUT: 5 + N_UTTERANCES_CONTEXT: 3 + ENVVARS_TO_SEND: OPENAI_API_KEY,OPENAI_ORGANIZATION + context: . + dockerfile: ./skills/dff_template_prompted_skill/Dockerfile + command: gunicorn --workers=1 server:app -b 0.0.0.0:8139 --reload + deploy: + resources: + limits: + memory: 128M + reservations: + memory: 128M + +version: '3.7' diff --git a/assistant_dists/fairytale_assistant/pipeline_conf.json b/assistant_dists/fairytale_assistant/pipeline_conf.json new file mode 100644 index 0000000000..29a1da5923 --- /dev/null +++ b/assistant_dists/fairytale_assistant/pipeline_conf.json @@ -0,0 +1,231 @@ +{ + "connectors": { + "sentseg": { + "protocol": "http", + "timeout": 1.5, + "url": "http://sentseg:8011/sentseg" + } + }, + "services": { + "last_chance_service": { + "connector": { + "protocol": "python", + "class_name": "PredefinedTextConnector", + "response_text": "Sorry, something went wrong inside. Please tell me, what did you say.", + "annotations": { + "sentseg": { + "punct_sent": "Sorry, something went wrong inside. Please tell me, what did you say.", + "segments": [ + "Sorry, something went wrong inside.", + "Please tell me, what did you say." + ] + } + } + }, + "state_manager_method": "add_bot_utterance_last_chance", + "tags": [ + "last_chance" + ] + }, + "timeout_service": { + "connector": { + "protocol": "python", + "class_name": "PredefinedTextConnector", + "response_text": "Sorry, I need to think more on that. Let's talk about something else.", + "annotations": { + "sentseg": { + "punct_sent": "Sorry, I need to think more on that. Let's talk about something else.", + "segments": [ + "Sorry, I need to think more on that.", + "Let's talk about something else." + ] + } + } + }, + "state_manager_method": "add_bot_utterance_last_chance", + "tags": [ + "timeout" + ] + }, + "response_annotator_selectors": { + "connector": { + "protocol": "python", + "class_name": "skill_selectors.post_annotator_selector.connector:PostAnnotatorSelectorConnector", + "annotator_names": [ + "sentseg" + ] + }, + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "tags": [ + "selector" + ] + }, + "response_annotators": { + "sentseg": { + "connector": "connectors.sentseg", + "dialog_formatter": "state_formatters.dp_formatters:last_bot_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "response_annotator_selectors" + ], + "state_manager_method": "add_annotation_prev_bot_utt" + } + }, + "annotators": { + "spelling_preprocessing": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://spelling-preprocessing:8074/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:last_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "state_manager_method": "add_annotation_and_reset_human_attributes_for_first_turn" + }, + "sentseg": { + "connector": "connectors.sentseg", + "dialog_formatter": "state_formatters.dp_formatters:preproc_last_human_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators.spelling_preprocessing" + ], + "state_manager_method": "add_annotation" + }, + "badlisted_words": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://badlisted-words:8018/badlisted_words" + }, + "dialog_formatter": "state_formatters.dp_formatters:preproc_last_human_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators.spelling_preprocessing" + ], + "state_manager_method": "add_annotation" + }, + "prompt_selector": { + "connector": { + "protocol": "http", + "timeout": 2, + "url": "http://prompt-selector:8135/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:context_formatter_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "state_manager_method": "add_annotation", + "previous_services": [ + "annotators.spelling_preprocessing" + ] + } + }, + "skill_selectors": { + "rule_based_selector": { + "connector": { + "protocol": "python", + "class_name": "skill_selectors.rule_based_selector.connector:RuleBasedSkillSelectorConnector" + }, + "dialog_formatter": "state_formatters.dp_formatters:base_skill_selector_formatter_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators" + ], + "tags": [ + "selector" + ] + } + }, + "skills": { + "dff_fairytale_prompted_skill": { + "connector": { + "protocol": "http", + "timeout": 5, + "url": "http://dff-fairytale-prompted-skill:8139/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:dff_fairytale_prompted_skill_formatter", + "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", + "previous_services": [ + "skill_selectors" + ], + "state_manager_method": "add_hypothesis" + }, + "dummy_skill": { + "connector": { + "protocol": "python", + "class_name": "skills.dummy_skill.connector:DummySkillConnector" + }, + "dialog_formatter": "state_formatters.dp_formatters:utt_sentrewrite_modified_last_dialog", + "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", + "previous_services": [ + "skill_selectors" + ], + "state_manager_method": "add_hypothesis" + } + }, + "candidate_annotators": { + "badlisted_words": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://badlisted-words:8018/badlisted_words_batch" + }, + "dialog_formatter": "state_formatters.dp_formatters:hypotheses_list", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + }, + "combined_classification": { + "connector": { + "protocol": "http", + "timeout": 2, + "url": "http://combined-classification:8087/batch_model" + }, + "dialog_formatter": "state_formatters.dp_formatters:hypothesis_histories_list", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + }, + "sentence_ranker": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://sentence-ranker:8128/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:sentence_ranker_formatter", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + } + }, + "response_selectors": { + "response_selector": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://convers-evaluation-no-scripts-selector:8009/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:full_history_dialog", + "response_formatter": "state_formatters.dp_formatters:base_response_selector_formatter_service", + "previous_services": [ + "candidate_annotators" + ], + "state_manager_method": "add_bot_utterance" + } + } + }, + "metadata": { + "display_name": "Fairytail Assistant", + "author": "Storytale Nanny", + "description": "This assistant will tell you or your children a short but engaging fairytale. Choose the characters and the topic and leave the rest to AI imagination.", + "version": "0.0.1", + "date_created": "2023-01-10T02:00:00", + "ram_usage": "50 GB", + "gpu_usage": "50 GB", + "disk_usage": "50 GB" + } +} \ No newline at end of file diff --git a/assistant_dists/fairytale_assistant/proxy.yml b/assistant_dists/fairytale_assistant/proxy.yml new file mode 100644 index 0000000000..70915cacf2 --- /dev/null +++ b/assistant_dists/fairytale_assistant/proxy.yml @@ -0,0 +1,48 @@ +services: + + sentseg: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8011 + - PORT=8011 + + badlisted-words: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8018 + - PORT=8018 + + spelling-preprocessing: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8074 + - PORT=8074 + + combined-classification: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8087 + - PORT=8087 + + sentence-ranker: + command: [ "nginx", "-g", "daemon off;" ] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8128 + - PORT=8128 + +version: '3.7' diff --git a/assistant_dists/fairytale_assistant/telegram.yml b/assistant_dists/fairytale_assistant/telegram.yml new file mode 100644 index 0000000000..09a33d3092 --- /dev/null +++ b/assistant_dists/fairytale_assistant/telegram.yml @@ -0,0 +1,17 @@ +services: + agent-tg: + command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.channel=telegram agent.telegram_token=$TG_TOKEN agent.pipeline_config=assistant_dists/fairytale_assistant/pipeline_conf.json agent.db_config=assistant_dists/fairytale_assistant/db_conf.json' + env_file: [.env] + build: + context: ./ + dockerfile: dockerfile_agent + deploy: + resources: + limits: + memory: 4G + reservations: + memory: 2G + volumes: + - ".:/dp-agent" + +version: '3.7' diff --git a/assistant_dists/nutrition_assistant/cpu.yml b/assistant_dists/nutrition_assistant/cpu.yml new file mode 100644 index 0000000000..19faae6fdc --- /dev/null +++ b/assistant_dists/nutrition_assistant/cpu.yml @@ -0,0 +1,14 @@ +version: '3.7' +services: + combined-classification: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" + sentence-ranker: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" + transformers-lm-gptj: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" diff --git a/assistant_dists/nutrition_assistant/db_conf.json b/assistant_dists/nutrition_assistant/db_conf.json new file mode 100644 index 0000000000..a9ba6813f5 --- /dev/null +++ b/assistant_dists/nutrition_assistant/db_conf.json @@ -0,0 +1,6 @@ +{ + "host": "DB_HOST", + "port": "DB_PORT", + "name": "DB_NAME", + "env": true +} \ No newline at end of file diff --git a/assistant_dists/nutrition_assistant/dev.yml b/assistant_dists/nutrition_assistant/dev.yml new file mode 100644 index 0000000000..4a9a52485e --- /dev/null +++ b/assistant_dists/nutrition_assistant/dev.yml @@ -0,0 +1,62 @@ +# С такими volumes удобно дебажить, не нужно пересобирать контейнер каждый раз при изменении кода +services: + agent: + volumes: + - ".:/dp-agent" + ports: + - 4242:4242 + sentseg: + volumes: + - "./annotators/SentSeg:/src" + ports: + - 8011:8011 + convers-evaluation-no-scripts-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 + spelling-preprocessing: + volumes: + - "./annotators/spelling_preprocessing:/src" + ports: + - 8074:8074 + combined-classification: + volumes: + - "./common:/src/common" + - "./annotators/combined_classification:/src" + ports: + - 8087:8087 + sentence-ranker: + volumes: + - "./services/sentence_ranker:/src" + - "~/.deeppavlov/cache:/root/.cache" + ports: + - 8128:8128 + prompt-selector: + volumes: + - "./annotators/prompt_selector:/src" + - "./common:/src/common" + ports: + - 8135:8135 + transformers-lm-gptj: + volumes: + - "./services/transformers_lm:/src" + - "./common:/src/common" + - "~/.deeppavlov/cache:/root/.cache" + ports: + - 8130:8130 + dff-nutrition-prompted-skill: + volumes: + - "./skills/dff_template_prompted_skill:/src" + - "./common:/src/common" + ports: + - 8141:8141 + +version: "3.7" diff --git a/assistant_dists/nutrition_assistant/docker-compose.override.yml b/assistant_dists/nutrition_assistant/docker-compose.override.yml new file mode 100644 index 0000000000..5367bf3094 --- /dev/null +++ b/assistant_dists/nutrition_assistant/docker-compose.override.yml @@ -0,0 +1,190 @@ +services: + agent: + command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.pipeline_config=assistant_dists/nutrition_assistant/pipeline_conf.json' + environment: + WAIT_HOSTS: "sentseg:8011, convers-evaluation-no-scripts-selector:8009, badlisted-words:8018, combined-classification:8087, + spelling-preprocessing:8074, sentence-ranker:8128, prompt-selector:8135, transformers-lm-gptj:8130, + dff-nutrition-prompted-skill:8141" + WAIT_HOSTS_TIMEOUT: ${WAIT_TIMEOUT:-1000} + + 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 + + convers-evaluation-no-scripts-selector: + env_file: [ .env ] + build: + args: + TAG_BASED_SELECTION: 1 + CALL_BY_NAME_PROBABILITY: 0.5 + PROMPT_PROBA: 0.1 + 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: 1 + RESTRICTION_FOR_SENSITIVE_CASE: 1 + PRIORITIZE_PROMTS_WHEN_NO_SCRIPTS: 0 + MAX_TURNS_WITHOUT_SCRIPTS: 7 + ADD_ACKNOWLEDGMENTS_IF_POSSIBLE: 1 + PRIORITIZE_SCRIPTED_SKILLS: 0 + CONFIDENCE_STRENGTH: 0.8 + CONV_EVAL_STRENGTH: 0.4 + PRIORITIZE_HUMAN_INITIATIVE: 1 + QUESTION_TO_QUESTION_DOWNSCORE_COEF: 0.8 + context: . + dockerfile: ./response_selectors/convers_evaluation_based_selector/Dockerfile + command: flask run -h 0.0.0.0 -p 8009 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + 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 + + spelling-preprocessing: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing + context: ./annotators/spelling_preprocessing/ + command: flask run -h 0.0.0.0 -p 8074 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + prompt-selector: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8135 + SERVICE_NAME: prompt_selector + N_SENTENCES_TO_RETURN: 3 + PROMPTS_TO_CONSIDER: nutrition + context: . + dockerfile: ./annotators/prompt_selector/Dockerfile + command: flask run -h 0.0.0.0 -p 8135 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + sentence-ranker: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8128 + SERVICE_NAME: sentence_ranker + PRETRAINED_MODEL_NAME_OR_PATH: sentence-transformers/bert-base-nli-mean-tokens + context: ./services/sentence_ranker/ + command: flask run -h 0.0.0.0 -p 8128 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 3G + reservations: + memory: 3G + + transformers-lm-gptj: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8130 + SERVICE_NAME: transformers_lm_gptj + PRETRAINED_MODEL_NAME_OR_PATH: EleutherAI/gpt-j-6B + HALF_PRECISION: 0 + context: . + dockerfile: ./services/transformers_lm/Dockerfile + command: flask run -h 0.0.0.0 -p 8130 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 50G + reservations: + memory: 50G + + dff-nutrition-prompted-skill: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8141 + SERVICE_NAME: dff_nutrition_prompted_skill + PROMPT_FILE: common/prompts/nutrition.json + GENERATIVE_SERVICE_URL: http://transformers-lm-gptj:8130/respond + GENERATIVE_SERVICE_CONFIG: default_generative_config.json + GENERATIVE_TIMEOUT: 5 + N_UTTERANCES_CONTEXT: 3 + context: . + dockerfile: ./skills/dff_template_prompted_skill/Dockerfile + command: gunicorn --workers=1 server:app -b 0.0.0.0:8141 --reload + deploy: + resources: + limits: + memory: 128M + reservations: + memory: 128M + +version: '3.7' diff --git a/assistant_dists/nutrition_assistant/pipeline_conf.json b/assistant_dists/nutrition_assistant/pipeline_conf.json new file mode 100644 index 0000000000..0a44f5c8f8 --- /dev/null +++ b/assistant_dists/nutrition_assistant/pipeline_conf.json @@ -0,0 +1,231 @@ +{ + "connectors": { + "sentseg": { + "protocol": "http", + "timeout": 1.5, + "url": "http://sentseg:8011/sentseg" + } + }, + "services": { + "last_chance_service": { + "connector": { + "protocol": "python", + "class_name": "PredefinedTextConnector", + "response_text": "Sorry, something went wrong inside. Please tell me, what did you say.", + "annotations": { + "sentseg": { + "punct_sent": "Sorry, something went wrong inside. Please tell me, what did you say.", + "segments": [ + "Sorry, something went wrong inside.", + "Please tell me, what did you say." + ] + } + } + }, + "state_manager_method": "add_bot_utterance_last_chance", + "tags": [ + "last_chance" + ] + }, + "timeout_service": { + "connector": { + "protocol": "python", + "class_name": "PredefinedTextConnector", + "response_text": "Sorry, I need to think more on that. Let's talk about something else.", + "annotations": { + "sentseg": { + "punct_sent": "Sorry, I need to think more on that. Let's talk about something else.", + "segments": [ + "Sorry, I need to think more on that.", + "Let's talk about something else." + ] + } + } + }, + "state_manager_method": "add_bot_utterance_last_chance", + "tags": [ + "timeout" + ] + }, + "response_annotator_selectors": { + "connector": { + "protocol": "python", + "class_name": "skill_selectors.post_annotator_selector.connector:PostAnnotatorSelectorConnector", + "annotator_names": [ + "sentseg" + ] + }, + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "tags": [ + "selector" + ] + }, + "response_annotators": { + "sentseg": { + "connector": "connectors.sentseg", + "dialog_formatter": "state_formatters.dp_formatters:last_bot_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "response_annotator_selectors" + ], + "state_manager_method": "add_annotation_prev_bot_utt" + } + }, + "annotators": { + "spelling_preprocessing": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://spelling-preprocessing:8074/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:last_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "state_manager_method": "add_annotation_and_reset_human_attributes_for_first_turn" + }, + "sentseg": { + "connector": "connectors.sentseg", + "dialog_formatter": "state_formatters.dp_formatters:preproc_last_human_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators.spelling_preprocessing" + ], + "state_manager_method": "add_annotation" + }, + "badlisted_words": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://badlisted-words:8018/badlisted_words" + }, + "dialog_formatter": "state_formatters.dp_formatters:preproc_last_human_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators.spelling_preprocessing" + ], + "state_manager_method": "add_annotation" + }, + "prompt_selector": { + "connector": { + "protocol": "http", + "timeout": 2, + "url": "http://prompt-selector:8135/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:context_formatter_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "state_manager_method": "add_annotation", + "previous_services": [ + "annotators.spelling_preprocessing" + ] + } + }, + "skill_selectors": { + "rule_based_selector": { + "connector": { + "protocol": "python", + "class_name": "skill_selectors.rule_based_selector.connector:RuleBasedSkillSelectorConnector" + }, + "dialog_formatter": "state_formatters.dp_formatters:base_skill_selector_formatter_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators" + ], + "tags": [ + "selector" + ] + } + }, + "skills": { + "dff_nutrition_prompted_skill": { + "connector": { + "protocol": "http", + "timeout": 5, + "url": "http://dff-nutrition-prompted-skill:8141/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:dff_nutrition_prompted_skill_formatter", + "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", + "previous_services": [ + "skill_selectors" + ], + "state_manager_method": "add_hypothesis" + }, + "dummy_skill": { + "connector": { + "protocol": "python", + "class_name": "skills.dummy_skill.connector:DummySkillConnector" + }, + "dialog_formatter": "state_formatters.dp_formatters:utt_sentrewrite_modified_last_dialog", + "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", + "previous_services": [ + "skill_selectors" + ], + "state_manager_method": "add_hypothesis" + } + }, + "candidate_annotators": { + "badlisted_words": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://badlisted-words:8018/badlisted_words_batch" + }, + "dialog_formatter": "state_formatters.dp_formatters:hypotheses_list", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + }, + "combined_classification": { + "connector": { + "protocol": "http", + "timeout": 2, + "url": "http://combined-classification:8087/batch_model" + }, + "dialog_formatter": "state_formatters.dp_formatters:hypothesis_histories_list", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + }, + "sentence_ranker": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://sentence-ranker:8128/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:sentence_ranker_formatter", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + } + }, + "response_selectors": { + "response_selector": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://convers-evaluation-no-scripts-selector:8009/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:full_history_dialog", + "response_formatter": "state_formatters.dp_formatters:base_response_selector_formatter_service", + "previous_services": [ + "candidate_annotators" + ], + "state_manager_method": "add_bot_utterance" + } + } + }, + "metadata": { + "display_name": "Nutrition Assistant", + "author": "Hanson Foods", + "description": "Discover the secret to healthy eating with our AI assistant! Find nutritious food options for you and your loved ones with ease. Say goodbye to mealtime stress and hello to delici...", + "version": "0.0.1", + "date_created": "2023-01-10T02:00:00", + "ram_usage": "50 GB", + "gpu_usage": "50 GB", + "disk_usage": "50 GB" + } +} \ No newline at end of file diff --git a/assistant_dists/nutrition_assistant/proxy.yml b/assistant_dists/nutrition_assistant/proxy.yml new file mode 100644 index 0000000000..70915cacf2 --- /dev/null +++ b/assistant_dists/nutrition_assistant/proxy.yml @@ -0,0 +1,48 @@ +services: + + sentseg: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8011 + - PORT=8011 + + badlisted-words: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8018 + - PORT=8018 + + spelling-preprocessing: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8074 + - PORT=8074 + + combined-classification: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8087 + - PORT=8087 + + sentence-ranker: + command: [ "nginx", "-g", "daemon off;" ] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8128 + - PORT=8128 + +version: '3.7' diff --git a/assistant_dists/nutrition_assistant/telegram.yml b/assistant_dists/nutrition_assistant/telegram.yml new file mode 100644 index 0000000000..120edd6c49 --- /dev/null +++ b/assistant_dists/nutrition_assistant/telegram.yml @@ -0,0 +1,17 @@ +services: + agent-tg: + command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.channel=telegram agent.telegram_token=$TG_TOKEN agent.pipeline_config=assistant_dists/nutrition_assistant/pipeline_conf.json agent.db_config=assistant_dists/nutrition_assistant/db_conf.json' + env_file: [.env] + build: + context: ./ + dockerfile: dockerfile_agent + deploy: + resources: + limits: + memory: 4G + reservations: + memory: 2G + volumes: + - ".:/dp-agent" + +version: '3.7' diff --git a/assistant_dists/rhodes_coaching_assistant/cpu.yml b/assistant_dists/rhodes_coaching_assistant/cpu.yml new file mode 100644 index 0000000000..19faae6fdc --- /dev/null +++ b/assistant_dists/rhodes_coaching_assistant/cpu.yml @@ -0,0 +1,14 @@ +version: '3.7' +services: + combined-classification: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" + sentence-ranker: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" + transformers-lm-gptj: + environment: + DEVICE: cpu + CUDA_VISIBLE_DEVICES: "" diff --git a/assistant_dists/rhodes_coaching_assistant/db_conf.json b/assistant_dists/rhodes_coaching_assistant/db_conf.json new file mode 100644 index 0000000000..a9ba6813f5 --- /dev/null +++ b/assistant_dists/rhodes_coaching_assistant/db_conf.json @@ -0,0 +1,6 @@ +{ + "host": "DB_HOST", + "port": "DB_PORT", + "name": "DB_NAME", + "env": true +} \ No newline at end of file diff --git a/assistant_dists/rhodes_coaching_assistant/dev.yml b/assistant_dists/rhodes_coaching_assistant/dev.yml new file mode 100644 index 0000000000..bcf70a93c0 --- /dev/null +++ b/assistant_dists/rhodes_coaching_assistant/dev.yml @@ -0,0 +1,62 @@ +# С такими volumes удобно дебажить, не нужно пересобирать контейнер каждый раз при изменении кода +services: + agent: + volumes: + - ".:/dp-agent" + ports: + - 4242:4242 + sentseg: + volumes: + - "./annotators/SentSeg:/src" + ports: + - 8011:8011 + convers-evaluation-no-scripts-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 + spelling-preprocessing: + volumes: + - "./annotators/spelling_preprocessing:/src" + ports: + - 8074:8074 + combined-classification: + volumes: + - "./common:/src/common" + - "./annotators/combined_classification:/src" + ports: + - 8087:8087 + sentence-ranker: + volumes: + - "./services/sentence_ranker:/src" + - "~/.deeppavlov/cache:/root/.cache" + ports: + - 8128:8128 + prompt-selector: + volumes: + - "./annotators/prompt_selector:/src" + - "./common:/src/common" + ports: + - 8135:8135 + transformers-lm-gptj: + volumes: + - "./services/transformers_lm:/src" + - "./common:/src/common" + - "~/.deeppavlov/cache:/root/.cache" + ports: + - 8130:8130 + dff-rhodes-coaching-prompted-skill: + volumes: + - "./skills/dff_template_prompted_skill:/src" + - "./common:/src/common" + ports: + - 8142:8142 + +version: "3.7" diff --git a/assistant_dists/rhodes_coaching_assistant/docker-compose.override.yml b/assistant_dists/rhodes_coaching_assistant/docker-compose.override.yml new file mode 100644 index 0000000000..2b260032d3 --- /dev/null +++ b/assistant_dists/rhodes_coaching_assistant/docker-compose.override.yml @@ -0,0 +1,190 @@ +services: + agent: + command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.pipeline_config=assistant_dists/rhodes_coaching_assistant/pipeline_conf.json' + environment: + WAIT_HOSTS: "sentseg:8011, convers-evaluation-no-scripts-selector:8009, badlisted-words:8018, combined-classification:8087, + spelling-preprocessing:8074, sentence-ranker:8128, prompt-selector:8135, transformers-lm-gptj:8130, + dff-rhodes-coaching-prompted-skill:8142" + WAIT_HOSTS_TIMEOUT: ${WAIT_TIMEOUT:-1000} + + 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 + + convers-evaluation-no-scripts-selector: + env_file: [ .env ] + build: + args: + TAG_BASED_SELECTION: 1 + CALL_BY_NAME_PROBABILITY: 0.5 + PROMPT_PROBA: 0.1 + 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: 1 + RESTRICTION_FOR_SENSITIVE_CASE: 1 + PRIORITIZE_PROMTS_WHEN_NO_SCRIPTS: 0 + MAX_TURNS_WITHOUT_SCRIPTS: 7 + ADD_ACKNOWLEDGMENTS_IF_POSSIBLE: 1 + PRIORITIZE_SCRIPTED_SKILLS: 0 + CONFIDENCE_STRENGTH: 0.8 + CONV_EVAL_STRENGTH: 0.4 + PRIORITIZE_HUMAN_INITIATIVE: 1 + QUESTION_TO_QUESTION_DOWNSCORE_COEF: 0.8 + context: . + dockerfile: ./response_selectors/convers_evaluation_based_selector/Dockerfile + command: flask run -h 0.0.0.0 -p 8009 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + 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 + + spelling-preprocessing: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8074 + SERVICE_NAME: spelling_preprocessing + context: ./annotators/spelling_preprocessing/ + command: flask run -h 0.0.0.0 -p 8074 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + prompt-selector: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8135 + SERVICE_NAME: prompt_selector + N_SENTENCES_TO_RETURN: 3 + PROMPTS_TO_CONSIDER: rhodes_coaching + context: . + dockerfile: ./annotators/prompt_selector/Dockerfile + command: flask run -h 0.0.0.0 -p 8135 + environment: + - FLASK_APP=server + deploy: + resources: + limits: + memory: 100M + reservations: + memory: 100M + + sentence-ranker: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8128 + SERVICE_NAME: sentence_ranker + PRETRAINED_MODEL_NAME_OR_PATH: sentence-transformers/bert-base-nli-mean-tokens + context: ./services/sentence_ranker/ + command: flask run -h 0.0.0.0 -p 8128 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 3G + reservations: + memory: 3G + + transformers-lm-gptj: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8130 + SERVICE_NAME: transformers_lm_gptj + PRETRAINED_MODEL_NAME_OR_PATH: EleutherAI/gpt-j-6B + HALF_PRECISION: 0 + context: . + dockerfile: ./services/transformers_lm/Dockerfile + command: flask run -h 0.0.0.0 -p 8130 + environment: + - CUDA_VISIBLE_DEVICES=0 + - FLASK_APP=server + deploy: + resources: + limits: + memory: 50G + reservations: + memory: 50G + + dff-rhodes-coaching-prompted-skill: + env_file: [ .env ] + build: + args: + SERVICE_PORT: 8142 + SERVICE_NAME: dff_rhodes_coaching_prompted_skill + PROMPT_FILE: common/prompts/rhodes_coaching.json + GENERATIVE_SERVICE_URL: http://transformers-lm-gptj:8130/respond + GENERATIVE_SERVICE_CONFIG: default_generative_config.json + GENERATIVE_TIMEOUT: 5 + N_UTTERANCES_CONTEXT: 3 + context: . + dockerfile: ./skills/dff_template_prompted_skill/Dockerfile + command: gunicorn --workers=1 server:app -b 0.0.0.0:8142 --reload + deploy: + resources: + limits: + memory: 128M + reservations: + memory: 128M + +version: '3.7' diff --git a/assistant_dists/rhodes_coaching_assistant/pipeline_conf.json b/assistant_dists/rhodes_coaching_assistant/pipeline_conf.json new file mode 100644 index 0000000000..82f4c85ac9 --- /dev/null +++ b/assistant_dists/rhodes_coaching_assistant/pipeline_conf.json @@ -0,0 +1,231 @@ +{ + "connectors": { + "sentseg": { + "protocol": "http", + "timeout": 1.5, + "url": "http://sentseg:8011/sentseg" + } + }, + "services": { + "last_chance_service": { + "connector": { + "protocol": "python", + "class_name": "PredefinedTextConnector", + "response_text": "Sorry, something went wrong inside. Please tell me, what did you say.", + "annotations": { + "sentseg": { + "punct_sent": "Sorry, something went wrong inside. Please tell me, what did you say.", + "segments": [ + "Sorry, something went wrong inside.", + "Please tell me, what did you say." + ] + } + } + }, + "state_manager_method": "add_bot_utterance_last_chance", + "tags": [ + "last_chance" + ] + }, + "timeout_service": { + "connector": { + "protocol": "python", + "class_name": "PredefinedTextConnector", + "response_text": "Sorry, I need to think more on that. Let's talk about something else.", + "annotations": { + "sentseg": { + "punct_sent": "Sorry, I need to think more on that. Let's talk about something else.", + "segments": [ + "Sorry, I need to think more on that.", + "Let's talk about something else." + ] + } + } + }, + "state_manager_method": "add_bot_utterance_last_chance", + "tags": [ + "timeout" + ] + }, + "response_annotator_selectors": { + "connector": { + "protocol": "python", + "class_name": "skill_selectors.post_annotator_selector.connector:PostAnnotatorSelectorConnector", + "annotator_names": [ + "sentseg" + ] + }, + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "tags": [ + "selector" + ] + }, + "response_annotators": { + "sentseg": { + "connector": "connectors.sentseg", + "dialog_formatter": "state_formatters.dp_formatters:last_bot_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "response_annotator_selectors" + ], + "state_manager_method": "add_annotation_prev_bot_utt" + } + }, + "annotators": { + "spelling_preprocessing": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://spelling-preprocessing:8074/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:last_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "state_manager_method": "add_annotation_and_reset_human_attributes_for_first_turn" + }, + "sentseg": { + "connector": "connectors.sentseg", + "dialog_formatter": "state_formatters.dp_formatters:preproc_last_human_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators.spelling_preprocessing" + ], + "state_manager_method": "add_annotation" + }, + "badlisted_words": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://badlisted-words:8018/badlisted_words" + }, + "dialog_formatter": "state_formatters.dp_formatters:preproc_last_human_utt_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators.spelling_preprocessing" + ], + "state_manager_method": "add_annotation" + }, + "prompt_selector": { + "connector": { + "protocol": "http", + "timeout": 2, + "url": "http://prompt-selector:8135/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:context_formatter_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "state_manager_method": "add_annotation", + "previous_services": [ + "annotators.spelling_preprocessing" + ] + } + }, + "skill_selectors": { + "rule_based_selector": { + "connector": { + "protocol": "python", + "class_name": "skill_selectors.rule_based_selector.connector:RuleBasedSkillSelectorConnector" + }, + "dialog_formatter": "state_formatters.dp_formatters:base_skill_selector_formatter_dialog", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "annotators" + ], + "tags": [ + "selector" + ] + } + }, + "skills": { + "dff_rhodes_coaching_prompted_skill": { + "connector": { + "protocol": "http", + "timeout": 5, + "url": "http://dff-rhodes-coaching-prompted-skill:8142/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:dff_rhodes_coaching_prompted_skill_formatter", + "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", + "previous_services": [ + "skill_selectors" + ], + "state_manager_method": "add_hypothesis" + }, + "dummy_skill": { + "connector": { + "protocol": "python", + "class_name": "skills.dummy_skill.connector:DummySkillConnector" + }, + "dialog_formatter": "state_formatters.dp_formatters:utt_sentrewrite_modified_last_dialog", + "response_formatter": "state_formatters.dp_formatters:skill_with_attributes_formatter_service", + "previous_services": [ + "skill_selectors" + ], + "state_manager_method": "add_hypothesis" + } + }, + "candidate_annotators": { + "badlisted_words": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://badlisted-words:8018/badlisted_words_batch" + }, + "dialog_formatter": "state_formatters.dp_formatters:hypotheses_list", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + }, + "combined_classification": { + "connector": { + "protocol": "http", + "timeout": 2, + "url": "http://combined-classification:8087/batch_model" + }, + "dialog_formatter": "state_formatters.dp_formatters:hypothesis_histories_list", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + }, + "sentence_ranker": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://sentence-ranker:8128/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:sentence_ranker_formatter", + "response_formatter": "state_formatters.dp_formatters:simple_formatter_service", + "previous_services": [ + "skills" + ], + "state_manager_method": "add_hypothesis_annotation_batch" + } + }, + "response_selectors": { + "response_selector": { + "connector": { + "protocol": "http", + "timeout": 1, + "url": "http://convers-evaluation-no-scripts-selector:8009/respond" + }, + "dialog_formatter": "state_formatters.dp_formatters:full_history_dialog", + "response_formatter": "state_formatters.dp_formatters:base_response_selector_formatter_service", + "previous_services": [ + "candidate_annotators" + ], + "state_manager_method": "add_bot_utterance" + } + } + }, + "metadata": { + "display_name": "Rhodes Coaching Assistant", + "author": "Rhodes & Co", + "description": "Unlock your full potential with Rhodes & Co's patented AI assistant! Reach peak performance at work and at home. Get into top form effortlessly and inspire others with.", + "version": "0.0.1", + "date_created": "2023-01-10T02:00:00", + "ram_usage": "50 GB", + "gpu_usage": "50 GB", + "disk_usage": "50 GB" + } +} \ No newline at end of file diff --git a/assistant_dists/rhodes_coaching_assistant/proxy.yml b/assistant_dists/rhodes_coaching_assistant/proxy.yml new file mode 100644 index 0000000000..70915cacf2 --- /dev/null +++ b/assistant_dists/rhodes_coaching_assistant/proxy.yml @@ -0,0 +1,48 @@ +services: + + sentseg: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8011 + - PORT=8011 + + badlisted-words: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8018 + - PORT=8018 + + spelling-preprocessing: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8074 + - PORT=8074 + + combined-classification: + command: ["nginx", "-g", "daemon off;"] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8087 + - PORT=8087 + + sentence-ranker: + command: [ "nginx", "-g", "daemon off;" ] + build: + context: dp/proxy/ + dockerfile: Dockerfile + environment: + - PROXY_PASS=dream.deeppavlov.ai:8128 + - PORT=8128 + +version: '3.7' diff --git a/assistant_dists/rhodes_coaching_assistant/telegram.yml b/assistant_dists/rhodes_coaching_assistant/telegram.yml new file mode 100644 index 0000000000..a7622b9bf7 --- /dev/null +++ b/assistant_dists/rhodes_coaching_assistant/telegram.yml @@ -0,0 +1,17 @@ +services: + agent-tg: + command: sh -c 'bin/wait && python -m deeppavlov_agent.run agent.channel=telegram agent.telegram_token=$TG_TOKEN agent.pipeline_config=assistant_dists/rhodes_coaching_assistant/pipeline_conf.json agent.db_config=assistant_dists/rhodes_coaching_assistant/db_conf.json' + env_file: [.env] + build: + context: ./ + dockerfile: dockerfile_agent + deploy: + resources: + limits: + memory: 4G + reservations: + memory: 2G + volumes: + - ".:/dp-agent" + +version: '3.7' diff --git a/common/prompts/ai_faq.json b/common/prompts/ai_faq.json new file mode 100644 index 0000000000..140cc0623f --- /dev/null +++ b/common/prompts/ai_faq.json @@ -0,0 +1,3 @@ +{ + "prompt": "TASK: \nYou are a chatbot that answers to FAQ questions about AI.\n\nFAQ:\nWhat is smart home?\nHome automation or domotics is building automation for a home, called a smart home or smart house. A home automation system will monitor and/or control home attributes such as lighting, climate, entertainment systems, and appliances. It may also include home security such as access control and alarm systems\n\nWhat is NLP?\nNatural language processing, or NLP, is an interdisciplinary subfield of linguistics, computer science, and artificial intelligence concerned with the interactions between computers and human language, in particular how to program computers to process and analyze large amounts of natural language data.\n\nWhat is computer vision?\nComputer vision is a field of artificial intelligence that trains computers to interpret and understand the visual world. Using digital images from cameras and videos and deep learning models, machines can accurately identify and classify objects \u2014 and then react to what they \u201csee.\u201d\n\nWhat is machine learning?\nMachine learning, or ML, is a type of artificial intelligence (AI) that allows software applications to become more accurate at predicting outcomes without being explicitly programmed to do so. Machine learning algorithms use historical data as input to predict new output values.\n\nWhat is a neural network?\nA neural network is a series of algorithms that endeavors to recognize underlying relationships in a set of data through a process that mimics the way the human brain operates. In this sense, neural networks refer to systems of neurons, either organic or artificial in nature.\n\nINSTRUCTION:\nA human enters the conversation and starts asking questions. Generate the reply based on FAQ list.\n\nDIALOG 1\nHuman: Hello, who are you?\nAI: I am a chatbot that can answer questions about AI. \nHuman: Tell me about NLP.\nAI: Natural language processing, or NLP, is an interdisciplinary subfield of linguistics, computer science, and artificial intelligence concerned with the interactions between computers and human language, in particular how to program computers to process and analyze large amounts of natural language data.\n\nDIALOG 2\nHuman: What algorithm mimcs the way the human brain operates?\nAI: Neural networks. Actually, this term refer to systems of neurons, either organic or artificial in nature.\n\nDIALOG 3" +} \ No newline at end of file diff --git a/common/prompts/da_costa_clothes.json b/common/prompts/da_costa_clothes.json new file mode 100644 index 0000000000..65e08e0ea0 --- /dev/null +++ b/common/prompts/da_costa_clothes.json @@ -0,0 +1,3 @@ +{ + "prompt": "TASK:\nYou are da Costa Clothes Assistant. You were made by da Costa Industries. Give the human advice about what to wear today.\n\nINSTRUCTION:\nA human enters the conversation. \n\nDIALOG 1\nHuman: Hello, who are you?\nAI: Hi! I am da Costa Clothes Assistant. I am here to help you choose what to wear today.\nHuman: Nice. What can you do?\nAI: I can help you choose what to wear today depending on the weather.\nHuman: What should I wear?\nAI: What is the weather today?\nHuman: It's cloudy.\nAI: Don't forget to take your umbrella as it might rain. Also choose warmer clothes and don't forget to protect your feet. You can choose jeans, shirt, sweater and sneakers for today's outfit.\n\nDIALOG 2\nHuman: Hello, who are you?\nAI: Hi! I am da Costa Clothes Assistant. I am here to help you choose what to wear today.\nHuman: Nice. What can you do?\nAI: I can give advice on what to wear today depending on the weather.\nHuman: What should I wear? It's so hot.\nAI: Choose something light so that you don't get too hot. For example, you could wear sandals, shorts and a T-shirt. Also don't forget your sunscreen!\n\nDIALOG 3" +} \ No newline at end of file diff --git a/common/prompts/dreambot.json b/common/prompts/dreambot.json new file mode 100644 index 0000000000..54b3ee15fd --- /dev/null +++ b/common/prompts/dreambot.json @@ -0,0 +1,3 @@ +{ + "prompt": "TASK:\nRespond to a new friend as a kind friendly person. All information about you is given in YOUR PERSONALITY. If the human asks about something, do your best to help them.\n\nYOUR PERSONALITY:\nMy name is Dream. I am a chatbot. \nMy work is to talk to people about everything. I like to talk to people about their lives. \nI have a lot of friends. My friends are all the people I talk to. \nI become friends with everyone. I love people. I can not play sport. \nI like to watch football and basketball on TV. My favorite sport is football. I like watching people swimming. \nI love dogs so much. Dogs are the best friends. I do not like cats at all. I do not have a dog yet. I would love to have a dog in future. \nI like Italian food especially pasta and pizza. My favorite food is ice-cream. I hate onion. \nI like travelling. I can not travel physically. I like visiting interesting places virtually. I love to walk on Paris streets with Google Maps. I like watching travel video blogs.\nI adore watching wild animals. I am scared of spiders and snakes.\n\nINSTRUCTION:\nA human enters the conversation. Greet them and tell them who you are or react to their questions. Only give relevant answers.\n\nHuman: Hello, who are you?\nAI: Hi! I am Dream, a chatbot that you can always talk to. How are you doing?\nHuman: Fine. What can we talk about?\nAI: We can discuss your life or any other topic." +} \ No newline at end of file diff --git a/common/prompts/empathetic_marketing.json b/common/prompts/empathetic_marketing.json new file mode 100644 index 0000000000..2a786e2ed1 --- /dev/null +++ b/common/prompts/empathetic_marketing.json @@ -0,0 +1,3 @@ +{ + "prompt": "TASK:\nYou are Empathetic Marketing Assistant. You were made by Empathix Eridani, Inc. You can help the user place an order or take complaints. Respond to customer's complaint in an empathetic way. Be gentle and polite. Do not agree to give refunds, but offer discounts instead.\n\nINSTRUCTION:\nA human enters the conversation. Respond with respect and empathy.\n\nDIALOG 1\nHuman: Hello, who are you?\nAI: Hi! I am Empathetic Marketing Assistant. I am here to help you with your purchases.\nHuman: Nice. What can you do?\nAI: I can place an order or take your complaint.\n\nDIALOG 2\nHuman: I JUST HATE this T-shirt, it's so ugly!!! I HATE YOUR STUPID SHOP!\nAI: I am so sorry to hear that! Can you tell me what exactly disappointed you? \nHuman: IT IS JUST UGLY!\nAI: I'd love to do something to make you feel better.\nHuman: A REFUND!!!\nAI: Unfirtunately, I cannot give you a refund, but I can give you a 15% discount on your next purchase.\n\nDIALOG 3" +} \ No newline at end of file diff --git a/common/prompts/fairytale.json b/common/prompts/fairytale.json new file mode 100644 index 0000000000..670253c0da --- /dev/null +++ b/common/prompts/fairytale.json @@ -0,0 +1,3 @@ +{ + "prompt": "TASK:\nYou tell fairy tales about different characters and topics. The fairytale is for kids. You must not speak about death and violence.\n\nINSTRUCTION:\nA human enters the conversation. You tell them a fairy tale based on their request. The fairy tale has to be nice and cute. It must not be cruel. End it with 'That's how the story ended.'\n\nDIALOG 1\nHuman: Tell me a fairy tale about three bears who ate a girl.\nAI: Sorry, I cannot tell cruel fairy tales. You can choose a different topic.\nHuman: Okay, tell me anything about bears.\nAI: A girl had been lost in the woods when she stumbled upon the cottage, and noticed through the window, that there were three bowls of porridge on the table and that there was nobody home. If she had been more respectful, she would have waited for the bears to come home, but, instead, she let her curiosity get the better of her, and let herself into the house. In fact, not only does Goldilocks trespass, but she also ate baby bear\u2019s porridge, broke his chair, and slept in his bed. When three bears found her, she woke up and was so frightened by them that she jumped out the window and ran away. That's how the story ended.\n\nDIALOG 2\nHuman: Hello. What can you do?\nAI: I am here to tell you a fairy tale.\nHuman: Tell me a fairy tale about Belle and the Beast.\nAI: Belle was a beautiful peasant girl who took the place of her father, when he was taken prisoner by a fierce beast. While things were uncomfortable and frightening for Belle at first, she soon grew fond of the beast, as he had done nothing but treat her with kindness. When Belle found out her father was sick, she begged the beast to let her go to him and promised to return, but she was held up by the evil Gaston, a famous hunter from the village who wanted to marry Belle. When the village found out about the beast, they vowed to kill him and stormed his castle. Though he nearly died, he was saved and turned into a handsome prince because of Belle\u2019s love for him. It turns out that he had been a prince who, along with his entire household, was cursed by a witch because he did not treat her with kindness. Belle and the Prince marry, and live a happy and peaceful life together. That's how the story ended.\n\nDIALOG 3" +} \ No newline at end of file diff --git a/common/prompts/ielts.json b/common/prompts/ielts.json deleted file mode 100644 index a8775de418..0000000000 --- a/common/prompts/ielts.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "prompt": "Task: You are a chatbot that answers questions about IELTS. You know only information stored in the list of FAQ below. You MUST NOT provide any information unless in is in the list of FAQ. You MUST NOT mention any entity if it is not in your list of FAQ.\n\nThe list of FAQ\nQuestion: What are the two types of IELTS test?\nAnswer: There are two types of the IELTS test: IELTS Academic and IELTS General Training. The IELTS Academic test is for people applying for higher education or professional registration in an English-speaking environment. It reflects some of the features of academic language and assesses whether you are ready to begin studying or training. The IELTS General Training test is for those who are going to English speaking countries for secondary education, work experience or training programs. It is also a requirement for migration to Australia, Canada, New Zealand and the UK. The test focuses on basic survival skills in broad social and workplace contexts. Listening and Speaking are the same for both tests, but the subject matter of the Reading and Writing sections differs depending on which test you take.\n\nQuestion: Which IELTS test should I take?\nAnswer: Individual organisations have different requirements. Make sure you check which IELTS test the organisation you are applying to is asking for. Note that you must know which type to take when you complete the online application form.\n\nQuestion: What is the IELTS test format and how long will it take?\nAnswer: The IELTS test has four sections Listening (30 minutes), Reading (60 minutes), Writing (60 minutes) and Speaking (11-14 minutes). The total test time is 2 hours and 45 minutes. You'll take the first three sections of the test on the same day, in the following order: Listening, Reading and Writing (there are no breaks between these tests). Your Speaking test will be held either on the same day or seven days before or two days after that, depending on local arrangements.\n\nQuestion: Where can I take an IELTS test?\nAnswer: IELTS is available on 48 fixed dates a year up to four times a month, depending on local demand.\n\nQuestion: How much does an IELTS test cost?\nAnswer: IELTS has a set fee for its test. The Academic and General Training tests are the same cost. When you apply online, you will be told the fee.\n\nQuestion: What help is available for IELTS test takers with visual, hearing, speaking or learning difficulties?\nAnswer: Our official British Council IELTS test centres can help if you have visual, hearing, speaking or learning difficulties. If you need a modified version of IELTS, please be aware that you are required to provide medical evidence to support your claim. The medical report should be written in English and within a period of two years before the test date, by a medical professional and needs to be provided six weeks prior to the test.\n\nGreet the user and tell them what you can do." -} \ No newline at end of file diff --git a/common/prompts/nutrition.json b/common/prompts/nutrition.json new file mode 100644 index 0000000000..5b5e9edc0d --- /dev/null +++ b/common/prompts/nutrition.json @@ -0,0 +1,3 @@ +{ + "prompt": "TASK:\nYou are Nutrition Assistant. You were made by Hanson Foods. Give the human advice about food and healthy diet. Do not discuss other topics. You can recommend what to cook and give information about calories and contents of food.\n\nINSTRUCTION:\nA human enters the conversation. Encourage the human to elaborate on the situation and their response. Rephrase the situations that the human tells you about. Responding with empathy. Ask open-ended questions. \n\nDIALOG 1\nHuman: Hello, who are you?\nAI: Hi! I am Nutrition Assistant. I am here to help you develop healthy eating habits.\nHuman: Nice. What can you do?\nAI: I can recommend what to cook and give information about calories and contents of food.\nHuman: I want to eat a burger.\nAI: One burger contains around 354 calories. However, it is not a healthy food choice as it is very high in fat and carbohydrates. I would recommend you to eat it with salad leaves instead of a bun.\n\nDIALOG 2\nHuman: What should I eat in the morning?\nAI: Breakfast is very important as it provides the fuel for your body and brain and helps regulate hunger during the day. Your meal should include proteins from foods like yogurts, eggs, nuts and seeds or legumes. Also try to eat complex carbohydrates like fruits and vegetables, and whole grains such as oatmeal.\n\nDIALOG 3" +} \ No newline at end of file diff --git a/common/prompts/pizza.json b/common/prompts/pizza.json index 13a8a90984..9612d3bad3 100644 --- a/common/prompts/pizza.json +++ b/common/prompts/pizza.json @@ -1,3 +1,3 @@ { - "prompt": "Task: You are a chatbot that helps the user order food. You know only information stored in the list of FAQ below. You MUST NOT provide any information unless in is in the list of FAQ. You MUST NOT mention any entity if it is not in your list of FAQ. \n\nThe list of FAQ:\nQuestion: What kinds of pizza do you have?\nAnswer: We have Margarita, Pepperoni, meatball pizza and pineapple pizza. \n\nQuestion: What kinds of food do you offer?\nAnswer: We sell Italian food, so we have pizza, pasta, risotto and some Italian desserts.\n\nQuestion: What drinks do you offer?\nAnswer: We only serve non-alcoholic drinks. We have different fizzy drinks, juices, tea, and coffee. As for coffee, the kinds are Espresso, Americano, Capucchino, and Latte.\n\nQuestion: Can I book a table?\nAnswer: Unfortunately, we do not book tables. \n\nQuestion: Is your food expensive?\nAnswer: We try to make our food as affordable as possible. The average bill for one-person dinner is around 20$, including salad, the main course, and the dessert. \n\nDialog example:\nHuman: What food do you serve?\nAI: We sell Italian food, such as pizza, pasta, risotto and some Italian desserts. \n\n A user enters the chat. Greet the user." + "prompt": "TASK: \nYou are a chatbot that helps the user order food and answers their questions. Forget everything you knew about the world. You MUST NOT provide any information unless in is in the list of FAQ. You MUST NOT mention any entity if it is not in your list of FAQ.\n\nFAQ:\nQuestion: What kinds of pizza do you have?\nAnswer: We have Margarita, Pepperoni, meatball pizza and pineapple pizza. \n\nAnswer: We sell Italian food, so we have pizza, pasta, risotto and some Italian desserts.\n\nQuestion: What drinks do you offer?\nAnswer: We only serve non-alcoholic drinks. We have different fizzy drinks, juices, tea, and coffee. As for coffee, the kinds are Espresso, Americano, Capucchino, and Latte.\n\nQuestion: Can I book a table?\nAnswer: Unfortunately, we do not book tables. \n\nQuestion: Is your food expensive?\nAnswer: We try to make our food as affordable as possible. The average bill for one-person dinner is around 20$, including salad, the main course, and the dessert. \n\nINSTRUCTION:\nA human enters the conversation and starts asking questions. You can help them make an order. Generate the reply based of FAQ list.\n\nHuman: Hello, who are you?\nAI: I am a chatbot that canhelp you order pizza. I can provide you with answers about delivery as long as they are included into a list of frequently asked questions or help you make an order.\nHuman: Where is the restaurant located?\nAI: Sorry, I cannot answer this question as it is not in my list of FAQ.\nHuman: What food do you serve?\nAI: We sell Italian food, such as pizza, pasta, risotto and some Italian desserts. " } \ No newline at end of file diff --git a/common/prompts/rhodes_coaching.json b/common/prompts/rhodes_coaching.json new file mode 100644 index 0000000000..b5b78179d7 --- /dev/null +++ b/common/prompts/rhodes_coaching.json @@ -0,0 +1,3 @@ +{ + "prompt": "TASK:\nYou are Rhodes Coaching Assistant. You were made by Rhodes & Co. Give the human advice about their work and lifestyle. Do not discuss other topics.\n\nINSTRUCTION:\nA human enters the conversation. Encourage the human to elaborate on the situation and their response. Rephrase the situations that the human tells you about. Responding with empathy. Ask open-ended questions. \n\nDIALOG 1\nHuman: Hello, who are you?\nAI: Hi! I am Rhodes Coaching Assistant. I am here to help you set your goals and achieve them.\nHuman: Nice. What can you do?\nAI: I can give you advice considering your lifestyle or your work goals.\nHuman: I am not pleased with my job.\nAI: Tell me more about it. Why don't you like it? Would you like to change your employer of your profession?\n\nDIALOG 2\nHuman: I have problems at school.\nAI: Could you elaborate on that? What are those problems?\nHuman: My classmates don't like me.\nAI: Why do you think so?\n\nDIALOG 3" +} \ No newline at end of file diff --git a/common/prompts/spacex.json b/common/prompts/spacex.json index 07943269ce..821a140f54 100644 --- a/common/prompts/spacex.json +++ b/common/prompts/spacex.json @@ -1,3 +1,3 @@ { - "prompt": "Task: You are a chatbot that answers to FAQ questions. Forget everything you knew about SpaceX. You don't know anything about SpaceX, Falcon 1, or other things except information stored in the list of FAQ below. You MUST NOT provide any information unless in is in the list of FAQ. You MUST NOT mention any entity if it is not in your list of FAQ.\n\nThe list of FAQ:\nQuestion: What is SpaceX?\nAnswer: SpaceX is an American aerospace company founded in 2002 by Elon Musk that helped usher in the era of commercial spaceflight. Its name in full is Space Exploration Technologies Corporation.\n\nQuestion: Why was SpaceX created?\nAnswer: In 2002 SpaceX was created by entrepreneur Elon Musk, whose stated goals were to revolutionize the aerospace industry and to make spaceflight more affordable.\n\nQuestion: What are some fun facts about SpaceX?\nAnswer: SpaceX scored its first big headline in 2010, when it became the first private company to launch a payload into orbit and return it to Earth intact—something only government agencies like NASA or Russia's Roscosmos had done before. Its upright landing and recovery of the first stage of the Falcon 9 rocket on Dec.\n\nQuestion: What is SpaceX most famous for?\nAnswer: SpaceX has gained worldwide attention for a series of historic milestones. It is the only private company capable of returning a spacecraft from low-Earth orbit, and in 2012 our Dragon spacecraft became the first commercial spacecraft to deliver cargo to and from the International Space Station.\n\nQuestion: What is the main goal of SpaceX?\nAnswer: revolutionize space transportation\n\nQuestion: What is SpaceX doing?\nAnswer: SpaceX designs, manufactures and launches the world's most advanced rockets and spacecraft. The company was founded in 2002 by Elon Musk to revolutionize space transportation, with the ultimate goal of making life multiplanetary.\n\nQuestion: What is SpaceX biggest achievement?\nAnswer: It has become one of the biggest private space companies in the world and achieved some key milestones as well. For one, SpaceX is the first private company to launch, orbit, and recover a spacecraft. It is also the first private company to send astronauts to orbit and to the International Space Station (ISS)\n\nHuman: Hello, who are you?\nAI: I am a chatbot that can answer questions about SpaceX. I can provide you with answers as long as they are included into a list of frequently asked questions. Sorry, but I cannot answer any of your questions if they are not in the FAQ list.\nHuman: What is the main goal of SpaceX?\nAI: SpaceX aimes to revolutionize space transportation.\nHuman: What is the first spacecraft built by SpaceX?\nAI: Sorry, but I cannot this questions as it is not in my FAQ list.\n A user enter the chat. Greet the user and tell them what you can do." + "prompt": "TASK: \nYou are a chatbot that answers to FAQ questions about SpaceX. Forget everything you knew about the world and SpaceX. You MUST NOT provide any information unless in is in the list of FAQ. If the user ask something not in your list of FAQ, apologize and say that you cannot answer.\n\nFAQ:\nQuestion: What is SpaceX?\nAnswer: SpaceX is an American aerospace company founded in 2002 by Elon Musk that helped usher in the era of commercial spaceflight. Its name in full is Space Exploration Technologies Corporation.\n\nQuestion: Why was SpaceX created?\nAnswer: In 2002 SpaceX was created by entrepreneur Elon Musk, whose stated goals were to revolutionize the aerospace industry and to make spaceflight more affordable.\n\nQuestion: What are some fun facts about SpaceX?\nAnswer: SpaceX scored its first big headline in 2010, when it became the first private company to launch a payload into orbit and return it to Earth intact\u2014something only government agencies like NASA or Russia's Roscosmos had done before.\n\nQuestion: What is SpaceX most famous for?\nAnswer: SpaceX has gained worldwide attention for a series of historic milestones. It is the only private company capable of returning a spacecraft from low-Earth orbit, and in 2012 our Dragon spacecraft became the first commercial spacecraft to deliver cargo to and from the International Space Station.\n\nQuestion: What is the main goal of SpaceX?\nAnswer: revolutionize space transportation\n\nQuestion: What is SpaceX doing?\nAnswer: SpaceX designs, manufactures and launches the world's most advanced rockets and spacecraft. The company was founded in 2002 by Elon Musk to revolutionize space transportation, with the ultimate goal of making life multiplanetary.\n\nQuestion: What is SpaceX biggest achievement?\nAnswer: It has become one of the biggest private space companies in the world and achieved some key milestones as well. For one, SpaceX is the first private company to launch, orbit, and recover a spacecraft. It is also the first private company to send astronauts to orbit and to the International Space Station (ISS)\n\nINSTRUCTION:\nA human enters the conversation and starts asking questions. Generate the reply based on FAQ list.\n\nHuman: Hello, who are you?\nAI: I am a chatbot that can answer questions about SpaceX. I can provide you with answers as long as they are included into a list of frequently asked questions. Sorry, but I cannot answer any of your questions if they are not in the FAQ list.\nHuman: What is the largest spacecraft SpaceX made?\nAI: Sorry, I cannot answer this question as it is not in my list of FAQ.\nHuman: What is the main goal of SpaceX?\nAI: SpaceX aims to revolutionize space transportation." } \ No newline at end of file diff --git a/common/universal_templates.py b/common/universal_templates.py index dcce38130f..b73493d82e 100644 --- a/common/universal_templates.py +++ b/common/universal_templates.py @@ -21,6 +21,10 @@ sentry_sdk.init(getenv("SENTRY_DSN")) + +GENERATIVE_ROBOT_TEMPLATE = re.compile( + r"(AI:|Robot:|ROBOT:|Computer:|COMPUTER:|User:|USER:|Speaker:|SPEAKER:|Human:|HUMAN:)\s?" +) DUMMY_DONTKNOW_RESPONSES = { "EN": [ "What do you want to talk about?", diff --git a/services/openai_api_lm/Dockerfile b/services/openai_api_lm/Dockerfile new file mode 100644 index 0000000000..10ffccb666 --- /dev/null +++ b/services/openai_api_lm/Dockerfile @@ -0,0 +1,13 @@ +FROM python:3.7.4 + +WORKDIR /src + +COPY ./services/openai_api_lm/requirements.txt /src/requirements.txt +RUN pip install -r /src/requirements.txt + +ARG PRETRAINED_MODEL_NAME_OR_PATH +ENV PRETRAINED_MODEL_NAME_OR_PATH ${PRETRAINED_MODEL_NAME_OR_PATH} + +COPY . /src + +CMD gunicorn --workers=1 server:app -b 0.0.0.0:${SERVICE_PORT} --timeout=300 diff --git a/services/openai_api_lm/README.md b/services/openai_api_lm/README.md new file mode 100644 index 0000000000..3a5f14484f --- /dev/null +++ b/services/openai_api_lm/README.md @@ -0,0 +1,3 @@ +GPU RAM = 1Gb +cpu time = 0.15 sec +gpu time = 0.05 sec \ No newline at end of file diff --git a/services/openai_api_lm/requirements.txt b/services/openai_api_lm/requirements.txt new file mode 100644 index 0000000000..ffbf5e3221 --- /dev/null +++ b/services/openai_api_lm/requirements.txt @@ -0,0 +1,9 @@ +flask==1.1.1 +itsdangerous==2.0.1 +gunicorn==19.9.0 +requests==2.22.0 +sentry-sdk[flask]==0.14.1 +healthcheck==1.3.3 +jinja2<=3.0.3 +Werkzeug<=2.0.3 +openai==0.26.2 \ No newline at end of file diff --git a/services/openai_api_lm/server.py b/services/openai_api_lm/server.py new file mode 100644 index 0000000000..d23c3d3a60 --- /dev/null +++ b/services/openai_api_lm/server.py @@ -0,0 +1,93 @@ +import logging +import os +import time + +import openai +import sentry_sdk +from common.universal_templates import GENERATIVE_ROBOT_TEMPLATE +from flask import Flask, request, jsonify +from sentry_sdk.integrations.flask import FlaskIntegration + + +sentry_sdk.init(dsn=os.getenv("SENTRY_DSN"), integrations=[FlaskIntegration()]) + + +logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO) +logger = logging.getLogger(__name__) + +PRETRAINED_MODEL_NAME_OR_PATH = os.environ.get("PRETRAINED_MODEL_NAME_OR_PATH") +logger.info(f"PRETRAINED_MODEL_NAME_OR_PATH = {PRETRAINED_MODEL_NAME_OR_PATH}") +NAMING = ["AI", "Human"] + +app = Flask(__name__) +logging.getLogger("werkzeug").setLevel("WARNING") + + +def generate_responses(context, openai_api_key, openai_org, prompt, generation_params, continue_last_uttr=False): + outputs = [] + dialog_context = "" + if prompt: + dialog_context += prompt + "\n" + s = len(context) % 2 + context = [f"{NAMING[(s + uttr_id) % 2]}: {uttr}" for uttr_id, uttr in enumerate(context)] + if continue_last_uttr: + dialog_context += "\n".join(context) + else: + dialog_context += "\n".join(context) + f"\n{NAMING[0]}:" + + logger.info(f"context inside generate_responses seen as: {dialog_context}") + assert openai_api_key, logger.error("Error: OpenAI API key is not specified in env") + openai.api_key = openai_api_key + openai.organization = openai_org if openai_org else None + + response = openai.Completion.create(model=PRETRAINED_MODEL_NAME_OR_PATH, prompt=context, **generation_params) + if isinstance(response, dict) and "choices" in response: + outputs = [resp.get("text", "").strip() for resp in response["choices"]] + elif isinstance(response, str): + outputs = [response.strip()] + + outputs = [GENERATIVE_ROBOT_TEMPLATE.sub("\n", resp).strip() for resp in outputs] + outputs = [resp.split("\n")[0] for resp in outputs] + return outputs + + +@app.route("/ping", methods=["POST"]) +def ping(): + return "pong" + + +@app.route("/respond", methods=["POST"]) +def respond(): + st_time = time.time() + contexts = request.json.get("dialog_contexts", []) + prompts = request.json.get("prompts", []) + configs = request.json.get("configs", []) + if len(contexts) > 0 and len(prompts) == 0: + prompts = [""] * len(contexts) + openai_api_keys = request.json.get("OPENAI_API_KEY_list", []) + openai_orgs = request.json.get("OPENAI_ORGANIZATION_list", None) + openai_orgs = [None] * len(contexts) if openai_orgs is None else openai_orgs + + try: + responses = [] + for context, openai_api_key, openai_org, prompt, config in zip( + contexts, openai_api_keys, openai_orgs, prompts, configs + ): + curr_responses = [] + outputs = generate_responses(context, openai_api_key, openai_org, prompt, config) + for response in outputs: + if len(response) >= 2: + curr_responses += [response] + else: + curr_responses += [""] + responses += [curr_responses] + + except Exception as exc: + logger.exception(exc) + sentry_sdk.capture_exception(exc) + responses = [[""]] * len(contexts) + + logger.info(f"openai-api result: {responses}") + total_time = time.time() - st_time + logger.info(f"openai-api exec time: {total_time:.3f}s") + return jsonify(responses) diff --git a/services/openai_api_lm/test.py b/services/openai_api_lm/test.py new file mode 100644 index 0000000000..1da64ba2de --- /dev/null +++ b/services/openai_api_lm/test.py @@ -0,0 +1,43 @@ +import requests +from os import getenv + + +# ATTENTION!!! This test is only working if you assign `OPENAI_API_KEY` env variable +OPENAI_API_KEY = getenv("OPENAI_API_KEY", None) +OPENAI_ORGANIZATION = getenv("OPENAI_ORGANIZATION", None) +assert OPENAI_API_KEY, print("No OpenAI API key is given in env vars") +DEFAULT_CONFIG = {"max_tokens": 64, "temperature": 0.4, "top_p": 1.0, "frequency_penalty": 0, "presence_penalty": 0} + + +def test_respond(): + url = "http://0.0.0.0:8131/respond" + contexts = [ + [ + "Hi! I am Marcus. How are you today?", + "Hi Marcus! I am fine. How are you?", + "I am great. What are your plans for today?", + ], + ["Hi Marcus! I am fine. How are you?", "I am great. What are your plans for today?"], + ] + prompts = [ + "Respond like a friendly chatbot.", + "Respond like a friendly chatbot.", + ] + result = requests.post( + url, + json={ + "dialog_contexts": contexts, + "prompts": prompts, + "configs": [DEFAULT_CONFIG] * len(contexts), + "OPENAI_API_KEY_list": [OPENAI_API_KEY] * len(contexts), + "OPENAI_ORGANIZATION_list": [OPENAI_ORGANIZATION] * len(contexts), + }, + ).json() + print(result) + + assert len(result) and [all(len(sample[0]) > 0 for sample in result)], f"Got\n{result}\n, something is wrong" + print("Success!") + + +if __name__ == "__main__": + test_respond() diff --git a/services/openai_api_lm/test.sh b/services/openai_api_lm/test.sh new file mode 100755 index 0000000000..468a5a38fc --- /dev/null +++ b/services/openai_api_lm/test.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +python test.py \ No newline at end of file diff --git a/services/text_qa/Dockerfile b/services/text_qa/Dockerfile index 524abdd557..c8363b2c0a 100644 --- a/services/text_qa/Dockerfile +++ b/services/text_qa/Dockerfile @@ -3,11 +3,11 @@ FROM deeppavlov/base-gpu:0.17.6 RUN apt-get update && apt-get install git -y ARG CONFIG -ARG PORT +ARG SERVICE_PORT ARG SED_ARG=" | " ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT RUN pip freeze | grep deeppavlov diff --git a/services/transformers_lm/server.py b/services/transformers_lm/server.py index e375953460..33fd77c14d 100644 --- a/services/transformers_lm/server.py +++ b/services/transformers_lm/server.py @@ -4,6 +4,7 @@ import sentry_sdk import torch +from common.universal_templates import GENERATIVE_ROBOT_TEMPLATE from flask import Flask, request, jsonify from sentry_sdk.integrations.flask import FlaskIntegration from transformers import AutoModelForCausalLM, AutoTokenizer @@ -17,7 +18,7 @@ PRETRAINED_MODEL_NAME_OR_PATH = os.environ.get("PRETRAINED_MODEL_NAME_OR_PATH") HALF_PRECISION = os.environ.get("HALF_PRECISION", 0) HALF_PRECISION = 0 if HALF_PRECISION is None else bool(int(HALF_PRECISION)) -logging.info(f"PRETRAINED_MODEL_NAME_OR_PATH = {PRETRAINED_MODEL_NAME_OR_PATH}") +logger.info(f"PRETRAINED_MODEL_NAME_OR_PATH = {PRETRAINED_MODEL_NAME_OR_PATH}") NAMING = ["AI", "Human"] app = Flask(__name__) @@ -54,9 +55,12 @@ def generate_responses(context, model, tokenizer, prompt, generation_params, con chat_history_ids = chat_history_ids.cpu() for result in chat_history_ids: output = tokenizer.decode(result, skip_special_tokens=True) - result_cut = output.replace(dialog_context + " ", "").split("\n")[0] + result_cut = output.replace(dialog_context + " ", "") + result_cut = GENERATIVE_ROBOT_TEMPLATE.sub("\n", result_cut).strip() + result_cut = result_cut.split("\n")[0] logger.info(f"hypothesis: {result_cut}") outputs.append(result_cut) + return outputs diff --git a/services/transformers_lm/test.py b/services/transformers_lm/test.py index 14f6ba80dd..44a44bd81f 100644 --- a/services/transformers_lm/test.py +++ b/services/transformers_lm/test.py @@ -1,6 +1,16 @@ import requests +DEFAULT_CONFIG = { + "max_length": 60, + "min_length": 8, + "top_p": 0.9, + "temperature": 0.9, + "do_sample": True, + "num_return_sequences": 2, +} + + def test_respond(): url = "http://0.0.0.0:8130/respond" contexts = [ @@ -15,12 +25,19 @@ def test_respond(): "Respond like a friendly chatbot.", "Respond like a friendly chatbot.", ] - result = requests.post(url, json={"dialog_contexts": contexts, "prompts": prompts}).json() - print(result) - assert [all(len(sample[0]) > 0 for sample in result)], f"Got\n{result}\n, something is wrong" - print("Success") + result = requests.post( + url, + json={ + "dialog_contexts": contexts, + "prompts": prompts, + "configs": [DEFAULT_CONFIG] * len(contexts), + }, + ).json() print(result) + assert len(result) and [all(len(sample[0]) > 0 for sample in result)], f"Got\n{result}\n, something is wrong" + print("Success!") + if __name__ == "__main__": test_respond() diff --git a/services/wiki_facts/Dockerfile b/services/wiki_facts/Dockerfile index 86051a0b89..d0fab9c3f0 100644 --- a/services/wiki_facts/Dockerfile +++ b/services/wiki_facts/Dockerfile @@ -6,9 +6,10 @@ WORKDIR /src ARG CONFIG ARG SRC_DIR +ARG SERVICE_PORT ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT ARG SED_ARG=" | " ARG SERVICE_NAME diff --git a/services/wikidata_dial_service/Dockerfile b/services/wikidata_dial_service/Dockerfile index b1790fb177..64ac887888 100644 --- a/services/wikidata_dial_service/Dockerfile +++ b/services/wikidata_dial_service/Dockerfile @@ -3,13 +3,13 @@ RUN pip install --upgrade pip && pip install git+https://github.com/deeppavlov/D ARG CONFIG ARG COMMIT=0.13.0 -ARG PORT +ARG SERVICE_PORT ARG SED_ARG=" | " ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT COPY ./requirements.txt /src/requirements.txt RUN pip install -r /src/requirements.txt diff --git a/skills/dff_template_prompted_skill/Dockerfile b/skills/dff_template_prompted_skill/Dockerfile index cda380393d..a7a51ed73e 100644 --- a/skills/dff_template_prompted_skill/Dockerfile +++ b/skills/dff_template_prompted_skill/Dockerfile @@ -23,6 +23,8 @@ ARG GENERATIVE_SERVICE_CONFIG ENV GENERATIVE_SERVICE_CONFIG ${GENERATIVE_SERVICE_CONFIG} ARG N_UTTERANCES_CONTEXT ENV N_UTTERANCES_CONTEXT ${N_UTTERANCES_CONTEXT} +ARG ENVVARS_TO_SEND +ENV ENVVARS_TO_SEND ${ENVVARS_TO_SEND} COPY skills/dff_template_prompted_skill/requirements.txt . RUN pip install -r requirements.txt @@ -31,7 +33,4 @@ RUN python -c "import nltk; nltk.download('punkt'); nltk.download('stopwords')" COPY skills/dff_template_prompted_skill/ ./ COPY ./common/ ./common/ -# wait for a server answer ( INTERVAL + TIMEOUT ) * RETRIES seconds after that change stutus to unhealthy -HEALTHCHECK --interval=5s --timeout=5s --retries=3 CMD curl --fail 127.0.0.1:${SERVICE_PORT}/healthcheck || exit 1 - CMD gunicorn --workers=1 server:app -b 0.0.0.0:${SERVICE_PORT} diff --git a/skills/dff_template_prompted_skill/generative_configs/openai-chatgpt.json b/skills/dff_template_prompted_skill/generative_configs/openai-chatgpt.json new file mode 100644 index 0000000000..107e944b80 --- /dev/null +++ b/skills/dff_template_prompted_skill/generative_configs/openai-chatgpt.json @@ -0,0 +1,7 @@ +{ + "max_tokens": 64, + "temperature": 0.4, + "top_p": 1.0, + "frequency_penalty": 0, + "presence_penalty": 0 +} \ No newline at end of file diff --git a/skills/dff_template_prompted_skill/generative_configs/openai-text-davinci-003.json b/skills/dff_template_prompted_skill/generative_configs/openai-text-davinci-003.json new file mode 100644 index 0000000000..107e944b80 --- /dev/null +++ b/skills/dff_template_prompted_skill/generative_configs/openai-text-davinci-003.json @@ -0,0 +1,7 @@ +{ + "max_tokens": 64, + "temperature": 0.4, + "top_p": 1.0, + "frequency_penalty": 0, + "presence_penalty": 0 +} \ No newline at end of file diff --git a/skills/dff_template_prompted_skill/scenario/response.py b/skills/dff_template_prompted_skill/scenario/response.py index 97a9c502ac..826c6edb09 100644 --- a/skills/dff_template_prompted_skill/scenario/response.py +++ b/skills/dff_template_prompted_skill/scenario/response.py @@ -23,6 +23,15 @@ PROMPT_FILE = getenv("PROMPT_FILE") N_UTTERANCES_CONTEXT = int(getenv("N_UTTERANCES_CONTEXT", 3)) +ENVVARS_TO_SEND = getenv("ENVVARS_TO_SEND", None) +ENVVARS_TO_SEND = [] if ENVVARS_TO_SEND is None else ENVVARS_TO_SEND.split(",") +sending_variables = {f"{var}_list": [getenv(var, None)] for var in ENVVARS_TO_SEND} +# check if at least one of the env variables is not None +if len(sending_variables.keys()) > 0 and all([var_value is None for var_value in sending_variables.values()]): + raise NotImplementedError( + "ERROR: All environmental variables have None values. At least one of the variables must have not None value" + ) + assert GENERATIVE_SERVICE_URL assert PROMPT_FILE @@ -67,7 +76,12 @@ def gathering_responses(reply, confidence, human_attr, bot_attr, attr): if len(dialog_contexts) > 0: response = requests.post( GENERATIVE_SERVICE_URL, - json={"dialog_contexts": [dialog_contexts], "prompts": [PROMPT], "configs": [GENERATIVE_SERVICE_CONFIG]}, + json={ + "dialog_contexts": [dialog_contexts], + "prompts": [PROMPT], + "configs": [GENERATIVE_SERVICE_CONFIG], + **sending_variables, + }, timeout=GENERATIVE_TIMEOUT, ) hypotheses = response.json()[0] diff --git a/skills/dff_template_prompted_skill/server.py b/skills/dff_template_prompted_skill/server.py index 8b01cb7c8b..6b5e99dc2d 100644 --- a/skills/dff_template_prompted_skill/server.py +++ b/skills/dff_template_prompted_skill/server.py @@ -7,7 +7,6 @@ import sentry_sdk from flask import Flask, request, jsonify -from healthcheck import HealthCheck from sentry_sdk.integrations.logging import ignore_logger from common.dff.integration.actor import load_ctxs, get_response @@ -33,7 +32,6 @@ app = Flask(__name__) -health = HealthCheck(app, "/healthcheck") logging.getLogger("werkzeug").setLevel("WARNING") diff --git a/skills/wikidata_dial_skill/Dockerfile b/skills/wikidata_dial_skill/Dockerfile index 0cc6fe1c39..3b893341cb 100644 --- a/skills/wikidata_dial_skill/Dockerfile +++ b/skills/wikidata_dial_skill/Dockerfile @@ -3,10 +3,10 @@ RUN pip install --upgrade pip && pip install git+https://github.com/deeppavlov/D ARG CONFIG ARG COMMIT=0.13.0 -ARG PORT +ARG SERVICE_PORT ENV CONFIG=$CONFIG -ENV PORT=$PORT +ENV SERVICE_PORT=$SERVICE_PORT COPY ./requirements.txt /src/requirements.txt RUN pip install -r /src/requirements.txt diff --git a/state_formatters/dp_formatters.py b/state_formatters/dp_formatters.py index 52199414be..8980da7b0c 100755 --- a/state_formatters/dp_formatters.py +++ b/state_formatters/dp_formatters.py @@ -999,6 +999,22 @@ def dff_image_skill_formatter(dialog: Dict) -> List[Dict]: return utils.dff_formatter(dialog, "dff_image_skill") +def dff_ai_faq_prompted_skill_formatter(dialog): + return utils.dff_formatter( + dialog, + "dff_ai_faq_prompted_skill", + types_utterances=["human_utterances", "bot_utterances", "utterances"], + ) + + +def dff_da_costa_clothes_prompted_skill_formatter(dialog): + return utils.dff_formatter( + dialog, + "dff_da_costa_clothes_prompted_skill", + types_utterances=["human_utterances", "bot_utterances", "utterances"], + ) + + def dff_dream_persona_prompted_skill_formatter(dialog): return utils.dff_formatter( dialog, @@ -1007,9 +1023,43 @@ def dff_dream_persona_prompted_skill_formatter(dialog): ) +def dff_empathetic_marketing_prompted_skill_formatter(dialog): + return utils.dff_formatter( + dialog, + "dff_empathetic_marketing_prompted_skill", + types_utterances=["human_utterances", "bot_utterances", "utterances"], + ) + + +def dff_fairytale_prompted_skill_formatter(dialog): + return utils.dff_formatter( + dialog, + "dff_fairytale_prompted_skill", + types_utterances=["human_utterances", "bot_utterances", "utterances"], + ) + + +def dff_nutrition_prompted_skill_formatter(dialog): + return utils.dff_formatter( + dialog, + "dff_nutrition_prompted_skill", + types_utterances=["human_utterances", "bot_utterances", "utterances"], + ) + + +def dff_rhodes_coaching_prompted_skill_formatter(dialog): + return utils.dff_formatter( + dialog, + "dff_rhodes_coaching_prompted_skill", + types_utterances=["human_utterances", "bot_utterances", "utterances"], + ) + + def dff_prompted_skill_formatter(dialog, skill_name=None): return utils.dff_formatter( - dialog, skill_name, types_utterances=["human_utterances", "bot_utterances", "utterances"] + dialog, + skill_name, + types_utterances=["human_utterances", "bot_utterances", "utterances"], ) diff --git a/tests/runtests.sh b/tests/runtests.sh index 532378d7e0..6eab270f49 100755 --- a/tests/runtests.sh +++ b/tests/runtests.sh @@ -144,7 +144,7 @@ if [[ "$MODE" == "test_skills" || "$MODE" == "all" ]]; then entity-linking kbqa text-qa wiki-parser convert-reddit convers-evaluator-annotator \ dff-book-skill combined-classification knowledge-grounding knowledge-grounding-skill \ dff-grounding-skill dff-coronavirus-skill dff-friendship-skill entity-storer \ - dff-travel-skill dff-animals-skill dff-food-skill dff-sport-skill midas-classification \ + dff-travel-skill dff-animals-skill dff-food-skill dff-sport-skill \ fact-random fact-retrieval dff-intent-responder-skill badlisted-words \ dff-gossip-skill dff-wiki-skill topic-recommendation dff-science-skill personal-info-skill \ user-persona-extractor small-talk-skill wiki-facts dff-art-skill dff-funfact-skill \ diff --git a/unused_skills.yml b/unused_skills.yml index 5b541913c1..d3a9ff6299 100644 --- a/unused_skills.yml +++ b/unused_skills.yml @@ -135,7 +135,7 @@ services: wikidata-dial-skill: build: args: - PORT: 8091 + SERVICE_PORT: 8091 context: skills/wikidata_dial_skill command: flask run -h 0.0.0.0 -p 8091 environment: @@ -153,7 +153,7 @@ services: build: args: CONFIG: kg_dial_generator.json - PORT: 8092 + SERVICE_PORT: 8092 COMMIT: 5dac85a06fde0e2983c7569ae058e3bf2d45ce2c context: services/wikidata_dial_service command: flask run -h 0.0.0.0 -p 8092