Skip to content

Commit

Permalink
saver changes in 0.12, e.g. tensorflow/tensorflow#6082
Browse files Browse the repository at this point in the history
  • Loading branch information
pkmital committed Jan 4, 2017
1 parent 38f1d39 commit 4e5fe26
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion session-3/lecture-3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2763,7 +2763,7 @@
"outputs": [],
"source": [
"path='./'\n",
"ckpt_name = 'model.ckpt'\n",
"ckpt_name = './model.ckpt'\n",
"fname = 'model.tfmodel'\n",
"dst_nodes = ['Y']\n",
"g_1 = tf.Graph()\n",
Expand Down
6 changes: 3 additions & 3 deletions session-3/libs/vae.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def train_vae(files,
# Start up the queues for handling the image pipeline
threads = tf.train.start_queue_runners(sess=sess, coord=coord)

if os.path.exists(ckpt_name):
if os.path.exists(ckpt_name + '.index'):
saver.restore(sess, ckpt_name)

# Fit all training data
Expand Down Expand Up @@ -496,7 +496,7 @@ def test_celeb(n_epochs=50):
dropout=True,
filter_sizes=[3, 3, 3],
activation=tf.nn.sigmoid,
ckpt_name='celeb.ckpt')
ckpt_name='./celeb.ckpt')


def test_sita():
Expand Down Expand Up @@ -524,7 +524,7 @@ def test_sita():
dropout=True,
filter_sizes=[3, 3, 3],
activation=tf.nn.sigmoid,
ckpt_name='sita.ckpt')
ckpt_name='./sita.ckpt')


if __name__ == '__main__':
Expand Down
6 changes: 3 additions & 3 deletions session-4/libs/vae.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def train_vae(files,
# Start up the queues for handling the image pipeline
threads = tf.train.start_queue_runners(sess=sess, coord=coord)

if os.path.exists(ckpt_name):
if os.path.exists(ckpt_name + '.index'):
saver.restore(sess, ckpt_name)

# Fit all training data
Expand Down Expand Up @@ -497,7 +497,7 @@ def test_celeb():
dropout=True,
filter_sizes=[3, 3, 3],
activation=tf.nn.sigmoid,
ckpt_name='celeb.ckpt')
ckpt_name='./celeb.ckpt')


def test_sita():
Expand Down Expand Up @@ -525,7 +525,7 @@ def test_sita():
dropout=True,
filter_sizes=[3, 3, 3],
activation=tf.nn.sigmoid,
ckpt_name='sita.ckpt')
ckpt_name='./sita.ckpt')


if __name__ == '__main__':
Expand Down
4 changes: 2 additions & 2 deletions session-5/libs/charrnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def train(txt, batch_size=100, sequence_length=150, n_cells=100, n_layers=3,
init_op = tf.global_variables_initializer()
saver = tf.train.Saver()
sess.run(init_op)
if os.path.exists(ckpt_name):
if os.path.exists(ckpt_name + '.index'):
saver.restore(sess, ckpt_name)
print("Model restored.")

Expand Down Expand Up @@ -190,7 +190,7 @@ def infer(txt, ckpt_name, n_iterations, n_cells=512, n_layers=3,
init_op = tf.global_variables_initializer()
saver = tf.train.Saver()
sess.run(init_op)
if os.path.exists(ckpt_name):
if os.path.exists(ckpt_name + '.index'):
saver.restore(sess, ckpt_name)
print("Model restored.")

Expand Down
6 changes: 3 additions & 3 deletions session-5/libs/vae.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def train_vae(files,
# Start up the queues for handling the image pipeline
threads = tf.train.start_queue_runners(sess=sess, coord=coord)

if os.path.exists(ckpt_name):
if os.path.exists(ckpt_name + '.index'):
saver.restore(sess, ckpt_name)

# Fit all training data
Expand Down Expand Up @@ -497,7 +497,7 @@ def test_celeb():
dropout=True,
filter_sizes=[3, 3, 3],
activation=tf.nn.sigmoid,
ckpt_name='celeb.ckpt')
ckpt_name='./celeb.ckpt')


def test_sita():
Expand Down Expand Up @@ -525,7 +525,7 @@ def test_sita():
dropout=True,
filter_sizes=[3, 3, 3],
activation=tf.nn.sigmoid,
ckpt_name='sita.ckpt')
ckpt_name='./sita.ckpt')


