# Path: chatbot/globals.py
# DEFAULT_FULL_CONFIG = {
#     "model": "DynamicBot",
#     "dataset": "Cornell",
#     "model_params": {
#         "base_cell": "GRUCell",
#         "ckpt_dir": "out",  # Directory to store training checkpoints.
#         "decode": False,
#         "batch_size": 256,
#         "dropout_prob": 0.2,  # Drop rate applied at encoder/decoders output.
#         "decoder.class": "BasicDecoder",
#         "encoder.class": "BasicEncoder",
#         "embed_size": 128,
#         "learning_rate": 0.002,
#         "l1_reg": 1.0e-6,  # L1 regularization applied to word embeddings.
#         "lr_decay": 0.98,
#         "max_gradient": 5.0,
#         "max_steps": int(1e6),  # Max number of training iterations.
#         "num_layers": 1,  # Num layers for each of encoder, decoder.
#         "num_samples": 512,  # IF sampled_loss is true, default sample size.
#         "optimizer": "Adam",  # Options are those in OPTIMIZERS above.
#         "reset_model": True,
#         "sampled_loss": False,  # Whether to do sampled softmax.
#         "state_size": 512,
#         "steps_per_ckpt": 200,
#         "temperature": 0.0,  # Response temp for chat sessions. (default argmax)
#     },
#     "dataset_params": {
#         "data_dir": None,  # Require user to specify.
#         "vocab_size": 40000,
#         "max_seq_len": 10,  # Maximum length of sentence used to train bot.
#         "optimize_params": True  # Reduce vocab size if exceeds num unique words
#     },
# }


import os
import re
import sys
import yaml
import copy
import pandas as pd
import logging
import tensorflow as tf
from collections import Counter, namedtuple
from tensorflow.python.platform import gfile
from subprocess import Popen, PIPE
from chatbot.globals import DEFAULT_FULL_CONFIG
    config_path = os.path.join(pretrained_dir, "config.yml")
    config = get_yaml_config(config_path)
    # The loaded config will have "training" values, so we need
    # to set some of them to "chatting" values, instead of requiring
    # user to specify them (since they are mandatory for any chat sesion).
    config['model_params']['decode'] = True
    config['model_params']['is_chatting'] = True  # alias
    config['model_params']['reset_model'] = False
    config['model_params']['ckpt_dir'] = pretrained_dir
    return config


def print_non_defaults(config):
    """Prints all values in config that aren't the default values in DEFAULT_FULL_CONFIG.
    Args:
        config: dict of parameters with same structure as DEFAULT_FULL_CONFIG.
    """

    print("\n---------- Your non-default parameters: ----------")
    if config['model'] != DEFAULT_FULL_CONFIG['model']:
        print("{}: {}".format('model', config['model']))
    if config['dataset'] != DEFAULT_FULL_CONFIG['dataset']:
        print("{}: {}".format('dataset', config['dataset']))

    for dict_id in ['model_params', 'dataset_params']:
        print(dict_id, end=":\n")
        for key, val in config[dict_id].items():
            # First check if key isn't even specified by defaults.
            if key not in DEFAULT_FULL_CONFIG[dict_id]:
                print("\t{}: {}".format(key, val))

# Path: chatbot/globals.py
# DEFAULT_FULL_CONFIG = {
#     "model": "DynamicBot",
#     "dataset": "Cornell",
#     "model_params": {
#         "base_cell": "GRUCell",
#         "ckpt_dir": "out",  # Directory to store training checkpoints.
#         "decode": False,
#         "batch_size": 256,
#         "dropout_prob": 0.2,  # Drop rate applied at encoder/decoders output.
#         "decoder.class": "BasicDecoder",
#         "encoder.class": "BasicEncoder",
#         "embed_size": 128,
#         "learning_rate": 0.002,
#         "l1_reg": 1.0e-6,  # L1 regularization applied to word embeddings.
#         "lr_decay": 0.98,
#         "max_gradient": 5.0,
#         "max_steps": int(1e6),  # Max number of training iterations.
#         "num_layers": 1,  # Num layers for each of encoder, decoder.
#         "num_samples": 512,  # IF sampled_loss is true, default sample size.
#         "optimizer": "Adam",  # Options are those in OPTIMIZERS above.
#         "reset_model": True,
#         "sampled_loss": False,  # Whether to do sampled softmax.
#         "state_size": 512,
#         "steps_per_ckpt": 200,
#         "temperature": 0.0,  # Response temp for chat sessions. (default argmax)
#     },
#     "dataset_params": {
#         "data_dir": None,  # Require user to specify.
#         "vocab_size": 40000,
#         "max_seq_len": 10,  # Maximum length of sentence used to train bot.
#         "optimize_params": True  # Reduce vocab size if exceeds num unique words
#     },
# }


# Path: utils/io_utils.py
import os
import re
import sys
import yaml
import copy
import pandas as pd
import logging
import tensorflow as tf
from collections import Counter, namedtuple
from tensorflow.python.platform import gfile
from subprocess import Popen, PIPE
from chatbot.globals import DEFAULT_FULL_CONFIG

    config_path = os.path.join(pretrained_dir, "config.yml")
    config = get_yaml_config(config_path)
    # The loaded config will have "training" values, so we need
    # to set some of them to "chatting" values, instead of requiring
    # user to specify them (since they are mandatory for any chat sesion).
    config['model_params']['decode'] = True
    config['model_params']['is_chatting'] = True  # alias
    config['model_params']['reset_model'] = False
    config['model_params']['ckpt_dir'] = pretrained_dir
    return config


def print_non_defaults(config):
    """Prints all values in config that aren't the default values in DEFAULT_FULL_CONFIG.
    Args:
        config: dict of parameters with same structure as DEFAULT_FULL_CONFIG.
    """

    print("\n---------- Your non-default parameters: ----------")
    if config['model'] != DEFAULT_FULL_CONFIG['model']:
        print("{}: {}".format('model', config['model']))
    if config['dataset'] != DEFAULT_FULL_CONFIG['dataset']:
        print("{}: {}".format('dataset', config['dataset']))

    for dict_id in ['model_params', 'dataset_params']:
        print(dict_id, end=":\n")
        for key, val in config[dict_id].items():
            # First check if key isn't even specified by defaults.
            if key not in DEFAULT_FULL_CONFIG[dict_id]:
                print("\t{}: {}".format(key, val))

            elif DEFAULT_FULL_CONFIG[dict_id][key] != val: