AttributeError Traceback (most recent call last)
24 }
25
---> 26 train_and_evaluate(args)
28 exporters = exporter)
29
---> 30 tf.estimator.train_and_evaluate(estimator = estimator, train_spec = train_spec, eval_spec = eval_spec)
31
/usr/local/envs/py3env/lib/python3.5/site-packages/tensorflow/python/estimator/training.py in train_and_evaluate(estimator, train_spec, eval_spec)
/usr/local/envs/py3env/lib/python3.5/site-packages/tensorflow/python/estimator/training.py in run(self)
/usr/local/envs/py3env/lib/python3.5/site-packages/tensorflow/python/estimator/training.py in run_local(self)
/usr/local/envs/py3env/lib/python3.5/site-packages/tensorflow/python/estimator/estimator.py in train(self, input_fn, hooks, steps, max_steps, saving_listeners)
/usr/local/envs/py3env/lib/python3.5/site-packages/tensorflow/python/estimator/estimator.py in _train_model(self, input_fn, hooks, saving_listeners)
/usr/local/envs/py3env/lib/python3.5/site-packages/tensorflow/python/estimator/estimator.py in _train_model_default(self, input_fn, hooks, saving_listeners)
/usr/local/envs/py3env/lib/python3.5/site-packages/tensorflow/python/estimator/estimator.py in _call_model_fn(self, features, labels, mode, config)
2 def model_fn(features, labels, mode, params):
3 # Create neural network input layer using our feature columns defined above
----> 4 net = tf.feature_column.input_layer(features = features, feature_columns = params["feature_columns"])
5
6 # Create hidden layers by looping through hidden unit list
/usr/local/envs/py3env/lib/python3.5/site-packages/tensorflow/python/feature_column/feature_column.py in input_layer(features, feature_columns, weight_collections, trainable, cols_to_vars)
275 cols_to_vars: If not None, must be a dictionary that will be filled with a
276 mapping from _FeatureColumn to list of Variables. For example, after
--> 277 the call, we might have cols_to_vars =
278 {_EmbeddingColumn(
279 categorical_column=_HashedCategoricalColumn(
/usr/local/envs/py3env/lib/python3.5/site-packages/tensorflow/python/feature_column/feature_column.py in _internal_input_layer(features, feature_columns, weight_collections, trainable, cols_to_vars, scope)
200 with variable_scope.variable_scope(
201 None, default_name=column._var_scope_name): # pylint: disable=protected-access
--> 202 tensor = column._get_dense_tensor( # pylint: disable=protected-access
203 builder,
204 weight_collections=weight_collections,
/usr/local/envs/py3env/lib/python3.5/site-packages/tensorflow_hub/feature_column.py in _get_dense_tensor(failed resolving arguments)
156 del weight_collections
157 text_batch = tf.reshape(inputs.get(self), shape=[-1])
--> 158 m = module.Module(self.module_spec, trainable=self.trainable and trainable)
159 return m(text_batch)
160
/usr/local/envs/py3env/lib/python3.5/site-packages/tensorflow_hub/module.py in __init__(self, spec, trainable, name, tags)
167 name=self._name,
168 trainable=self._trainable,
--> 169 tags=self._tags)
170 # pylint: enable=protected-access
171
/usr/local/envs/py3env/lib/python3.5/site-packages/tensorflow_hub/native_module.py in _create_impl(self, name, trainable, tags)
338 trainable=trainable,
339 checkpoint_path=self._checkpoint_variables_path,
--> 340 name=name)
341
342 def _export(self, path, variables_saver):
/usr/local/envs/py3env/lib/python3.5/site-packages/tensorflow_hub/native_module.py in __init__(self, spec, meta_graph, trainable, checkpoint_path, name)
388 # when creating the Module state. This use case has showed up in some
389 # TPU training code.
--> 390 with tf.init_scope():
391 self._init_state(name)
392
@mabodx Whats the version of tensorflow? Can you please share the code or a snippet which helps me reproduce this issue. Thanks!
I have the same problem, here is my version setting
tf.__version__, hub.__version__
> ('1.9.0', '0.4.0')
Here is the code that produce the problem
module_handle = "https://tfhub.dev/google/faster_rcnn/openimages_v4/inception_resnet_v2/1"
with tf.device('/device:GPU:0'):
with tf.Graph().as_default():
detector = hub.Module(module_handle)
@dattran2346 'init_scope' module is only available in tensorflow versions >=1.11. So, please upgrade the version of tensorflow to run the hub module successfully. For more information regarding 'init_scope' please refer to the following documentation.
@gowtham-kp so what is alternative of init_scope() for 1.9
@Mubashshira Please post this question in Tensorflow/Tensorflow repo as you can get the answer faster there. Thanks!
@Mubashshira did you figure this out? Having the same issue
@Mubashshira same here
@VitalieStirbu and @bustedor I checked that tensorflow 1.9 doesnt have init_scope() as an attribute in it, hence while downloading the models we need to download models associated with tensorflow 1.9.
For more help we can follow some https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 this site where in step 2a. they have provided different model repository github links. here is for tensorflow1.9: https://github.com/tensorflow/models/tree/d530ac540b0103caa194b4824af353f1b073553b . this can be taken as for help for a reference for your project . I hope this might help somewhat.
@Mubashshira Thank you very much sir. I'd set up everything from scratch for 4times and kept getting that 'init_scope' error. I was about to lose it :) appreciate that.
@VitalieStirbu and @bustedor I checked that tensorflow 1.9 doesnt have init_scope() as an attribute in it, hence while downloading the models we need to download models associated with tensorflow 1.9.
For more help we can follow some https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 this site where in step 2a. they have provided different model repository github links. here is for tensorflow1.9: https://github.com/tensorflow/models/tree/d530ac540b0103caa194b4824af353f1b073553b . this can be taken as for help for a reference for your project . I hope this might help somewhat.
that means i have to train new model?
Most helpful comment
@VitalieStirbu and @bustedor I checked that tensorflow 1.9 doesnt have init_scope() as an attribute in it, hence while downloading the models we need to download models associated with tensorflow 1.9.
For more help we can follow some https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 this site where in step 2a. they have provided different model repository github links. here is for tensorflow1.9: https://github.com/tensorflow/models/tree/d530ac540b0103caa194b4824af353f1b073553b . this can be taken as for help for a reference for your project . I hope this might help somewhat.