Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Variable generator/Conv/weights does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=tf.AUTO_REUSE in VarScope? #67

Open
WestbrookZero opened this issue Jan 30, 2024 · 1 comment

Comments

@WestbrookZero
Copy link

我的tensorflow-gpu版本是1.15.0,当使用export.py中的如下代码报错
代码:
exporter = CartoonTranslationExporter()
exporter.export_frozen_graph_def(
ckpt_path=ckpt_path, frozen_graph_path=pb_path)
报错信息如下:
WARNING:tensorflow:From D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\contrib\layers\python\layers\layers.py:1057: Layer.apply (from tensorflow.python.keras.engine.base_layer) is deprecated and will be removed in a future version.
Instructions for updating:
Please use layer.call method instead.
Traceback (most recent call last):
File "G:/Project/Face/ModelScope00/export00.py", line 55, in
ckpt_path=ckpt_path, frozen_graph_path=pb_path)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\modelscope\exporters\cv\cartoon_translation_exporter.py", line 39, in export_frozen_graph_def
output = model(input)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\modelscope\models\cv\cartoon\model_tf.py", line 34, in call
output = unet_generator(input_photo)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\modelscope\models\cv\cartoon\network.py", line 75, in unet_generator
x0 = slim.convolution2d(inputs, channel, [7, 7], activation_fn=None)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\contrib\framework\python\ops\arg_scope.py", line 182, in func_with_args
return func(*args, **current_args)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\contrib\layers\python\layers\layers.py", line 1159, in convolution2d
conv_dims=2)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\contrib\framework\python\ops\arg_scope.py", line 182, in func_with_args
return func(*args, **current_args)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\contrib\layers\python\layers\layers.py", line 1057, in convolution
outputs = layer.apply(inputs)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 324, in new_func
return func(*args, **kwargs)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\python\keras\engine\base_layer.py", line 1700, in apply
return self.call(inputs, *args, **kwargs)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\python\layers\base.py", line 548, in call
outputs = super(Layer, self).call(inputs, *args, **kwargs)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\python\keras\engine\base_layer.py", line 824, in call
self._maybe_build(inputs)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\python\keras\engine\base_layer.py", line 2146, in _maybe_build
self.build(input_shapes)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\python\keras\layers\convolutional.py", line 165, in build
dtype=self.dtype)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\python\layers\base.py", line 461, in add_weight
**kwargs)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\python\keras\engine\base_layer.py", line 529, in add_weight
aggregation=aggregation)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\python\training\tracking\base.py", line 712, in _add_variable_with_custom_getter
**kwargs_for_getter)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 1500, in get_variable
aggregation=aggregation)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 1243, in get_variable
aggregation=aggregation)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 550, in get_variable
return custom_getter(**custom_getter_kwargs)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\contrib\layers\python\layers\layers.py", line 1761, in layer_variable_getter
return _model_variable_getter(getter, *args, **kwargs)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\contrib\layers\python\layers\layers.py", line 1752, in _model_variable_getter
aggregation=aggregation)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\contrib\framework\python\ops\arg_scope.py", line 182, in func_with_args
return func(*args, **current_args)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\contrib\framework\python\ops\variables.py", line 351, in model_variable
aggregation=aggregation)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\contrib\framework\python\ops\arg_scope.py", line 182, in func_with_args
return func(*args, **current_args)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\contrib\framework\python\ops\variables.py", line 281, in variable
aggregation=aggregation)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 519, in _true_getter
aggregation=aggregation)
File "D:\InstallPath\Develop\Anaconda3\2020.07\envs\dctnet\lib\site-packages\tensorflow_core\python\ops\variable_scope.py", line 886, in _get_single_variable
"reuse=tf.AUTO_REUSE in VarScope?" % name)
ValueError: Variable generator/Conv/weights does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=tf.AUTO_REUSE in VarScope?

@wiggin66
Copy link

Hi, I have encountered the same problem. Have you resolved it @WestbrookZero @menyifang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants