Ошибка ValueError: Неподдерживаемые операции в модели перед оптимизацией - PullRequest
0 голосов
/ 04 мая 2020

Я пытаюсь использовать существующую модель BERT для распознавания именованных объектов. Я пытаюсь импортировать модуль Tensorflow Hub. Сначала я получаю сообщение о том, что подпись «по умолчанию» не существует. Когда я добавляю «--signature_name = serve_default» к команде, я получаю еще одну ошибку «ValueError: Неподдерживаемые операции в модели перед оптимизацией». В любом случае, как я могу это исправить?

Или, если вы знаете другую модель, которую я мог бы импортировать для той же цели, это тоже было бы здорово. Спасибо!

    ➜  ~ tensorflowjs_converter --input_format=tf_hub 'https://tfhub.dev/tensorflow/bert_en_cased_L-12_H-768_A-12/2' /Users/chuck/Desktop/tensorflow


Loading the module using TF 2.X interface from /var/folders/t6/yzgsxmd10vv_fpnbfggnkpyc0000gn/T/tfhub_modules/b55ef8d5f0b10168408eaea487327661b3570756.


2020-05-02 18:17:02.775492: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7ff737fdbe10 initialized for platform Host (this does not guarantee that XLA will be used). Devices:


2020-05-02 18:17:02.775545: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version


Traceback (most recent call last):


  File "/Users/chuck/.local/share/virtualenvs/chuck-93PtiaPm/bin/tensorflowjs_converter", line 8, in <module>


    sys.exit(pip_main())


  File "/Users/chuck/.local/share/virtualenvs/chuck-93PtiaPm/lib/python3.7/site-packages/tensorflowjs/converters/converter.py", line 671, in pip_main


    main([' '.join(sys.argv[1:])])


  File "/Users/chuck/.local/share/virtualenvs/chuck-93PtiaPm/lib/python3.7/site-packages/tensorflowjs/converters/converter.py", line 675, in main


    convert(argv[0].split(' '))


  File "/Users/chuck/.local/share/virtualenvs/chuck-93PtiaPm/lib/python3.7/site-packages/tensorflowjs/converters/converter.py", line 628, in convert


    weight_shard_size_bytes=weight_shard_size_bytes)


  File "/Users/chuck/.local/share/virtualenvs/chuck-93PtiaPm/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 619, in convert_tf_hub_module


    weight_shard_size_bytes=weight_shard_size_bytes)


  File "/Users/chuck/.local/share/virtualenvs/chuck-93PtiaPm/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 439, in convert_tf_saved_model


    _check_signature_in_model(model, signature_def)


  File "/Users/chuck/.local/share/virtualenvs/chuck-93PtiaPm/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 305, in _check_signature_in_model


    saved_model.signatures.keys()))


ValueError: Signature 'default' does not exist. The following signatures are available: KeysView(_SignatureMap({'serving_default': <tensorflow.python.saved_model.load._WrapperFunction object at 0x12ed4c450>}))


(chuck) ➜  ~ tensorflowjs_converter --input_format=tf_hub 'https://tfhub.dev/tensorflow/bert_en_cased_L-12_H-768_A-12/2' /Users/chuck/Desktop/tensorflow --signature_name=serving_default


Loading the module using TF 2.X interface from /var/folders/t6/yzgsxmd10vv_fpnbfggnkpyc0000gn/T/tfhub_modules/b55ef8d5f0b10168408eaea487327661b3570756.


2020-05-02 18:25:34.754281: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7fcba5091170 initialized for platform Host (this does not guarantee that XLA will be used). Devices:


2020-05-02 18:25:34.754315: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version


2020-05-02 18:25:44.064951: I tensorflow/core/grappler/devices.cc:60] Number of eligible GPUs (core count >= 8, compute capability >= 0.0): 0 (Note: TensorFlow was not compiled with CUDA support)


2020-05-02 18:25:44.065980: I tensorflow/core/grappler/clusters/single_machine.cc:356] Starting new session


2020-05-02 18:25:44.361755: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:814] Optimization results for grappler item: graph_to_optimize


2020-05-02 18:25:44.361821: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:816]   function_optimizer: Graph size after: 205 nodes (0), 206 edges (0), time = 82.705ms.


2020-05-02 18:25:44.361837: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:816]   function_optimizer: Graph size after: 205 nodes (0), 206 edges (0), time = 60.812ms.


2020-05-02 18:25:44.361849: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:814] Optimization results for grappler item: __inference__wrapped_model_10424


2020-05-02 18:25:44.361860: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:816]   function_optimizer: function_optimizer did nothing. time = 1.035ms.


2020-05-02 18:25:44.361871: I tensorflow/core/grappler/optimizers/meta_optimizer.cc:816]   function_optimizer: function_optimizer did nothing. time = 0.002ms.


Traceback (most recent call last):


  File "/Users/chuck/.local/share/virtualenvs/chuck-93PtiaPm/bin/tensorflowjs_converter", line 8, in <module>


    sys.exit(pip_main())


  File "/Users/chuck/.local/share/virtualenvs/chuck-93PtiaPm/lib/python3.7/site-packages/tensorflowjs/converters/converter.py", line 671, in pip_main


    main([' '.join(sys.argv[1:])])


  File "/Users/chuck/.local/share/virtualenvs/chuck-93PtiaPm/lib/python3.7/site-packages/tensorflowjs/converters/converter.py", line 675, in main


    convert(argv[0].split(' '))


  File "/Users/chuck/.local/share/virtualenvs/chuck-93PtiaPm/lib/python3.7/site-packages/tensorflowjs/converters/converter.py", line 628, in convert


    weight_shard_size_bytes=weight_shard_size_bytes)


  File "/Users/chuck/.local/share/virtualenvs/chuck-93PtiaPm/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 619, in convert_tf_hub_module


    weight_shard_size_bytes=weight_shard_size_bytes)


  File "/Users/chuck/.local/share/virtualenvs/chuck-93PtiaPm/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 462, in convert_tf_saved_model


    weight_shard_size_bytes=weight_shard_size_bytes)


  File "/Users/chuck/.local/share/virtualenvs/chuck-93PtiaPm/lib/python3.7/site-packages/tensorflowjs/converters/tf_saved_model_conversion_v2.py", line 142, in optimize_graph


    ', '.join(unsupported))


ValueError: Unsupported Ops in the model before optimization
...