e-AIトランスレートに失敗します(再)

Tensorflowで組んだ学習モデルをe-AIトランスレータで変換をかけた結果、

トランスレータに失敗してしまいます。

logの内容は以下の通りです。

[2021-08-17 15:54:45,750 INFO tftranslate_utils.py:1218 - check_for_input_shape() ] The input shape used in the tensorflow model is [1, 1, 4000, 1]
[2021-08-17 15:54:45,757 INFO network_decoder_tensorflow.py:364 - generate_network() ] The tensorflow frozen model is decoded..
[2021-08-17 15:54:49,596 INFO weights_generator_tensorflow.py:602 - generate_weights_and_biases() ] The tensorflow frozen model is read and the layer-wise weights and biases are stored in 'E:\e2studio\workspace_20210810\norti_rzt1\src\Translator\weights.h' .
[2021-08-17 15:54:53,003 INFO code_generator.py:1450 - <module>() ] Currently running version: v160
[2021-08-17 15:54:53,160 ERROR requirements.py:183 - log_exception() ] eAI-501 : Uncaught Exception
An unhandled exception has caused this script to terminate prematurely. Here are the details :

[2021-08-17 15:54:53,161 INFO requirements.py:184 - log_exception() ] Translation FAILED!!
[2021-08-17 15:54:53,162 INFO requirements.py:155 - remove_object() ] Uninitializing and cleaning up the translator object..

【使用環境】 e2studio(v6.3.0)+ e-AIトランスレータ v1.6.0

【Tensorflow】 v.1.14.0

なにかエラーログの内容からお気づきの点があれば、アドバイスいただけると幸いです。

ちなみに、サンプルとして提示されている下記のパイソンコードでは正常にトランスレートすることが出来ました。

(環境はすべて同じです)

gadget.renesas.com/.../mnist_tutorial.html
→ページ内の「mnist_softmax_for_e-ai.py」

よろしくお願いします。

Parents
  • JKさん、こんにちは。スタッフのDartsmanです。

    エラーログの貼り付け、ありがとうございます。

    確認しましたが、発生しているのが例外エラーとなっておりまして、このログ情報だけでは何が原因か分かりませんでした。

    お手数ですが以下2点追加で情報をお願いできないでしょうか?

    ・上記で省略した部分のログ

    ・実際にトランスレートに失敗したモデルファイル

    ファイルを投稿に加える場合、編集画面下の「Insert」→「Image/Video/File」と選択し、

    「Browse to upload a file」をクリックいただくと添付するファイルを選択いただけます。

    よろしくお願いいたします。

  • dartsmanさま

    ご確認ありがとうございます。ログファイル全体を添付させていただきました。15:54から開始されているのが今回の失敗に関するログです。

    その続きで、16:08から開始されるログもあるかと思います。それはサンプルのMNITSのモデルをトランスレートした際の成功時のログになります。

    よろしくお願いします。

  • 後半です。

    145 ops in the final graph.

    [2021-08-17 15:54:45,750 INFO tftranslate_utils.py:1218 - check_for_input_shape() ] The input shape used in the tensorflow model is [1, 1, 4000, 1]
    [2021-08-17 15:54:45,757 INFO network_decoder_tensorflow.py:364 - generate_network() ] The tensorflow frozen model is decoded..
    [2021-08-17 15:54:49,596 INFO weights_generator_tensorflow.py:602 - generate_weights_and_biases() ] The tensorflow frozen model is read and the layer-wise weights and biases are stored in 'E:\e2studio\workspace_20210810\norti_rzt1\src\Translator\weights.h' .
    [2021-08-17 15:54:53,003 INFO code_generator.py:1450 - <module>() ] Currently running version: v160
    [2021-08-17 15:54:53,160 ERROR requirements.py:183 - log_exception() ] eAI-501 : Uncaught Exception
    An unhandled exception has caused this script to terminate prematurely. Here are the details :

    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_qint8 = np.dtype([("qint8", np.int8, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_qint16 = np.dtype([("qint16", np.int16, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_qint32 = np.dtype([("qint32", np.int32, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    np_resource = np.dtype([("resource", np.ubyte, 1)])
    Traceback (most recent call last):
    File ".\bin\code_generator.py", line 1454, in <module>
    File ".\bin\code_generator.py", line 1337, in generate_code
    File ".\bin\error_code.py", line 37, in reraise
    File ".\bin\code_generator.py", line 1333, in generate_code
    File ".\bin\code_generator.py", line 792, in generate_c_header
    File ".\bin\error_code.py", line 37, in reraise
    File ".\bin\code_generator.py", line 788, in generate_c_header
    File ".\bin\tensorflow_dep\network_builder_tensorflow.py", line 414, in generate_layer_shapes
    File ".\bin\tensorflow_dep\network_builder_tensorflow.py", line 414, in <listcomp>
    KeyError: 'Placeholder_1_0'

    [2021-08-17 15:54:53,161 INFO requirements.py:184 - log_exception() ] Translation FAILED!!
    [2021-08-17 15:54:53,162 INFO requirements.py:155 - remove_object() ] Uninitializing and cleaning up the translator object..

  • 中盤です。

    145 ops in the final graph.

    [2021-08-17 15:54:45,750 INFO tftranslate_utils.py:1218 - check_for_input_shape() ] The input shape used in the tensorflow model is [1, 1, 4000, 1]
    [2021-08-17 15:54:45,757 INFO network_decoder_tensorflow.py:364 - generate_network() ] The tensorflow frozen model is decoded..
    [2021-08-17 15:54:49,596 INFO weights_generator_tensorflow.py:602 - generate_weights_and_biases() ] The tensorflow frozen model is read and the layer-wise weights and biases are stored in 'E:\e2studio\workspace_20210810\norti_rzt1\src\Translator\weights.h' .
    [2021-08-17 15:54:53,003 INFO code_generator.py:1450 - <module>() ] Currently running version: v160
    [2021-08-17 15:54:53,160 ERROR requirements.py:183 - log_exception() ] eAI-501 : Uncaught Exception
    An unhandled exception has caused this script to terminate prematurely. Here are the details :

    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_qint8 = np.dtype([("qint8", np.int8, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_qint16 = np.dtype([("qint16", np.int16, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_qint32 = np.dtype([("qint32", np.int32, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    np_resource = np.dtype([("resource", np.ubyte, 1)])
    Traceback (most recent call last):

  • 中盤です。

    145 ops in the final graph.

    [2021-08-17 15:54:45,750 INFO tftranslate_utils.py:1218 - check_for_input_shape() ] The input shape used in the tensorflow model is [1, 1, 4000, 1]
    [2021-08-17 15:54:45,757 INFO network_decoder_tensorflow.py:364 - generate_network() ] The tensorflow frozen model is decoded..
    [2021-08-17 15:54:49,596 INFO weights_generator_tensorflow.py:602 - generate_weights_and_biases() ] The tensorflow frozen model is read and the layer-wise weights and biases are stored in 'E:\e2studio\workspace_20210810\norti_rzt1\src\Translator\weights.h' .
    [2021-08-17 15:54:53,003 INFO code_generator.py:1450 - <module>() ] Currently running version: v160
    [2021-08-17 15:54:53,160 ERROR requirements.py:183 - log_exception() ] eAI-501 : Uncaught Exception
    An unhandled exception has caused this script to terminate prematurely. Here are the details :

  • さらに続きです。

    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_qint8 = np.dtype([("qint8", np.int8, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_qint16 = np.dtype([("qint16", np.int16, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_qint32 = np.dtype([("qint32", np.int32, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    np_resource = np.dtype([("resource", np.ubyte, 1)])

  • C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:523: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_qint8 = np.dtype([("qint8", np.int8, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:524: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_qint16 = np.dtype([("qint16", np.int16, 1)])

  • C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:526: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:527: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    _np_qint32 = np.dtype([("qint32", np.int32, 1)])
    C:\Users\junkun0804\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\dtypes.py:532: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
    np_resource = np.dtype([("resource", np.ubyte, 1)])

  • 最後です。

    Traceback (most recent call last):
    File ".\bin\code_generator.py", line 1454, in <module>
    File ".\bin\code_generator.py", line 1337, in generate_code
    File ".\bin\error_code.py", line 37, in reraise
    File ".\bin\code_generator.py", line 1333, in generate_code
    File ".\bin\code_generator.py", line 792, in generate_c_header
    File ".\bin\error_code.py", line 37, in reraise
    File ".\bin\code_generator.py", line 788, in generate_c_header
    File ".\bin\tensorflow_dep\network_builder_tensorflow.py", line 414, in generate_layer_shapes
    File ".\bin\tensorflow_dep\network_builder_tensorflow.py", line 414, in <listcomp>
    KeyError: 'Placeholder_1_0'

    [2021-08-17 15:54:53,161 INFO requirements.py:184 - log_exception() ] Translation FAILED!!
    [2021-08-17 15:54:53,162 INFO requirements.py:155 - remove_object() ] Uninitializing and cleaning up the translator object..

  • Traceback (most recent call last):
    File ".\bin\code_generator.py", line 1454, in <module>
    File ".\bin\code_generator.py", line 1337, in generate_code
    File ".\bin\error_code.py", line 37, in reraise
    File ".\bin\code_generator.py", line 1333, in generate_code
    File ".\bin\code_generator.py", line 792, in generate_c_header
    File ".\bin\error_code.py", line 37, in reraise
    File ".\bin\code_generator.py", line 788, in generate_c_header
    File ".\bin\tensorflow_dep\network_builder_tensorflow.py", line 414, in generate_layer_shapes
    File ".\bin\tensorflow_dep\network_builder_tensorflow.py", line 414, in <listcomp>
    KeyError: 'Placeholder_1_0'

  • Traceback (most recent call last):
    File ".\bin\code_generator.py", line 1454, in <module>
    File ".\bin\code_generator.py", line 1337, in generate_code
    File ".\bin\error_code.py", line 37, in reraise
    File ".\bin\code_generator.py", line 1333, in generate_code
    File ".\bin\code_generator.py", line 792, in generate_c_header
    File ".\bin\error_code.py", line 37, in reraise
    File ".\bin\code_generator.py", line 788, in generate_c_header
    File ".\bin\tensorflow_dep\network_builder_tensorflow.py", line 414, in generate_layer_shapes
    File ".\bin\tensorflow_dep\network_builder_tensorflow.py", line 414, in <listcomp>
    KeyError: 'Placeholder_1_0'

    [2021-08-17 15:54:53,161 INFO requirements.py:184 - log_exception() ] Translation FAILED!!
    [2021-08-17 15:54:53,162 INFO requirements.py:155 - remove_object() ] Uninitializing and cleaning up the translator object..

  • JKさん、こんにちは。スタッフのDartsmanです。

    ログの貼りつけありがとうございます。お手数をおかけしました。

    e-AIトランスレータのGUI上でモデルファイルを設定すると「Input Node Name」と「Output Node Name」という

    プルダウンに入力ノード名と出力ノード名が表示されると思います。

    こちらが実際のネットワークの入力ノード名と出力ノード名になっているかご確認をお願いできないでしょうか?

    ログのみでは断言できないのですが、特に出力ノード名が誤って設定されている可能性があるかと思いました。

    よろしくお願いいたします。

Reply
  • JKさん、こんにちは。スタッフのDartsmanです。

    ログの貼りつけありがとうございます。お手数をおかけしました。

    e-AIトランスレータのGUI上でモデルファイルを設定すると「Input Node Name」と「Output Node Name」という

    プルダウンに入力ノード名と出力ノード名が表示されると思います。

    こちらが実際のネットワークの入力ノード名と出力ノード名になっているかご確認をお願いできないでしょうか?

    ログのみでは断言できないのですが、特に出力ノード名が誤って設定されている可能性があるかと思いました。

    よろしくお願いいたします。

Children
  • ありがとうございます。

    各ノード名は、checkpointファイルなどを保管しているフォルダを指定すると、自動で表示されていましたので特に気にすることなく、そのままでした。

    さきほど、各ノード名がプルダウンメニューにより選択できることを確認し、入出力ノード名を変更した後に、トランスレートを実行した結果、今度は成功しました。

    ただ、この入出力のノード名がよくわかっていません。今回、入力はPlaceholder、出力はSigmoidを選択しました。変換は成功はしましたが、この選択で正しいのかがよくわかっていません。選択方法(選択の考え方)について少しアドバイスいただけないでしょうか?

    よろしくお願いします。

  • JKさん、こんにちは。スタッフのDartsmanです。

    ひとまず変換が成功して良かったです。

    このあたりの仕様は分かりにくいですよね。

    この入力ノード名/出力ノード名ですが、設計したニューラルネットワークをTensorFlowがモデルとして

    生成する場合に名前が付けられます。

    e-AIトランスレータは、このモデルファイル内の名前から入力ノード名/出力ノード名を指定する仕様になっています。

    ですので、名称としてはJKさんが設計したニューラルネットワーク内のレイヤー名と必ずしも1対1で対応して

    いないかと思います。

    e-AIトランスレータは入力ノード名/出力ノード名を自動で推定する処理を行っていますが、今回のように

    間違ったノード名を推定をしてしまうケースでは手動で正しいノード名を指定する必要があります。

    ですので、選択方法ガイドとしては以下のようになります。

    ・まずはe-AIトランスレータが推定したノード名で変換してみてください。

    ・エラーとなる場合、入力ノード名もしくは出力ノード名を正しくなるよう変更してみてください。

    ・変換結果が正しいかどうかは、トランスレータが出力したフォルダ内に「network_description.txt」という

     変換したネットワークの構成を示すファイルがありますので、こちらのファイルの内容と設計した

     ニューラルネットワークの構成が同じになっているかを確認してみてください。

    よろしくお願いいたします。

  • dartsmanさん

    ありがとうございます。いろいろなモデルを作ってみて、何度か変換してコツをつかむようにします。

    ちなみに、今は、以前から開発を続けている関係で、e2studioがv6.3.0、e-AI Transratorがv1.6.0を使用しています。

    今時点で、この古いバージョンのものを使い続けることによる大きな弊害は何かありますでしょうか?

    今後は新しいバージョンに移行していきたいとは思っているのですが・・・。

  • JKさん、こんにちは。スタッフのDartsmanです。

    現時点で大きな弊害は無いかと思います。

    最新版のe-AIトランスレータとしてはV2.0.0というバージョンをリリースしていますが、

    バージョンの移行に関してですが、少しご注意いただきたい点があります。

    e-AIトランスレータ V1.6.0 V2.0.0
    Pythonのバージョン 3.5.3 3.7.7
    TensorFlowのバージョン 1.12.0 2.1.0
    サポートするTensorFlowのAPI

    tf.nn、tf.layers、

    tf.keras.layers

    tf.keras.layers

    ・PythonやTensorFlowのバージョンが変わりますので、このあたりのセットアップが必要になります。

     また、新しいバージョンのPythonやTensorFlowを使って学習したモデルをe-AIトランスレータの

     入力ファイルとする必要があります。

    ・TensorFlow APIのサポート範囲が変わっています。このため学習スクリプト内のニューラルネットの

     定義部分をtf.nnやtf.layersといったAPIからtf.keras.layers APIへ置き換えていただく必要があります。

    このようにtf.nnやtf.layersといったAPIを使用されている方にとっては、少しバージョン移行のハードルがある

    形となっています。

    バージョンアップされる際はこのあたりのご考慮をよろしくお願いします。

    [補足]

    TensorFlowですが、V1→V2のバージョンアップ時にtf.keras APIを使用した簡単なモデル構築を

    コンセプトとしています。より簡単にネットワークの定義が可能になるこの変更はトレンドと

    とらえていまして、このためe-AIトランスレータ V2.0.0ではtf.keras APIに絞ったサポートとしました。

    ですが、API のサポートが絞られると困ってしまうお客様もいらっしゃると思いましたので

    e-AIトランスレータのV1.6.0も含めてWEBで公開する形をとっています。

    よろしくお願いいたします。

  • Dartsmanさん

    詳細なご説明ありがとうございます。

    バージョン移行時には注意させていただきます。

    この度は早急はご対応本当にありがとうございました。非常に助かりました。

    また今後、何か困り事に直面した際にはどうかよろしくお願いいたします。