Issue 1:
I've run into a strange problem involving both tf.train.Saver and an input pipeline based on tf.train.string_input_producer(). It seems as though the num_epochs parameter to tf.train.string_input_producer() stops working as intended after loading a saved model.

I'm currently using v0.8 but I suspect this is still an issue on v0.9 and above.

Environment info

Operating System: Mac OSX (10.11.6)

Tensorflow version: 0.8

pip version: 8.1.1

Steps to reproduce

1 - Create a new directory and add to it the files from the following gist: https://gist.github.com/6d730e1b3d331c4be34c9a57b0a39ccf . The 1.txt and 2.txt files simulate training data. The training.py file implements a simple input pipeline, taking in text files, and printing them line by line. Notice that the num_epochs parameter on line 28 is set to 1.

2 - Run $ python training.py test 1.txt. The output should resemble the following:

The multiplying villanies of nature
Do swarm upon him--from the western isles
And fortune, on his damned quarrel smiling,
Show'd like a rebel's whore: but all's too weak:
For brave Macbeth--well he deserves that name--
Model saved to ./model-test-0
As two spent swimmers, that do cling together
Disdaining fortune, with his brandish'd steel,
And fix'd his head upon our battlements.
Like valour's minion carved out his passage
Which smoked with bloody execution,
Model saved to ./model-test-1
Till he unseam'd him from the nave to the chaps,
And choke their art. The merciless Macdonwald--
Of kerns and gallowglasses is supplied;
Worthy to be a rebel, for to that
Doubtful it stood;
Model saved to ./model-test-2
Done training!
Model saved to ./model-test-3

3 - Run $ python training.py test 2.txt. The output should be:

Done training!
Model saved to ./model-test-3

4 - Now, change the num_epochs parameter on line 28 from 1 to 2, and run $ python training.py test 2.txt again. In this case, we have something that resembles:

Letting 'I dare not' wait upon 'I would,'
As thou art in desire? Wouldst thou have that
Such I account thy love. Art thou afeard
Which thou esteem'st the ornament of life,
And wakes it now, to look so green and pale
Model saved to ./model-test-3
And live a coward in thine own esteem,
At what it did so freely? From this time
Like the poor cat i' the adage?
Wherein you dress'd yourself? hath it slept since?
To be the same in thine own act and valour
Model saved to ./model-test-4
Done training!
Model saved to ./model-test-5

5 - To cleanup, run $ rm checkpoint model-test-*.

There are two problems: First, the model does not continue to "train" in step 3. Second, when the num_epochs parameter is modified and it does continue to train, it doesn't reproduce the input twice, as it should (step 4).

Playing around with this, I notice that the initial value of num_epochs works as expected, e.g. if at step 1, num_epochs is set to 3, three copies of the input file will be produced. Further, step 4 yields similar results when the new value for num_epochs is larger than the previous value.

Issue 2:
The tf_upgrade_v2 tool fails to parse commands with common IPython functions (for example, !pip install tf-nightly and %matplotlib inline).

ERROR: Failed to parse.
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tensorflow/tools/compatibility/ast_edits.py", line 510, in update_string_pasta
t = pasta.parse(text)
File "/usr/local/lib/python3.6/dist-packages/pasta/__init__.py", line 23, in parse
t = ast_utils.parse(src)
File "/usr/local/lib/python3.6/dist-packages/pasta/base/ast_utils.py", line 56, in parse
tree = ast.parse(sanitize_source(src))
File "/usr/lib/python3.6/ast.py", line 35, in parse
return compile(source, filename, mode, PyCF_ONLY_AST)
File "<unknown>", line 37
!pip install tf-nightly
^
SyntaxError: invalid syntax