I have the following error, and I am new to data science and python
I am using python, keras, tensorflow
from tensorflow.python.profiler import trace
ImportError: cannot import name 'trace'
Full error report
Training network heads
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\keras\callbacks\tensorboard_v1.py", line 96, in __init__
from tensorflow.contrib.tensorboard.plugins import projector
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\contrib\__init__.py", line 39, in <module>
from tensorflow.contrib import compiler
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\contrib\compiler\__init__.py", line 21, in <module>
from tensorflow.contrib.compiler import jit
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\contrib\compiler\__init__.py", line 22, in <module>
from tensorflow.contrib.compiler import xla
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\contrib\compiler\xla.py", line 22, in <module>
from tensorflow.python.estimator import model_fn as model_fn_lib
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\python\estimator\model_fn.py", line 26, in <module>
from tensorflow_estimator.python.estimator import model_fn
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\__init__.py", line 10, in <module>
from tensorflow_estimator._api.v1 import estimator
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\_api\v1\estimator\__init__.py", line 10, in <module>
from tensorflow_estimator._api.v1.estimator import experimental
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\_api\v1\estimator\experimental\__init__.py", line 10, in <module>
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\python\estimator\canned\dnn.py", line 27, in <module>
from tensorflow_estimator.python.estimator import estimator
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 36, in <module>
from tensorflow.python.profiler import trace
ImportError: cannot import name 'trace'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 3343, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-6-712e23ddfaeb>", line 8, in <module>
layers='heads')
File "F:\Khalid\Documents\miniconda3\envs\crowdai-mapping-challenge-mask-rcnn-master\crowdai-mapping-challenge-mask-rcnn-master\mrcnn\model.py", line 2287, in train
histogram_freq=0, write_graph=True, write_images=False),
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\keras\callbacks\tensorboard_v1.py", line 98, in __init__
raise ImportError('You need the TensorFlow (v1) module installed to '
ImportError: You need the TensorFlow (v1) module installed to use TensorBoard.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 2044, in showtraceback
stb = value._render_traceback_()
AttributeError: 'ImportError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1169, in get_records
return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 316, in wrapped
return f(*args, **kwargs)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 350, in _fixed_getinnerframes
records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\inspect.py", line 1490, in getinnerframes
frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\inspect.py", line 1448, in getframeinfo
filename = getsourcefile(frame) or getfile(frame)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\inspect.py", line 696, in getsourcefile
if getattr(getmodule(object, filename), '__loader__', None) is not None:
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\inspect.py", line 733, in getmodule
if ismodule(module) and hasattr(module, '__file__'):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tensorflow_core.estimator'
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\keras\callbacks\tensorboard_v1.py", line 96, in __init__
from tensorflow.contrib.tensorboard.plugins import projector
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\contrib\__init__.py", line 39, in <module>
from tensorflow.contrib import compiler
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\contrib\compiler\__init__.py", line 21, in <module>
from tensorflow.contrib.compiler import jit
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\contrib\compiler\__init__.py", line 22, in <module>
from tensorflow.contrib.compiler import xla
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\contrib\compiler\xla.py", line 22, in <module>
from tensorflow.python.estimator import model_fn as model_fn_lib
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\python\estimator\model_fn.py", line 26, in <module>
from tensorflow_estimator.python.estimator import model_fn
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\__init__.py", line 10, in <module>
from tensorflow_estimator._api.v1 import estimator
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\_api\v1\estimator\__init__.py", line 10, in <module>
from tensorflow_estimator._api.v1.estimator import experimental
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\_api\v1\estimator\experimental\__init__.py", line 10, in <module>
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\python\estimator\canned\dnn.py", line 27, in <module>
from tensorflow_estimator.python.estimator import estimator
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 36, in <module>
from tensorflow.python.profiler import trace
ImportError: cannot import name 'trace'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 3343, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-6-712e23ddfaeb>", line 8, in <module>
layers='heads')
File "F:\Khalid\Documents\miniconda3\envs\crowdai-mapping-challenge-mask-rcnn-master\crowdai-mapping-challenge-mask-rcnn-master\mrcnn\model.py", line 2287, in train
histogram_freq=0, write_graph=True, write_images=False),
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\keras\callbacks\tensorboard_v1.py", line 98, in __init__
raise ImportError('You need the TensorFlow (v1) module installed to '
ImportError: You need the TensorFlow (v1) module installed to use TensorBoard.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 2044, in showtraceback
stb = value._render_traceback_()
AttributeError: 'ImportError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 3263, in run_ast_nodes
if (await self.run_code(code, result, async_=asy)):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 3360, in run_code
self.showtraceback(running_compiled_code=True)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 2047, in showtraceback
value, tb, tb_offset=tb_offset)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1436, in structured_traceback
self, etype, value, tb, tb_offset, number_of_lines_of_context)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1336, in structured_traceback
self, etype, value, tb, tb_offset, number_of_lines_of_context
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1193, in structured_traceback
tb_offset)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1150, in format_exception_as_a_whole
last_unique, recursion_repeat = find_recursion(orig_etype, evalue, records)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 451, in find_recursion
return len(records), 0
TypeError: object of type 'NoneType' has no len()
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 2044, in showtraceback
stb = value._render_traceback_()
AttributeError: 'TypeError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1169, in get_records
return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 316, in wrapped
return f(*args, **kwargs)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 350, in _fixed_getinnerframes
records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\inspect.py", line 1490, in getinnerframes
frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\inspect.py", line 1448, in getframeinfo
filename = getsourcefile(frame) or getfile(frame)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\inspect.py", line 696, in getsourcefile
if getattr(getmodule(object, filename), '__loader__', None) is not None:
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\inspect.py", line 733, in getmodule
if ismodule(module) and hasattr(module, '__file__'):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tensorflow_core.estimator'
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\keras\callbacks\tensorboard_v1.py", line 96, in __init__
from tensorflow.contrib.tensorboard.plugins import projector
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\contrib\__init__.py", line 39, in <module>
from tensorflow.contrib import compiler
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\contrib\compiler\__init__.py", line 21, in <module>
from tensorflow.contrib.compiler import jit
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\contrib\compiler\__init__.py", line 22, in <module>
from tensorflow.contrib.compiler import xla
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\contrib\compiler\xla.py", line 22, in <module>
from tensorflow.python.estimator import model_fn as model_fn_lib
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_core\python\estimator\model_fn.py", line 26, in <module>
from tensorflow_estimator.python.estimator import model_fn
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\__init__.py", line 10, in <module>
from tensorflow_estimator._api.v1 import estimator
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\_api\v1\estimator\__init__.py", line 10, in <module>
from tensorflow_estimator._api.v1.estimator import experimental
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\_api\v1\estimator\experimental\__init__.py", line 10, in <module>
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\python\estimator\canned\dnn.py", line 27, in <module>
from tensorflow_estimator.python.estimator import estimator
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 36, in <module>
from tensorflow.python.profiler import trace
ImportError: cannot import name 'trace'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 3343, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-6-712e23ddfaeb>", line 8, in <module>
layers='heads')
File "F:\Khalid\Documents\miniconda3\envs\crowdai-mapping-challenge-mask-rcnn-master\crowdai-mapping-challenge-mask-rcnn-master\mrcnn\model.py", line 2287, in train
histogram_freq=0, write_graph=True, write_images=False),
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\keras\callbacks\tensorboard_v1.py", line 98, in __init__
raise ImportError('You need the TensorFlow (v1) module installed to '
ImportError: You need the TensorFlow (v1) module installed to use TensorBoard.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 2044, in showtraceback
stb = value._render_traceback_()
AttributeError: 'ImportError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 3263, in run_ast_nodes
if (await self.run_code(code, result, async_=asy)):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 3360, in run_code
self.showtraceback(running_compiled_code=True)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 2047, in showtraceback
value, tb, tb_offset=tb_offset)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1436, in structured_traceback
self, etype, value, tb, tb_offset, number_of_lines_of_context)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1336, in structured_traceback
self, etype, value, tb, tb_offset, number_of_lines_of_context
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1193, in structured_traceback
tb_offset)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1150, in format_exception_as_a_whole
last_unique, recursion_repeat = find_recursion(orig_etype, evalue, records)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 451, in find_recursion
return len(records), 0
TypeError: object of type 'NoneType' has no len()
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 2044, in showtraceback
stb = value._render_traceback_()
AttributeError: 'TypeError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 2895, in _run_cell
return runner(coro)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\async_helpers.py", line 68, in _pseudo_sync_runner
coro.send(None)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 3072, in run_cell_async
interactivity=interactivity, compiler=compiler, result=result)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 3282, in run_ast_nodes
self.showtraceback()
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 2047, in showtraceback
value, tb, tb_offset=tb_offset)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1436, in structured_traceback
self, etype, value, tb, tb_offset, number_of_lines_of_context)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1336, in structured_traceback
self, etype, value, tb, tb_offset, number_of_lines_of_context
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1211, in structured_traceback
chained_exceptions_tb_offset)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1150, in format_exception_as_a_whole
last_unique, recursion_repeat = find_recursion(orig_etype, evalue, records)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 451, in find_recursion
return len(records), 0
TypeError: object of type 'NoneType' has no len()
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\interactiveshell.py", line 2044, in showtraceback
stb = value._render_traceback_()
AttributeError: 'TypeError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 1169, in get_records
return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 316, in wrapped
return f(*args, **kwargs)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\IPython\core\ultratb.py", line 350, in _fixed_getinnerframes
records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\inspect.py", line 1490, in getinnerframes
frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\inspect.py", line 1448, in getframeinfo
filename = getsourcefile(frame) or getfile(frame)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\inspect.py", line 696, in getsourcefile
if getattr(getmodule(object, filename), '__loader__', None) is not None:
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\inspect.py", line 733, in getmodule
if ismodule(module) and hasattr(module, '__file__'):
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
module = self._load()
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\site-packages\tensorflow\__init__.py", line 44, in _load
module = _importlib.import_module(self.__name__)
File "F:\Khalid\Documents\miniconda3\envs\crowdAI2\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tensorflow_core.estimator'
Upgrade the Tensorflow version
pip install tensorflow --upgrade
In Tensorflow 2.7.0. Use
from tensorflow.profiler.experimental import Trace
I have some issues while trying to load saved models back into keras. Saving the model goes fine:
In [6]: model.save('savefile', save_format='tf')
INFO:tensorflow:Assets written to: savefile/assets
But when loading the model, I got the following error:
In [7]: tf.keras.models.load_model('savefile')
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-7-ddb252fa0c51>", line 1, in <module>
tf.keras.models.load_model('lofasz.xx')
File "/usr/local/lib/python3.5/dist-packages/tensorflow_core/python/keras/saving/save.py", line 190, in load_model
return saved_model_load.load(filepath, compile)
File "/usr/local/lib/python3.5/dist-packages/tensorflow_core/python/keras/saving/saved_model/load.py", line 105, in load
model = tf_load.load_internal(path, loader_cls=KerasObjectLoader)
File "/usr/local/lib/python3.5/dist-packages/tensorflow_core/python/saved_model/load.py", line 599, in load_internal
export_dir)
File "/usr/local/lib/python3.5/dist-packages/tensorflow_core/python/keras/saving/saved_model/load.py", line 170, in __init__
super(KerasObjectLoader, self).__init__(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow_core/python/saved_model/load.py", line 122, in __init__
self._load_all()
File "/usr/local/lib/python3.5/dist-packages/tensorflow_core/python/keras/saving/saved_model/load.py", line 183, in _load_all
self._finalize_objects()
File "/usr/local/lib/python3.5/dist-packages/tensorflow_core/python/keras/saving/saved_model/load.py", line 394, in _finalize_objects
self._reconstruct_all_models()
File "/usr/local/lib/python3.5/dist-packages/tensorflow_core/python/keras/saving/saved_model/load.py", line 412, in _reconstruct_all_models
self._reconstruct_model(model_id, model, layers)
File "/usr/local/lib/python3.5/dist-packages/tensorflow_core/python/keras/saving/saved_model/load.py", line 442, in _reconstruct_model
model._set_inputs(input_shape) # pylint: disable=protected-access
File "/usr/local/lib/python3.5/dist-packages/tensorflow_core/python/keras/engine/training.py", line 2448, in _set_inputs
inputs = self._set_input_attrs(inputs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow_core/python/training/tracking/base.py", line 456, in _method_wrapper
result = method(self, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow_core/python/keras/engine/training.py", line 2487, in _set_input_attrs
input_shape = (None,) + tuple(inputs.shape[1:])
AttributeError: 'list' object has no attribute 'shape'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 1821, in showtraceback
stb = value._render_traceback_()
AttributeError: 'AttributeError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/IPython/core/ultratb.py", line 1132, in get_records
return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
File "/usr/lib/python3/dist-packages/IPython/core/ultratb.py", line 313, in wrapped
return f(*args, **kwargs)
File "/usr/lib/python3/dist-packages/IPython/core/ultratb.py", line 358, in _fixed_getinnerframes
records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
File "/usr/lib/python3.5/inspect.py", line 1454, in getinnerframes
frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
File "/usr/lib/python3.5/inspect.py", line 1411, in getframeinfo
filename = getsourcefile(frame) or getfile(frame)
File "/usr/lib/python3.5/inspect.py", line 671, in getsourcefile
if getattr(getmodule(object, filename), '__loader__', None) is not None:
File "/usr/lib/python3.5/inspect.py", line 717, in getmodule
os.path.realpath(f)] = module.__name__
AttributeError: module has no attribute '__name__'
---------------------------------------------------------------------------
Loading with tf.saved_model.load does work:
In [9]: qq=tf.saved_model.load('savefile')
In [10]: qq
Out[10]: <tensorflow.python.saved_model.load.Loader._recreate_base_user_object.<locals>._UserObject at 0x7fdff155feb8>
but I didn't find anything on how to get this back as a keras model. Any ideas?