0
私はモデルを保存してトレーニングを開始するたびにモデルを保存しようとしています。私はちょうどthis linkが行ったことに従った。TensorFlow:モデルを復元する
saver = tf.train.Saver()
with tf.Session(graph=graph) as session:
# Initializate the weights and biases
tf.global_variables_initializer().run()
new_saver = tf.train.import_meta_graph('model.meta')
new_saver.restore(sess,tf.train.latest_checkpoint('./'))
W1 = session.run(W)
print(W1)
for curr_epoch in range(num_epochs):
train_cost = train_ler = 0
start = time.time()
for batch in range(num_batches_per_epoch):
...Some training...
W2 = session.run(W)
print(W2)
save_path = saver.save(session, "models/model")
しかし、それは下のエラーを与える:
---> new_saver.restore(session, tf.train.latest_checkpoint('./'))
SystemError: <built-in function TF_Run> returned a result with an error set
誰も私を助けることができるしてください?どうもありがとう!
から読み込む(また、あなたがないことをあなたのために。復元、変数を開始する必要はありません)./models/とロード「./」パスを修正しようとしましたか? – lejlot
ええ、最初は復元せずにコードを実行し、上記のコードを実行しました。 –