Coder Social home page Coder Social logo

chatrobot's Introduction

ChatRobot

0. 特别提醒  

  • 关于keras环境下seq2seq错误修改
    ('_OptionalInputPlaceHolder' object has no attribute 'inbound_nodes')
  • 0.0 使用keras2.1.0版本的第三方库(不推荐)
  • 0.1 将recurrentshop\engine.py文件中837和842行中inbound_nodes更改为_inbound_nodes

1. 效果展示

1.0 python train.py执行效果图

image

1.1 python test.py执行效果图

image

1.2 python chat_robot.py执行效果图

image

2. 软件安装

3. 参考链接

4. 执行命令

  • 生成序列文件,将文字编码为数字,不足补零
    python data_process.py
  • 生成word2vec向量,包括编码向量和解码向量
    python word2vec.py
  • 训练网络
    python train.py
  • 测试
    python test.py
  • 模型评分
    python score.py
  • 智能问答
    python chat_robot.py
  • 绘制word2vec向量分布图
    python word2vec_plot.py

5. 更新

  • Word2cut模型对陌生词汇的分词未解决,有时间搞定一下

chatrobot's People

Contributors

shen1994 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

chatrobot's Issues

_OptionalInputPlaceHolder' object has no attribute '_inbound_nodes'

There is something looks strange... 0.0
In what i download, engine.py 's 837 and 842 is


def _get_optional_input_placeholder(self, name=None, num=1):
        if name:
            if name not in self._optional_input_placeholders:
                if num > 1:
                    self._optional_input_placeholders[name] = [self._get_optional_input_placeholder() for _ in range(num)]
                else:
                    self._optional_input_placeholders[name] = self._get_optional_input_placeholder()
            return self._optional_input_placeholders[name]
        if num == 1:
            **optional_input_placeholder = _to_list(_OptionalInputPlaceHolder()._inbound_nodes[0].output_tensors)[0]**
            assert self._is_optional_input_placeholder(optional_input_placeholder)
            return optional_input_placeholder
        else:
            y = []
            for _ in range(num):
                **optional_input_placeholder = _to_list(_OptionalInputPlaceHolder()._inbound_nodes[0].output_tensors)[0]**
                assert self._is_optional_input_placeholder(optional_input_placeholder)
                y.append(optional_input_placeholder)
            return y  

thanks !!!

question about the initial_state of decoder

Hi, I am wonder that how to initialize the state of the encoder and decoder. I tried both encoder_states and [a1, b1] to initialize the state of the decoder_lstm2 but got bad result. I can get good results when I use only decoder_lstm1 with one or several encoders which without initialize the state. Could you please help me? Here is my code.

encoder_inputs = Input(shape=(max_video_length, 4096), dtype='float32')
encoder = LSTM(latent_dim, return_state=True)
encoder_outputs, state_h, state_c = encoder(encoder_outputs2)
encoder_states = [state_h, state_c]

decoder_inputs = Input(shape=(None, len(char_list)), name="decoder_inputs")
decoder_lstm1 = LSTM(latent_dim, return_sequences=True, return_state=True, name="decoder_lstm1")
decoder_lstm2 = LSTM(latent_dim, return_sequences=True, return_state=True, name="decoder_lstm2")
decoder_dense = Dense(len(char_list), activation='softmax')

decoder_outputs, a1, b1 = decoder_lstm1(decoder_inputs, initial_state=encoder_states)
decoder_outputs, a2, b2 = decoder_lstm2(decoder_outputs, initial_state=encoder_states)
decoder_outputs = decoder_dense(decoder_outputs)

model = Model([encoder_inputs, decoder_inputs], decoder_outputs)

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.