microsoft / MMdnn

MMdnn is a set of tools to help users inter-operate among different deep learning frameworks. E.g. model conversion and visualization. Convert models between Caffe, Keras, MXNet, Tensorflow, CNTK, PyTorch Onnx and CoreML.
MIT License
5.8k stars 965 forks source link

module 'tensorflow' has no attribute 'reset_default_graph' #878

Closed Zhen-hao closed 4 years ago

Zhen-hao commented 4 years ago

hi, I got this error trying to convert a fine-tuned BERT model in TF2 to ONNX.

The command is

mmconvert -sf tensorflow -iw my_path/saved_model.pb --inNodeName input --dstNodeName TestModel -df onnx -om tf_bert

the error is

Traceback (most recent call last):
  File "/nix/store/1g361hsh3i1f1y55b4qi0nml7f7mb4dl-python3.7-mmdnn-0.3.1/bin/.mmconvert-wrapped", line 9, in <module>
    sys.exit(_main())
  File "/nix/store/1g361hsh3i1f1y55b4qi0nml7f7mb4dl-python3.7-mmdnn-0.3.1/lib/python3.7/site-packages/mmdnn/conversion/_script/convert.py", line 102, in _main
    ret = convertToIR._convert(ir_args)
  File "/nix/store/1g361hsh3i1f1y55b4qi0nml7f7mb4dl-python3.7-mmdnn-0.3.1/lib/python3.7/site-packages/mmdnn/conversion/_script/convertToIR.py", line 59, in _convert
    parser = TensorflowParser2(args.weights, inputshape, args.inNodeName, args.dstNodeName)
  File "/nix/store/1g361hsh3i1f1y55b4qi0nml7f7mb4dl-python3.7-mmdnn-0.3.1/lib/python3.7/site-packages/mmdnn/conversion/tensorflow/tensorflow_frozenparser.py", line 120, in __init__
    tensorflow.reset_default_graph()
AttributeError: module 'tensorflow' has no attribute 'reset_default_graph'
linmajia commented 4 years ago

@Zhen-hao , thank you very much for the feedback. Currently, MMdnn supports up to TF 1.15.1 . You may downgrade TF and have a try.

Zhen-hao commented 4 years ago

@linmajia thanks! let me close it.