Created
February 18, 2019 22:23
-
-
Save hmeine/d7ef0c38790dc885f3f73e621e14ff31 to your computer and use it in GitHub Desktop.
compare_gan_model_fn_problem.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "compare_gan_model_fn_problem.ipynb", | |
"version": "0.3.2", | |
"provenance": [], | |
"collapsed_sections": [], | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python2", | |
"display_name": "Python 2" | |
}, | |
"accelerator": "GPU" | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/hmeine/d7ef0c38790dc885f3f73e621e14ff31/compare_gan_model_fn_problem.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"metadata": { | |
"id": "kjX0lEWL1Sym", | |
"colab_type": "code", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 1062 | |
}, | |
"outputId": "73495bfe-c433-4dd2-a6ff-ceb3e26d0ca1" | |
}, | |
"cell_type": "code", | |
"source": [ | |
"!pip install https://github.com/google/compare_gan/archive/master.zip" | |
], | |
"execution_count": 1, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"Collecting https://github.com/google/compare_gan/archive/master.zip\n", | |
" Downloading https://github.com/google/compare_gan/archive/master.zip\n", | |
"\u001b[K \\ 1.6MB 93.9MB/s\n", | |
"Requirement already satisfied (use --upgrade to upgrade): compare-gan==1.0 from https://github.com/google/compare_gan/archive/master.zip in /usr/local/lib/python2.7/dist-packages\n", | |
"Requirement already satisfied: future in /usr/local/lib/python2.7/dist-packages (from compare-gan==1.0) (0.16.0)\n", | |
"Requirement already satisfied: numpy in /usr/local/lib/python2.7/dist-packages (from compare-gan==1.0) (1.14.6)\n", | |
"Requirement already satisfied: pandas in /usr/local/lib/python2.7/dist-packages (from compare-gan==1.0) (0.22.0)\n", | |
"Requirement already satisfied: protobuf in /usr/local/lib/python2.7/dist-packages (from compare-gan==1.0) (3.6.1)\n", | |
"Requirement already satisfied: six in /usr/local/lib/python2.7/dist-packages (from compare-gan==1.0) (1.11.0)\n", | |
"Requirement already satisfied: tensor2tensor in /usr/local/lib/python2.7/dist-packages (from compare-gan==1.0) (1.11.0)\n", | |
"Requirement already satisfied: pytz>=2011k in /usr/local/lib/python2.7/dist-packages (from pandas->compare-gan==1.0) (2018.9)\n", | |
"Requirement already satisfied: python-dateutil in /usr/local/lib/python2.7/dist-packages (from pandas->compare-gan==1.0) (2.5.3)\n", | |
"Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages (from protobuf->compare-gan==1.0) (40.8.0)\n", | |
"Requirement already satisfied: requests in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (2.18.4)\n", | |
"Requirement already satisfied: flask in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (1.0.2)\n", | |
"Requirement already satisfied: gunicorn in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (19.9.0)\n", | |
"Requirement already satisfied: oauth2client in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (4.1.3)\n", | |
"Requirement already satisfied: mesh-tensorflow in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (0.0.5)\n", | |
"Requirement already satisfied: tfds-nightly in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (1.0.0.dev201902140105)\n", | |
"Requirement already satisfied: google-api-python-client in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (1.6.7)\n", | |
"Requirement already satisfied: tqdm in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (4.28.1)\n", | |
"Requirement already satisfied: bz2file in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (0.98)\n", | |
"Requirement already satisfied: gevent in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (1.4.0)\n", | |
"Requirement already satisfied: sympy in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (1.1.1)\n", | |
"Requirement already satisfied: gym in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (0.10.11)\n", | |
"Requirement already satisfied: tensorflow-probability in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (0.5.0)\n", | |
"Requirement already satisfied: h5py in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (2.8.0)\n", | |
"Requirement already satisfied: scipy in /usr/local/lib/python2.7/dist-packages (from tensor2tensor->compare-gan==1.0) (1.1.0)\n", | |
"Requirement already satisfied: idna<2.7,>=2.5 in /usr/local/lib/python2.7/dist-packages (from requests->tensor2tensor->compare-gan==1.0) (2.6)\n", | |
"Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/local/lib/python2.7/dist-packages (from requests->tensor2tensor->compare-gan==1.0) (1.22)\n", | |
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/dist-packages (from requests->tensor2tensor->compare-gan==1.0) (2018.11.29)\n", | |
"Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/dist-packages (from requests->tensor2tensor->compare-gan==1.0) (3.0.4)\n", | |
"Requirement already satisfied: Werkzeug>=0.14 in /usr/local/lib/python2.7/dist-packages (from flask->tensor2tensor->compare-gan==1.0) (0.14.1)\n", | |
"Requirement already satisfied: click>=5.1 in /usr/local/lib/python2.7/dist-packages (from flask->tensor2tensor->compare-gan==1.0) (7.0)\n", | |
"Requirement already satisfied: Jinja2>=2.10 in /usr/local/lib/python2.7/dist-packages (from flask->tensor2tensor->compare-gan==1.0) (2.10)\n", | |
"Requirement already satisfied: itsdangerous>=0.24 in /usr/local/lib/python2.7/dist-packages (from flask->tensor2tensor->compare-gan==1.0) (1.1.0)\n", | |
"Requirement already satisfied: httplib2>=0.9.1 in /usr/local/lib/python2.7/dist-packages (from oauth2client->tensor2tensor->compare-gan==1.0) (0.11.3)\n", | |
"Requirement already satisfied: rsa>=3.1.4 in /usr/local/lib/python2.7/dist-packages (from oauth2client->tensor2tensor->compare-gan==1.0) (4.0)\n", | |
"Requirement already satisfied: pyasn1>=0.1.7 in /usr/local/lib/python2.7/dist-packages (from oauth2client->tensor2tensor->compare-gan==1.0) (0.4.5)\n", | |
"Requirement already satisfied: pyasn1-modules>=0.0.5 in /usr/local/lib/python2.7/dist-packages (from oauth2client->tensor2tensor->compare-gan==1.0) (0.2.4)\n", | |
"Requirement already satisfied: futures in /usr/local/lib/python2.7/dist-packages (from tfds-nightly->tensor2tensor->compare-gan==1.0) (3.2.0)\n", | |
"Requirement already satisfied: enum34 in /usr/local/lib/python2.7/dist-packages (from tfds-nightly->tensor2tensor->compare-gan==1.0) (1.1.6)\n", | |
"Requirement already satisfied: wrapt in /usr/local/lib/python2.7/dist-packages (from tfds-nightly->tensor2tensor->compare-gan==1.0) (1.11.1)\n", | |
"Requirement already satisfied: promise in /usr/local/lib/python2.7/dist-packages (from tfds-nightly->tensor2tensor->compare-gan==1.0) (2.2.1)\n", | |
"Requirement already satisfied: tensorflow-metadata in /usr/local/lib/python2.7/dist-packages (from tfds-nightly->tensor2tensor->compare-gan==1.0) (0.9.0)\n", | |
"Requirement already satisfied: termcolor in /usr/local/lib/python2.7/dist-packages (from tfds-nightly->tensor2tensor->compare-gan==1.0) (1.1.0)\n", | |
"Requirement already satisfied: functools32 in /usr/local/lib/python2.7/dist-packages (from tfds-nightly->tensor2tensor->compare-gan==1.0) (3.2.3.post2)\n", | |
"Requirement already satisfied: absl-py in /usr/local/lib/python2.7/dist-packages (from tfds-nightly->tensor2tensor->compare-gan==1.0) (0.7.0)\n", | |
"Requirement already satisfied: uritemplate<4dev,>=3.0.0 in /usr/local/lib/python2.7/dist-packages (from google-api-python-client->tensor2tensor->compare-gan==1.0) (3.0.0)\n", | |
"Requirement already satisfied: greenlet>=0.4.14; platform_python_implementation == \"CPython\" in /usr/local/lib/python2.7/dist-packages (from gevent->tensor2tensor->compare-gan==1.0) (0.4.15)\n", | |
"Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python2.7/dist-packages (from sympy->tensor2tensor->compare-gan==1.0) (1.1.0)\n", | |
"Requirement already satisfied: pyglet>=1.2.0 in /usr/local/lib/python2.7/dist-packages (from gym->tensor2tensor->compare-gan==1.0) (1.3.2)\n", | |
"Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib/python2.7/dist-packages (from Jinja2>=2.10->flask->tensor2tensor->compare-gan==1.0) (1.1.0)\n", | |
"Requirement already satisfied: typing>=3.6.4; python_version < \"3.5\" in /usr/local/lib/python2.7/dist-packages (from promise->tfds-nightly->tensor2tensor->compare-gan==1.0) (3.6.6)\n", | |
"Requirement already satisfied: googleapis-common-protos in /usr/local/lib/python2.7/dist-packages (from tensorflow-metadata->tfds-nightly->tensor2tensor->compare-gan==1.0) (1.5.8)\n", | |
"Building wheels for collected packages: compare-gan\n", | |
" Building wheel for compare-gan (setup.py) ... \u001b[?25ldone\n", | |
"\u001b[?25h Stored in directory: /tmp/pip-ephem-wheel-cache-B70JSQ/wheels/c1/24/72/6f08cf0ceddc060aa540eb1495df2e08b9aca929adedcafefb\n", | |
"Successfully built compare-gan\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"id": "Hzs7BZbu9-oK", | |
"colab_type": "code", | |
"outputId": "3760f815-d0ca-4cf6-ff2a-efa8c0950381", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 52 | |
} | |
}, | |
"cell_type": "code", | |
"source": [ | |
"!pip install pstar" | |
], | |
"execution_count": 2, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"Requirement already satisfied: pstar in /usr/local/lib/python2.7/dist-packages (0.1.6)\n", | |
"Requirement already satisfied: qj in /usr/local/lib/python2.7/dist-packages (from pstar) (0.1.5)\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"id": "Qqsvhi743TBM", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"cell_type": "code", | |
"source": [ | |
"# hide jupyter commandline arguments from compare_gan\n", | |
"import sys\n", | |
"sys.argv = ['colab']" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"id": "y_pRHBrT1sxJ", | |
"colab_type": "code", | |
"outputId": "3b6e8026-6ad6-4d26-eb9c-1775c5f433f5", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 139 | |
} | |
}, | |
"cell_type": "code", | |
"source": [ | |
"from compare_gan.src import gan_lib" | |
], | |
"execution_count": 3, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"\n", | |
"WARNING: The TensorFlow contrib module will not be included in TensorFlow 2.0.\n", | |
"For more information, please see:\n", | |
" * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md\n", | |
" * https://github.com/tensorflow/addons\n", | |
"If you depend on functionality not listed there, please file an issue.\n", | |
"\n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"id": "UvUZBkVQ3UMo", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"cell_type": "code", | |
"source": [ | |
"dataset = 'mnist'\n", | |
"dataset_content = gan_lib.load_dataset(dataset, split_name=\"train\")\n", | |
"dataset_content = dataset_content.repeat().shuffle(10000, seed=gan_lib.DEFAULT_DATASET_SEED)\n", | |
"\n", | |
"gan = gan_lib.create_gan(\n", | |
" gan_type='WGAN_GP',\n", | |
" dataset=dataset,\n", | |
" dataset_content=dataset_content,\n", | |
" options={u'architecture': u'infogan_arch',\n", | |
" u'batch_size': 64,\n", | |
" u'beta1': 0.5,\n", | |
" u'dataset': u'fake',\n", | |
" u'disc_iters': 5,\n", | |
" u'discriminator_normalization': u'none',\n", | |
" u'eval_test_samples': 50,\n", | |
" u'gan_type': u'WGAN_GP',\n", | |
" u'lambda': 10.0,\n", | |
" u'learning_rate': 9.999999747378752e-05,\n", | |
" u'save_checkpoint_steps': 10000,\n", | |
" u'tf_seed': 42,\n", | |
" u'training_steps': 100,\n", | |
" u'z_dim': 64},\n", | |
" gan_log_dir='log_dir',\n", | |
" result_dir='result_dir',\n", | |
" checkpoint_dir='checkpoint_dir')" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"metadata": { | |
"id": "Rj6AIULXGeXa", | |
"colab_type": "code", | |
"outputId": "530a5c21-52ff-4232-d7bc-c8fc60a2724e", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 2303 | |
} | |
}, | |
"cell_type": "code", | |
"source": [ | |
"import tensorflow as tf\n", | |
"gan.train_with_estimator(tf.contrib.tpu.RunConfig())" | |
], | |
"execution_count": 8, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"WARNING:tensorflow:Estimator's model_fn (<bound method WGAN_GP._model_fn of <compare_gan.src.gans.WGAN_GP.WGAN_GP object at 0x7f54031d8a90>>) includes params argument, but params are not passed to Estimator.\n", | |
"WARNING:tensorflow:Using temporary folder as model directory: /tmp/tmpxEzI8z\n", | |
"INFO:tensorflow:Using config: {'_save_checkpoints_secs': 600, '_session_config': allow_soft_placement: true\n", | |
"graph_options {\n", | |
" rewrite_options {\n", | |
" meta_optimizer_iterations: ONE\n", | |
" }\n", | |
"}\n", | |
", '_keep_checkpoint_max': 5, '_task_type': 'worker', '_train_distribute': None, '_is_chief': True, '_cluster_spec': <tensorflow.python.training.server_lib.ClusterSpec object at 0x7f5403181890>, '_model_dir': '/tmp/tmpxEzI8z', '_protocol': None, '_save_checkpoints_steps': None, '_keep_checkpoint_every_n_hours': 10000, '_service': None, '_num_ps_replicas': 0, '_tpu_config': TPUConfig(iterations_per_loop=2, num_shards=None, num_cores_per_replica=None, per_host_input_for_training=2, tpu_job_name=None, initial_infeed_sleep_secs=None, input_partition_dims=None), '_tf_random_seed': None, '_save_summary_steps': 100, '_device_fn': None, '_cluster': None, '_experimental_distribute': None, '_num_worker_replicas': 1, '_task_id': 0, '_log_step_count_steps': None, '_evaluation_master': '', '_eval_distribute': None, '_global_id_in_cluster': 0, '_master': ''}\n", | |
"INFO:tensorflow:_TPUContext: eval_on_tpu True\n", | |
"WARNING:tensorflow:eval_on_tpu ignored because use_tpu is False.\n", | |
"WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/resource_variable_ops.py:435: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.\n", | |
"Instructions for updating:\n", | |
"Colocations handled automatically by placer.\n", | |
"WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/compare_gan/src/gans/abstract_gan.py:334: make_one_shot_iterator (from tensorflow.python.data.ops.dataset_ops) is deprecated and will be removed in a future version.\n", | |
"Instructions for updating:\n", | |
"Use `for ... in dataset:` to iterate over a dataset. If using `tf.estimator`, return the `Dataset` object directly from your input function. As a last resort, you can use `tf.compat.v1.data.make_one_shot_iterator(dataset)`.\n", | |
"WARNING:tensorflow:The graph (<tensorflow.python.framework.ops.Graph object at 0x7f5468c89d10>) of the iterator is different from the graph (<tensorflow.python.framework.ops.Graph object at 0x7f54035a8550>) the dataset: <DatasetV1Adapter shapes: ((?, ?, ?), ()), types: (tf.float32, tf.int32)> was created in. If you are using the Estimator API, make sure that no part of the dataset returned by the `input_fn` function is defined outside the `input_fn` function.Please ensure that all datasets in the pipeline are created in the same graph as the iterator. NOTE: This warning will become an error in future versions of TensorFlow.\n", | |
"WARNING:tensorflow:The graph (<tensorflow.python.framework.ops.Graph object at 0x7f5468c89d10>) of the iterator is different from the graph (<tensorflow.python.framework.ops.Graph object at 0x7f54035a8550>) the dataset: <DatasetV1Adapter shapes: ((?, ?, ?), ()), types: (tf.float32, tf.int32)> was created in. If you are using the Estimator API, make sure that no part of the dataset returned by the `input_fn` function is defined outside the `input_fn` function.Please ensure that all datasets in the pipeline are created in the same graph as the iterator. NOTE: This warning will become an error in future versions of TensorFlow.\n", | |
"WARNING:tensorflow:The graph (<tensorflow.python.framework.ops.Graph object at 0x7f5468c89d10>) of the iterator is different from the graph (<tensorflow.python.framework.ops.Graph object at 0x7f54035a8550>) the dataset: <DatasetV1Adapter shapes: ((?, ?, ?), ()), types: (tf.float32, tf.int32)> was created in. If you are using the Estimator API, make sure that no part of the dataset returned by the `input_fn` function is defined outside the `input_fn` function.Please ensure that all datasets in the pipeline are created in the same graph as the iterator. NOTE: This warning will become an error in future versions of TensorFlow.\n", | |
"WARNING:tensorflow:The graph (<tensorflow.python.framework.ops.Graph object at 0x7f5468c89d10>) of the iterator is different from the graph (<tensorflow.python.framework.ops.Graph object at 0x7f54035a8550>) the dataset: <TFRecordDatasetV1 shapes: (), types: tf.string> was created in. If you are using the Estimator API, make sure that no part of the dataset returned by the `input_fn` function is defined outside the `input_fn` function.Please ensure that all datasets in the pipeline are created in the same graph as the iterator. NOTE: This warning will become an error in future versions of TensorFlow.\n", | |
"WARNING:tensorflow:The graph (<tensorflow.python.framework.ops.Graph object at 0x7f5468c89d10>) of the iterator is different from the graph (<tensorflow.python.framework.ops.Graph object at 0x7f54035a8550>) the dataset: <TensorSliceDataset shapes: (), types: tf.string> was created in. If you are using the Estimator API, make sure that no part of the dataset returned by the `input_fn` function is defined outside the `input_fn` function.Please ensure that all datasets in the pipeline are created in the same graph as the iterator. NOTE: This warning will become an error in future versions of TensorFlow.\n", | |
"WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/compare_gan/src/gans/abstract_gan.py:338: to_float (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.\n", | |
"Instructions for updating:\n", | |
"Use tf.cast instead.\n", | |
"INFO:tensorflow:Calling model_fn.\n", | |
"INFO:tensorflow:Running train on CPU\n", | |
"INFO:tensorflow:Error recorded from training_loop: _model_fn() must be implemented in subclasses of AbstractGAN.\n", | |
"INFO:tensorflow:training_loop marked as finished\n", | |
"WARNING:tensorflow:Reraising captured error\n" | |
], | |
"name": "stdout" | |
}, | |
{ | |
"output_type": "error", | |
"ename": "NotImplementedError", | |
"evalue": "ignored", | |
"traceback": [ | |
"\u001b[0;31m\u001b[0m", | |
"\u001b[0;31mNotImplementedError\u001b[0mTraceback (most recent call last)", | |
"\u001b[0;32m<ipython-input-8-b6e6886d6953>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mtensorflow\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mtf\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mgan\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrain_with_estimator\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcontrib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtpu\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mRunConfig\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", | |
"\u001b[0;32m/usr/local/lib/python2.7/dist-packages/compare_gan/src/gans/abstract_gan.pyc\u001b[0m in \u001b[0;36mtrain_with_estimator\u001b[0;34m(self, config, warm_start_from)\u001b[0m\n\u001b[1;32m 396\u001b[0m \u001b[0meval_batch_size\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mbs\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 397\u001b[0m warm_start_from=warm_start_from)\n\u001b[0;32m--> 398\u001b[0;31m \u001b[0mestimator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput_fn\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_input_fn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmax_steps\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtraining_steps\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 399\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 400\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mtrain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msess\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mprogress_reporter\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/tpu/python/tpu/tpu_estimator.pyc\u001b[0m in \u001b[0;36mtrain\u001b[0;34m(self, input_fn, hooks, steps, max_steps, saving_listeners)\u001b[0m\n\u001b[1;32m 2455\u001b[0m \u001b[0;32mfinally\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2456\u001b[0m \u001b[0mrendezvous\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecord_done\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'training_loop'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2457\u001b[0;31m \u001b[0mrendezvous\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mraise_errors\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2458\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2459\u001b[0m def evaluate(self,\n", | |
"\u001b[0;32m/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/tpu/python/tpu/error_handling.pyc\u001b[0m in \u001b[0;36mraise_errors\u001b[0;34m(self, timeout_sec)\u001b[0m\n\u001b[1;32m 126\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 127\u001b[0m \u001b[0mlogging\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwarn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Reraising captured error'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 128\u001b[0;31m \u001b[0msix\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreraise\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtyp\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtraceback\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 129\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 130\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mk\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mtyp\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtraceback\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mkept_errors\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/tpu/python/tpu/tpu_estimator.pyc\u001b[0m in \u001b[0;36mtrain\u001b[0;34m(self, input_fn, hooks, steps, max_steps, saving_listeners)\u001b[0m\n\u001b[1;32m 2450\u001b[0m \u001b[0msteps\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0msteps\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2451\u001b[0m \u001b[0mmax_steps\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmax_steps\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2452\u001b[0;31m saving_listeners=saving_listeners)\n\u001b[0m\u001b[1;32m 2453\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# pylint: disable=broad-except\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2454\u001b[0m \u001b[0mrendezvous\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrecord_error\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'training_loop'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msys\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexc_info\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m/usr/local/lib/python2.7/dist-packages/tensorflow_estimator/python/estimator/estimator.pyc\u001b[0m in \u001b[0;36mtrain\u001b[0;34m(self, input_fn, hooks, steps, max_steps, saving_listeners)\u001b[0m\n\u001b[1;32m 356\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 357\u001b[0m \u001b[0msaving_listeners\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_check_listeners_type\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msaving_listeners\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 358\u001b[0;31m \u001b[0mloss\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_train_model\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput_fn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhooks\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msaving_listeners\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 359\u001b[0m \u001b[0mlogging\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minfo\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Loss for final step: %s.'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mloss\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 360\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m/usr/local/lib/python2.7/dist-packages/tensorflow_estimator/python/estimator/estimator.pyc\u001b[0m in \u001b[0;36m_train_model\u001b[0;34m(self, input_fn, hooks, saving_listeners)\u001b[0m\n\u001b[1;32m 1122\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_train_model_distributed\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput_fn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhooks\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msaving_listeners\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1123\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1124\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_train_model_default\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput_fn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhooks\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msaving_listeners\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1125\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1126\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_train_model_default\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minput_fn\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mhooks\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msaving_listeners\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m/usr/local/lib/python2.7/dist-packages/tensorflow_estimator/python/estimator/estimator.pyc\u001b[0m in \u001b[0;36m_train_model_default\u001b[0;34m(self, input_fn, hooks, saving_listeners)\u001b[0m\n\u001b[1;32m 1152\u001b[0m \u001b[0mworker_hooks\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mextend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minput_hooks\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1153\u001b[0m estimator_spec = self._call_model_fn(\n\u001b[0;32m-> 1154\u001b[0;31m features, labels, model_fn_lib.ModeKeys.TRAIN, self.config)\n\u001b[0m\u001b[1;32m 1155\u001b[0m \u001b[0mglobal_step_tensor\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mtraining_util\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_global_step\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1156\u001b[0m return self._train_with_estimator_spec(estimator_spec, worker_hooks,\n", | |
"\u001b[0;32m/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/tpu/python/tpu/tpu_estimator.pyc\u001b[0m in \u001b[0;36m_call_model_fn\u001b[0;34m(self, features, labels, mode, config)\u001b[0m\n\u001b[1;32m 2249\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2250\u001b[0m return super(TPUEstimator, self)._call_model_fn(features, labels, mode,\n\u001b[0;32m-> 2251\u001b[0;31m config)\n\u001b[0m\u001b[1;32m 2252\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2253\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_call_model_fn_for_inference\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeatures\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmode\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mconfig\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m/usr/local/lib/python2.7/dist-packages/tensorflow_estimator/python/estimator/estimator.pyc\u001b[0m in \u001b[0;36m_call_model_fn\u001b[0;34m(self, features, labels, mode, config)\u001b[0m\n\u001b[1;32m 1110\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1111\u001b[0m \u001b[0mlogging\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minfo\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Calling model_fn.'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1112\u001b[0;31m \u001b[0mmodel_fn_results\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_model_fn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfeatures\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfeatures\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1113\u001b[0m \u001b[0mlogging\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minfo\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Done calling model_fn.'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1114\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/tpu/python/tpu/tpu_estimator.pyc\u001b[0m in \u001b[0;36m_model_fn\u001b[0;34m(features, labels, mode, config, params)\u001b[0m\n\u001b[1;32m 2532\u001b[0m \u001b[0mlogging\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0minfo\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Running %s on CPU'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2533\u001b[0m estimator_spec = model_fn_wrapper.call_without_tpu(\n\u001b[0;32m-> 2534\u001b[0;31m features, labels, is_export_mode=is_export_mode)\n\u001b[0m\u001b[1;32m 2535\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_log_every_n_steps\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2536\u001b[0m estimator_spec = estimator_spec._replace(\n", | |
"\u001b[0;32m/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/tpu/python/tpu/tpu_estimator.pyc\u001b[0m in \u001b[0;36mcall_without_tpu\u001b[0;34m(self, features, labels, is_export_mode)\u001b[0m\n\u001b[1;32m 1321\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1322\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mcall_without_tpu\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfeatures\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mis_export_mode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1323\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_call_model_fn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfeatures\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mis_export_mode\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mis_export_mode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1324\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1325\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mconvert_to_single_tpu_train_step\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdequeue_fn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;32m/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/tpu/python/tpu/tpu_estimator.pyc\u001b[0m in \u001b[0;36m_call_model_fn\u001b[0;34m(self, features, labels, is_export_mode)\u001b[0m\n\u001b[1;32m 1591\u001b[0m \u001b[0m_add_item_to_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_CTX_KEY\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0muser_context\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1592\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1593\u001b[0;31m \u001b[0mestimator_spec\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_model_fn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfeatures\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfeatures\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1594\u001b[0m if (running_on_cpu and\n\u001b[1;32m 1595\u001b[0m isinstance(estimator_spec, model_fn_lib._TPUEstimatorSpec)): # pylint: disable=protected-access\n", | |
"\u001b[0;32m/usr/local/lib/python2.7/dist-packages/compare_gan/src/gans/abstract_gan.pyc\u001b[0m in \u001b[0;36m_model_fn\u001b[0;34m(self, features, labels, mode, params)\u001b[0m\n\u001b[1;32m 372\u001b[0m \"\"\"\n\u001b[1;32m 373\u001b[0m raise NotImplementedError(\n\u001b[0;32m--> 374\u001b[0;31m \"_model_fn() must be implemented in subclasses of AbstractGAN.\")\n\u001b[0m\u001b[1;32m 375\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 376\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mtrain_with_estimator\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mconfig\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mwarm_start_from\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
"\u001b[0;31mNotImplementedError\u001b[0m: _model_fn() must be implemented in subclasses of AbstractGAN." | |
] | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"id": "vUKjzH2PqoxF", | |
"colab_type": "code", | |
"outputId": "e9501f58-e65d-49c9-99d3-303acfae9ee1", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 173 | |
} | |
}, | |
"cell_type": "code", | |
"source": [ | |
"!pip list | grep tensor" | |
], | |
"execution_count": 0, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"text": [ | |
"mesh-tensorflow 0.0.5 \n", | |
"tensor2tensor 1.11.0 \n", | |
"tensorboard 1.12.2 \n", | |
"tensorboardcolab 0.0.22 \n", | |
"tensorflow 1.13.0rc1 \n", | |
"tensorflow-estimator 1.13.0rc0 \n", | |
"tensorflow-hub 0.2.0 \n", | |
"tensorflow-metadata 0.9.0 \n", | |
"tensorflow-probability 0.5.0 \n" | |
], | |
"name": "stdout" | |
} | |
] | |
}, | |
{ | |
"metadata": { | |
"id": "FA0suxxiqpgV", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"cell_type": "code", | |
"source": [ | |
"" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment