Git Product home page Git Product logo

desklop / voice_chatbot Goto Github PK

View Code? Open in Web Editor NEW
60.0 5.0 17.0 370.62 MB

Chatbot in russian with speech recognition using PocketSphinx and speech synthesis using RHVoice. The AttentionSeq2Seq model is used. Imlemented using Python3+TensorFlow+Keras.

License: Other

Python 78.79% Shell 3.09% Perl 16.50% Dockerfile 1.61%
seq2seq pocketsphinx flask rhvoice gensim word2vec chatbot nlp speech-recognition speech-synthesis

voice_chatbot's Issues

Не запускается в докере

  1. После запуска docker build -t voice_chatbot:0.1 . выводит
Step 19/41 : RUN unzip install_files/RHVoice.zip
 ---> Running in 673881a195c1
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
note:  install_files/RHVoice.zip may be a plain executable, not an archive
unzip:  cannot find zipfile directory in one of install_files/RHVoice.zip or
        install_files/RHVoice.zip.zip, and cannot find install_files/RHVoice.zip.ZIP, period.
  1. Если закомментировать Установка RHVoice, билдится успешно, но при запуске контейнера пишет
➜  Voice_ChatBot git:(master) ✗ docker run -ti --rm -p 5000:5000 voice_chatbot:0.1
Traceback (most recent call last):
  File "rest_server.py", line 30, in <module>
    from tensorflow import get_default_graph
ImportError: cannot import name 'get_default_graph'

Pocketshinx

При попытке использования вылазит ошибка, в чем косяк всё стоит верно!

python3 speech_to_text.py
[i] Загрузка языковой модели... Traceback (most recent call last):
File "speech_to_text.py", line 101, in
main()
File "speech_to_text.py", line 94, in main
sr = SpeechRecognitionclass('from_microphone')
File "speech_to_text.py", line 45, in init
dic=os.path.join(model_path, 'ru_bot.dic')
File "/usr/local/lib/python3.6/dist-packages/pocketsphinx/init.py", line 208, in init
super(LiveSpeech, self).init(**kwargs)
File "/usr/local/lib/python3.6/dist-packages/pocketsphinx/init.py", line 90, in init
super(Pocketsphinx, self).init(config)
File "/usr/local/lib/python3.6/dist-packages/pocketsphinx/pocketsphinx.py", line 275, in init
this = _pocketsphinx.new_Decoder(*args)
RuntimeError: new_Decoder returned -1

Python 3.6

Нужно положить акустическую модель в /usr/local/lib/python3.5/dist-packages/pocketsphinx/model. Подробнее про это можно найти в статье на хабре https://habr.com/post/351376/

P.S. Это ошибка не RHVoice, а PocketSphinx.

Просто положить файлы в такую же деректорию для python 3.6 не канает

Eror imort tkiner

root@Dell:/home/lavrenkov/Voice_ChatBOt# python3 bot.py train
Traceback (most recent call last):
File "bot.py", line 8, in
from preprocessing import Preparation
File "/home/lavrenkov/Voice_ChatBOt/preprocessing.py", line 11, in
import matplotlib.pyplot as plt
File "/usr/local/lib/python3.6/dist-packages/matplotlib/pyplot.py", line 2374, in
switch_backend(rcParams["backend"])
File "/usr/local/lib/python3.6/dist-packages/matplotlib/pyplot.py", line 207, in switch_backend
backend_mod = importlib.import_module(backend_name)
File "/usr/lib/python3.6/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_tkagg.py", line 1, in
from . import _backend_tk
File "/usr/local/lib/python3.6/dist-packages/matplotlib/backends/_backend_tk.py", line 5, in
import tkinter as Tk
ModuleNotFoundError: No module named 'tkinter'

Ошибка обучения

root@Dell:/home/lavrenkov/Voice_ChatBOt# python3 preprocessing.py
Ты бот?

root@Dell:/home/lavrenkov/Voice_ChatBOt#

RHVoice eror

