本文整理汇总了Python中monitor.Monitor.error_message方法的典型用法代码示例。如果您正苦于以下问题:Python Monitor.error_message方法的具体用法?Python Monitor.error_message怎么用?Python Monitor.error_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类monitor.Monitor
的用法示例。
在下文中一共展示了Monitor.error_message方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from monitor import Monitor [as 别名]
# 或者: from monitor.Monitor import error_message [as 别名]
#.........这里部分代码省略.........
data_dir=args['data_dir'].rstrip('/'),
saveto=args["model"],
attn_type='deterministic',
reload_=args['reload'],
dim_word=512,
ctx_dim=512,
dim=1800,
n_layers_att=2,
n_layers_out=1,
n_layers_lstm=1,
n_layers_init=2,
n_words=10000,
lstm_encoder=False,
decay_c=0.,
alpha_c=1.,
prev2out=True,
ctx2out=True,
lrate=0.01,
optimizer='adam',
selector=True,
patience=10,
maxlen=100,
batch_size=64,
valid_batch_size=64,
validFreq=2000,
dispFreq=1,
saveFreq=1000,
sampleFreq=250,
dataset="coco",
use_dropout=True,
use_dropout_lstm=False,
save_per_epoch=False,
monitor=monitor)
print "Final cost: {:.2f}".format(validerr.mean())
elif args['type'] == 't_attn':
from capgen_text import train
out_dir = args['out_dir'].rstrip('/')
saveto = args['model']
_, validerr, _ = train(out_dir=out_dir,
data_dir=args['data_dir'].rstrip('/'),
saveto=saveto,
attn_type='deterministic',
reload_=args['reload'],
dim_word=512,
ctx_dim=512,
tex_dim=args['tex_dim'],
dim=1800,
n_layers_att=2,
n_layers_out=1,
n_layers_lstm=1,
n_layers_init=2,
n_words=10000,
lstm_encoder=False,
lstm_encoder_context=args['lenc'],
decay_c=0.,
alpha_c=1.,
prev2out=True,
ctx2out=True,
tex2out=True,
lrate=0.01,
optimizer='adam',
selector=True,
patience=10,
maxlen=100,
batch_size=32,
valid_batch_size=32,
validFreq=2000,
dispFreq=1,
saveFreq=1000,
sampleFreq=250,
dataset="coco",
use_dropout=True,
use_dropout_lstm=False,
save_per_epoch=False,
monitor=monitor)
print "Final cost: {:.2f}".format(validerr.mean())
# Store data preprocessing type in the options file
with open('{}/{}.pkl'.format(out_dir, saveto)) as f_opts:
opts = pkl.load(f_opts)
opts['preproc_type'] = args['preproc_type']
preproc_params = {}
for param in args['preproc_params'].split(','):
if param:
key, value = param.split('=')
if value.isdigit():
value = int(value)
preproc_params[key] = value
opts['preproc_params'] = preproc_params
pkl.dump(opts, f_opts)
except (KeyboardInterrupt, SystemExit):
print 'Interrupted!'
monitor.error_message = 'Interrupted!'
monitor.status = 12
except Exception, e:
print 'Unexpected error!'
monitor.error_message = str(e)
monitor.status = 12
raise e