import tensorflow as tf

import tensorflow as tf
from cotk.dataloader import MultiTurnDialog
from cotk.wordvector import WordVector, Glove
from utils import debug, try_cache

from model import HredModel

def create_model(sess, data, args, embed):
	with tf.variable_scope(args.name):
		model = HredModel(data, args, embed)
		model.print_parameters()
		latest_dir = '%s/checkpoint_latest' % args.model_dir
		best_dir = '%s/checkpoint_best' % args.model_dir
		if tf.train.get_checkpoint_state(latest_dir) and args.restore == "last":
			print("Reading model parameters from %s" % latest_dir)
			model.latest_saver.restore(sess, tf.train.latest_checkpoint(latest_dir))
