import argparse import os import random import sys # import matplotlib.image as mpimg import numpy as np import tensorflow as tf import inference import train from utils import evaluation_utils from utils import misc_utils as utils from utils import vocab_utils utils.check_tensorflow_version() FLAGS = None def add_arguments(parser): """Build ArgumentParser.""" parser.register("type", "bool", lambda v: v.lower() == "true") # network parser.add_argument("--num_units", type=int, default=32, help="Network size.") parser.add_argument("--num_layers", type=int,
Created by Tudor Paraschivescu for the Cambridge UROP project "Dialogue systems for language learning" The hierarchical model with dynamic RNN support.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf from chatbot.models.base_model import BaseModel import utils.misc_utils as utils from chatbot.models import model_helper utils.check_tensorflow_version(version="1.3.0") class HierarchicalModel(BaseModel): """ Sequence-to-sequence hierarchical model. This class implements a multi-layer recurrent neural network as encoder, a multi-layer recurrent neural network as a context encoder and a multi-layer recurrent neural network decoder. """ def _build_encoder(self, hparams): """Build an encoder""" encoder_num_layers = hparams.num_layers encoder_num_residual_layers = hparams.num_residual_layers