[i] Выберите вариант работы бота:
1. train - обучение модели seq2seq
2. predict - работа с обученной моделью seq2seq
3. predict -ss - включено озвучивание ответов с помощью RHVoice
4. predict -sr - включено распознавание речи с помощью PocketSphinx
5. predict -ss -sr - включено озвучивание ответов и распознавание речи
Введите цифру: 4
[i] Загрузка параметров сети из data/net_model.txt и data/net_final_weights.h5
2018-11-21 19:01:24.488971: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
[i] Инициализация языковой модели...
Traceback (most recent call last):
File "bot.py", line 239, in
main()
File "bot.py", line 218, in main
predict(True, False)
File "bot.py", line 136, in predict
sr = SpeechRecognition('from_microphone')
File "/home/lavrenkov/Voice_ChatBot/speech_to_text.py", line 45, in init
dic=os.path.join(model_path, 'ru_bot.dic')
File "/usr/local/lib/python3.6/dist-packages/pocketsphinx/init.py", line 208, in init
super(LiveSpeech, self).init(**kwargs)
File "/usr/local/lib/python3.6/dist-packages/pocketsphinx/init.py", line 90, in init
super(Pocketsphinx, self).init(config)
File "/usr/local/lib/python3.6/dist-packages/pocketsphinx/pocketsphinx.py", line 273, in init
this = _pocketsphinx.new_Decoder(*args)
RuntimeError: new_Decoder returned -1

При запуске bot.py predict ошибка с векторами

Возинкает ошибка при выборе опции 1:
ValueError: invalid literal for int() with base 10: 'version
что-то с векторами модели.

`python3 bot.py predict

/home/joo/anaconda3/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.
/home/joo/anaconda3/lib/python3.6/site-packages/smart_open/ssh.py:34: UserWarning: paramiko missing, opening SSH/SCP/SFTP paths will be disabled. pip install paramiko to suppress
warnings.warn('paramiko missing, opening SSH/SCP/SFTP paths will be disabled. pip install paramiko to suppress')
[i] Выберите набор данных:
1. plays_ru - набор диалогов из пьес
2. conversations_ru - набор диалогов из различных произведений
3. subtitles_ru - набор диалогов из субтитров к 347 сериалам
[W] conversations_ru и subtitles_ru ещё в разработке!
Ваш выбор: 1
[i] Используется набор данных plays_ru
[i] Загрузка параметров модели из data/plays_ru/model_plays_ru.json и data/plays_ru/model_weights_plays_ru.h5
2019-05-12 15:20:13.148420: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2019-05-12 15:20:13.228519: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:964] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2019-05-12 15:20:13.228865: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1432] Found device 0 with properties:
name: GeForce GTX 1080 major: 6 minor: 1 memoryClockRate(GHz): 1.7715
pciBusID: 0000:01:00.0
totalMemory: 7.93GiB freeMemory: 6.86GiB
2019-05-12 15:20:13.228881: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2019-05-12 15:20:13.426428: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-05-12 15:20:13.426457: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988] 0
2019-05-12 15:20:13.426463: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0: N
2019-05-12 15:20:13.426600: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6609 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080, pci bus id: 0000:01:00.0, compute capability: 6.1)
[i] Установлена максимальная длина предложения 26 слов(-а)
[i] Загрузка модели word2vec из data/plays_ru/w2v_model_plays_ru.bin...
Traceback (most recent call last):
File "bot.py", line 259, in
main()
File "bot.py", line 202, in main
predict()
File "bot.py", line 143, in predict
ttt = TextToText(f_name_w2v_model=f_name_w2v_model, f_name_model=f_name_model, f_name_model_weights=f_name_model_weights)
File "/home/joo/Документы/LocalRepository/Voice_ChatBot-master/text_to_text.py", line 74, in init
self.w2v = WordToVec(f_name_w2v_model)
File "/home/joo/Документы/LocalRepository/Voice_ChatBot-master/word_to_vec.py", line 33, in init
self.model = word2vec.Word2VecKeyedVectors.load_word2vec_format(f_name_w2v_model, binary=True)
File "/home/joo/anaconda3/lib/python3.6/site-packages/gensim/models/keyedvectors.py", line 1476, in load_word2vec_format
limit=limit, datatype=datatype)
File "/home/joo/anaconda3/lib/python3.6/site-packages/gensim/models/utils_any2vec.py", line 344, in _load_word2vec_format
vocab_size, vector_size = (int(x) for x in header.split()) # throws for invalid file format
File "/home/joo/anaconda3/lib/python3.6/site-packages/gensim/models/utils_any2vec.py", line 344, in
vocab_size, vector_size = (int(x) for x in header.split()) # throws for invalid file format
ValueError: invalid literal for int() with base 10: 'version'`

При выборе опции 3 будет другая ошибка:

File "/home/joo/Документы/LocalRepository/Voice_ChatBot-master/text_to_text.py", line 230, in __load_model with open(f_name_model, 'r') as f_model: FileNotFoundError: [Errno 2] No such file or directory: 'data/subtitles_ru/model_subtitles_ru.json'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.