if __name__ == '__main__':
Expand Down
6 changes: 3 additions & 3 deletions session-5/session-5-part-1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@
},
"outputs": [],
"source": [
"ckpt_name = 'gan.ckpt'\n",
"ckpt_name = './gan.ckpt'\n",
"\n",
"sess = tf.Session()\n",
"saver = tf.train.Saver()\n",
Expand All @@ -726,7 +726,7 @@
"tf.get_default_graph().finalize()\n",
"threads = tf.train.start_queue_runners(sess=sess, coord=coord)\n",
"\n",
"if os.path.exists(ckpt_name):\n",
"if os.path.exists(ckpt_name + '.index'):\n",
" saver.restore(sess, ckpt_name)\n",
" print(\"VAE model restored.\")"
]
Expand Down Expand Up @@ -1601,7 +1601,7 @@
"t_i = 0\n",
"batch_i = 0\n",
"epoch_i = 0\n",
"ckpt_name = 'vaegan.ckpt'"
"ckpt_name = './vaegan.ckpt'"
]
},
{
Expand Down
12 changes: 6 additions & 6 deletions session-5/session-5-part-2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@
},
"outputs": [],
"source": [
"ckpt_name = 'trump.ckpt'\n",
"ckpt_name = './trump.ckpt'\n",
"g = tf.Graph()\n",
"n_layers = 3\n",
"n_cells = 512\n",
Expand All @@ -1047,7 +1047,7 @@
" n_cells=n_cells,\n",
" gradient_clip=10.0)\n",
" saver = tf.train.Saver()\n",
" if os.path.exists(ckpt_name):\n",
" if os.path.exists(ckpt_name + '.index'):\n",
" saver.restore(sess, ckpt_name)\n",
" print(\"Model restored.\")"
]
Expand Down Expand Up @@ -1109,7 +1109,7 @@
" n_cells=n_cells,\n",
" gradient_clip=10.0)\n",
" saver = tf.train.Saver()\n",
" if os.path.exists(ckpt_name):\n",
" if os.path.exists(ckpt_name + '.index'):\n",
" saver.restore(sess, ckpt_name)\n",
" print(\"Model restored.\")\n",
" \n",
Expand Down Expand Up @@ -1190,7 +1190,7 @@
" n_cells=n_cells,\n",
" gradient_clip=10.0)\n",
" saver = tf.train.Saver()\n",
" if os.path.exists(ckpt_name):\n",
" if os.path.exists(ckpt_name + '.index'):\n",
" saver.restore(sess, ckpt_name)\n",
" print(\"Model restored.\")\n",
" \n",
Expand Down Expand Up @@ -1275,7 +1275,7 @@
" n_cells=n_cells,\n",
" gradient_clip=10.0)\n",
" saver = tf.train.Saver()\n",
" if os.path.exists(ckpt_name):\n",
" if os.path.exists(ckpt_name + '.index'):\n",
" saver.restore(sess, ckpt_name)\n",
" print(\"Model restored.\")\n",
" \n",
Expand Down Expand Up @@ -1364,7 +1364,7 @@
" n_cells=n_cells,\n",
" gradient_clip=10.0)\n",
" saver = tf.train.Saver()\n",
" if os.path.exists(ckpt_name):\n",
" if os.path.exists(ckpt_name + '.index'):\n",
" saver.restore(sess, ckpt_name)\n",
" print(\"Model restored.\")\n",
" \n",
Expand Down

0 comments on commit 4e5fe26

Please sign in to comment.