This is a chatbot for the Telegram instance messenger, which uses various free conversational Natural Language Understanding, Automatic Speech Recognition and Text-To-Speech neural networks for different languages.
-
Text Conversational networks
-
Text Neural Machine Translation
- MarianMT/OpusMT models
-
Text Punctuation and Capitalization
- NVIDIA NeMo Bert models
-
Automatic Speech Recognition
-
Text-To-Speech
-
Audio Language Identification
- ECAPA-TDNN model
-
Audio Emotion Recognition
- Google Cloud
- Amazon Transcribe and Polly
- Yandex Cloud
- Install docker engine (actual instructions):
sudo apt update
sudo apt upgrade -y
sudo apt dist-upgrade -y
sudo apt autoremove -y
sudo apt install -y apt-transport-https ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo systemctl status docker
sudo usermod -aG docker $USER
newgrp docker
- Install NVIDIA Container Toolkit (actual instructions):
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt update
sudo apt install -y nvidia-container-toolkit
sudo systemctl restart docker
- Build docker image:
git clone https://github.com/osmr/tgchatbot.git
cd tgchatbot
docker build -t tgchatbot .
- Run docker container (fill the
token
value):
docker run -it --rm --name=tgchatbot1 tgchatbot --token="<Your token>"
or
docker run -it --rm --gpus=all --name=tgchatbot1 tgchatbot --token="<Your token>" --use-cuda
NB: You need Python
>= 3.7 due to requirements of the aiogram
and SpeechBrain
packages.
- Install prerequisites:
apt-get update && apt-get upgrade -y && apt-get autoremove
apt-get install -y libsndfile1-dev ffmpeg
- Install virtualenv (actual instructions):
sudo -H pip install --upgrade pip setuptools wheel
sudo -H pip install Cython
sudo -H pip install virtualenv
- Clone repo, create and activate environment:
git clone https://github.com/osmr/tgchatbot.git
cd tgchatbot
virtualenv venv
source venv/bin/activate
- Install dependencies:
pip install torch==1.9.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html
pip install -r requirements.txt
pip install TensorFlowTTS==1.8
pip install huggingface-hub==0.0.17 six==1.16.0
pip install --upgrade numpy llvmlite numba typing-extensions h5py
pip install pytest
pip install .
- Run tests:
pytest
- Run the chatbot (fill the
token
value):
python -m tgchatbot.launch --token="<Your token>"
docker run -it --rm --name=tgchatbot1 tgchatbot --token="<Your token>"
or
python -m tgchatbot.launch --token="<Your token>" --use-cuda
- Deactivate environment:
deactivate
/start
or/help
- Welcome information./start en
- Set input/output language toen
(English). It can been
,fr
,de
, andru
./lang
- Show current input/output languages status./lang_src
- Show current input (your messages or speech) language status./lang_dst
- Show current output (chatbot's messages and speech) language status./lang en
- Set input/output language toen
(English)./lang_src en
- Set input language toen
(English)./lang_dst en
- Set output language toen
(English)./tts
- Show current Text-To-Speech (TTS) activity status. It can beyes
orno
./tts yes
- Activate TTS./context
- Show contest for text (NLU) chatbot context corresponding the current user and output language./context ""
- Erase NLU chatbot contest.Hello
- TextHello
to the chatbot. You can text amy message.<Audio with speech>
- Say something to the chatbot.