for i in range(epoch):
print 'epoch:',i,'/',epoch,'begin'
sys.stdout.flush()
t0 = time.clock()
for j, (name,doc) in enumerate(docs.iteritems()):
print 'begin doc:',j,'/', n, 'contents:', len(doc.contents), 'time now:', time.strftime("%Y-%m-%d %A %X %Z", time.localtime())
t1 = time.clock()
train_samples = []
get_large_margin_all_together_train_datas(doc, mod, parse_result,golds[name], 0, len(doc.contents), train_samples)
for sample in train_samples:
cost = mod.train_relation_with_struct(sample)
print 'doc:',j,'/', n, 'contents:', len(doc.contents), 'cost:', cost, 'time:',time.clock() - t1
#print 'gc:', gc.collect()
sys.stdout.flush()
print 'epoch:',i,'/',epoch,'consume:',time.clock()-t0
mod.save_params()
sys.stdout.flush()
test_results = pa.parse_docs(mod, test_docs, saved = False, n_threshold = 120, verbose = False)
results = pa.f_value(test_golds, test_results, coarse = True, strict = False)
results = pa.f_value(test_golds, test_results, coarse = True, strict = True)
if results[3] > best_result:
mod.save_params(best = True)
我尝试使用gc.collect它仍然没有帮助。我在旧服务器上运行它,它设置了旧版本的theano(0.6.0),没有那种问题。
有人有线索吗?我会非常感激。
我在这里有一个别名问题。(https://groups.google.com/forum/#!topic/theano-users/vX6sPnGhRCg)