Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

TensorFlowEstimator.restore error for text_classification.py example #40

Closed
harsimranb opened this issue Dec 19, 2015 · 0 comments
Closed

Comments

@harsimranb
Copy link

I am using the text_classification.py example. I have added the following code to save and restore a model:

To save:

classifier = skflow.TensorFlowEstimator(model_fn=self.rnn_model, n_classes=15,
                                                    steps=1000, optimizer='Adam', learning_rate=0.01,
                                                    continue_training=True

To restore:

classifier = skflow.TensorFlowEstimator.restore(self.trained_model_path)

On restore, I'm getting the following error:

Traceback (most recent call last):
  File "/Users/me/PycharmProjects/TensorFlowTest/TextRNN.py", line 56, in run_classification
    classifier = skflow.TensorFlowEstimator.restore(self.trained_model_path)
  File "/Users/me/Library/Python/2.7/lib/python/site-packages/skflow/__init__.py", line 317, in restore
    estimator = eval(model_def) 
  File "<string>", line 2
    model_fn=<bound method TextRNN.rnn_model of <__main__.TextRNN object at 0x10ef3f450>>,
             ^
SyntaxError: invalid syntax

Within the restore method, model_def looks like this:

TensorFlowEstimator(batch_size=32, continue_training=True, learning_rate=0.01,
          model_fn=<bound method TextRNN.rnn_model of <__main__.TextRNN object at 0x10ef3f450>>,
          n_classes=15, num_cores=4, optimizer='Adam', steps=1000,
          tf_master='', tf_random_seed=42, verbose=1)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant