NPU converts Pytorch model

Hi all,

I’m new to Pytorch and I have a Pytorch model that I need to convert it to run on NPU.

Does anyone has an example that convert a popular Pytorch model into NPU format ?

I’m stuck at giving --inputs and --outputs to script convertpytorch.

Thank you very much

@ptphucbk

Two input parameters and two output parameters .You can follow this docs to convert .

The path to this docs docs/en/Model_Transcoding\ and\ Running\ User\ Guide_V0.6.pdf

Thank @Frank for your answer.

I get this error when executing the command:

I Start importing pytorch...
../mb05_120x120.pt ********************
WARNING: Token 'COMMENT' defined, but not used
WARNING: There is 1 unused token
Syntax error in input! LexToken(NAMED_IDENTIFIER,'None',3,74)
Traceback (most recent call last):
  File "convertpytorch.py", line 51, in <module>
  File "convertpytorch.py", line 41, in main
  File "acuitylib/vsi_nn.py", line 146, in load_pytorch
  File "acuitylib/app/importer/import_pytorch.py", line 92, in run
  File "acuitylib/converter/convert_pytorch.py", line 517, in __init__
  File "acuitylib/converter/convert_pytorch.py", line 33, in __init__
ValueError: recursion limit must be greater or equal than 1
[10102] Failed to execute script convertpytorch

Do you know where it comes from ? Thank you

@ptphucbk I am not sure . Which version you used to train about pytroch ?

Model is trained with Pytorch 1.5. And it runs just fine with Pytorch 1.2 and I use 1.2 to generate .pt model

Do Do you have a model file that I can use as an example to convert ? Thanks

@ptphucbk I never try with pytroch . I will try to convert some pytroch models. And after that, I will faceback here.

1 Like

@ptphucbk Have you checked, are there any unsupported layers in your model ?

1 Like

The architecture is MobileNet V1 so I think that there will be no problem.

In NN Tool FAQ (0.1).pdf it says that Amlogic NN currently supports MobileNet*

What is the * in MobileNet* refers to ?

@ptphucbk I have convert the mobileNet with tensorflow version . But I don’y try pytraoch version . I think you should check with this file . aml_npu_sdkr/docs/en/Model_Transcoding and Running User Guide_V0.x.pdf

1 Like