google / prettytensor

Pretty Tensor: Fluent Networks in TensorFlow
1.24k stars 151 forks source link

AttributeError: type object 'GraphKeys' has no attribute 'GLOBAL_VARIABLES' #46

Closed Mahmoodsalah closed 7 years ago

Mahmoodsalah commented 7 years ago

each time tried to use pretty tensor I faced this error

with pt.defaults_scope(activation_fn=tf.nn.relu):
    y_pred, loss = x_pretty.\
        conv2d(kernel=5, depth=16, name='layer_conv1').\
        max_pool(kernel=2, stride=2).\
        conv2d(kernel=5, depth=36, name='layer_conv2').\
        max_pool(kernel=2, stride=2).\
        flatten().\
        fully_connected(size=128, name='layer_fc1').\
        softmax_classifier(num_classes=num_classes, labels=y_true)

Error here:

`---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-22-ab75212e54e0> in <module>()
      1 with pt.defaults_scope(activation_fn=tf.nn.relu):
----> 2     y_pred, loss = x_pretty.        conv2d(kernel=5, depth=16, name='layer_conv1').        max_pool(kernel=2, stride=2).        conv2d(kernel=5, depth=36, name='layer_conv2').        max_pool(kernel=2, stride=2).        flatten().        fully_connected(size=128, name='layer_fc1').        softmax_classifier(num_classes=num_classes, labels=y_true)

/home/mahmoodsalah/anaconda3/envs/CarND-TensorFlow-Lab/lib/python3.5/site-packages/prettytensor/pretty_tensor_class.py in method(*original_args, **kwargs)
   1968           result = self.create_deferred(func, non_seq_layer, args, kwargs, name)
   1969         else:
-> 1970           result = func(non_seq_layer, *args, **kwargs)
   1971         return input_layer._method_complete(result)
   1972       # Exit with because Template handles that.

/home/mahmoodsalah/anaconda3/envs/CarND-TensorFlow-Lab/lib/python3.5/site-packages/prettytensor/pretty_tensor_image_methods.py in __call__(self, input_layer, kernel, depth, activation_fn, stride, l2loss, weights, bias, edges, batch_normalize, phase, parameter_modifier, name)
    209     params = parameter_modifier(
    210         'weights',
--> 211         self.variable('weights', size, weights, dt=dtype),
    212         phase)
    213     y = tf.nn.conv2d(input_layer, params, stride, edges)

/home/mahmoodsalah/anaconda3/envs/CarND-TensorFlow-Lab/lib/python3.5/site-packages/prettytensor/pretty_tensor_class.py in variable(self, var_name, shape, init, dt, train)
   1660         train = _defaults.get('trainable_variables', True)
   1661       variable_collections = _defaults.get('variable_collections', ())
-> 1662       if tf.GraphKeys.GLOBAL_VARIABLES not in variable_collections:
   1663         variable_collections = list(variable_collections) + [
   1664             tf.GraphKeys.GLOBAL_VARIABLES]

AttributeError: type object 'GraphKeys' has no attribute 'GLOBAL_VARIABLES'`
eiderman commented 7 years ago

What version of tensorflow and which version of pretty tensor are you using? With the push to tensorflow 1.0, the has been a lot of API churn and this is one of the variables that changed.

On Mon, Feb 6, 2017, 6:34 AM Mahmood Salah notifications@github.com wrote:

each time tried to use pretty tensor I faced this error

with pt.defaults_scope(activation_fn=tf.nn.relu): y_pred, loss = x_pretty.\ conv2d(kernel=5, depth=16, name='layer_conv1').\ max_pool(kernel=2, stride=2).\ conv2d(kernel=5, depth=36, name='layer_conv2').\ max_pool(kernel=2, stride=2).\ flatten().\ fully_connected(size=128, name='layer_fc1').\ softmax_classifier(num_classes=num_classes, labels=y_true)

Error here:

`--------------------------------------------------------------------------- AttributeError Traceback (most recent call last)

in () 1 with pt.defaults_scope(activation_fn=tf.nn.relu): ----> 2 y_pred, loss = x_pretty. conv2d(kernel=5, depth=16, name='layer_conv1'). max_pool(kernel=2, stride=2). conv2d(kernel=5, depth=36, name='layer_conv2'). max_pool(kernel=2, stride=2). flatten(). fully_connected(size=128, name='layer_fc1'). softmax_classifier(num_classes=num_classes, labels=y_true) /home/mahmoodsalah/anaconda3/envs/CarND-TensorFlow-Lab/lib/python3.5/site-packages/prettytensor/pretty_tensor_class.py in method(*original_args, **kwargs) 1968 result = self.create_deferred(func, non_seq_layer, args, kwargs, name) 1969 else: -> 1970 result = func(non_seq_layer, *args, **kwargs) 1971 return input_layer._method_complete(result) 1972 # Exit with because Template handles that. /home/mahmoodsalah/anaconda3/envs/CarND-TensorFlow-Lab/lib/python3.5/site-packages/prettytensor/pretty_tensor_image_methods.py in __call__(self, input_layer, kernel, depth, activation_fn, stride, l2loss, weights, bias, edges, batch_normalize, phase, parameter_modifier, name) 209 params = parameter_modifier( 210 'weights', --> 211 self.variable('weights', size, weights, dt=dtype), 212 phase) 213 y = tf.nn.conv2d(input_layer, params, stride, edges) /home/mahmoodsalah/anaconda3/envs/CarND-TensorFlow-Lab/lib/python3.5/site-packages/prettytensor/pretty_tensor_class.py in variable(self, var_name, shape, init, dt, train) 1660 train = _defaults.get('trainable_variables', True) 1661 variable_collections = _defaults.get('variable_collections', ()) -> 1662 if tf.GraphKeys.GLOBAL_VARIABLES not in variable_collections: 1663 variable_collections = list(variable_collections) + [ 1664 tf.GraphKeys.GLOBAL_VARIABLES] AttributeError: type object 'GraphKeys' has no attribute 'GLOBAL_VARIABLES'` — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub , or mute the thread .
Mahmoodsalah commented 7 years ago

'0.11.0' tensorflow 0.7.1' pretty tensor

eiderman commented 7 years ago

There is no version of Pretty Tensor that will work well with Tensorflow 0.11 They have made many changes very quickly, but TF 1.0 should stabilize things a bit.