Creating MindSpore Lite Models
Linux
Environment Preparation
Model Export
Model Converting
Intermediate
Expert
Overview
Creating your MindSpore Lite(Train on Device) model is a two step procedure:
In the first step the model is defined and the layers that should be trained must be declared. This is being done on the server, using a MindSpore-based Python code. The model is then exported into a protobuf format, which is called MINDIR.
In the seconde step this
.mindir
model is converted into a.ms
format that can be loaded onto an embedded device and can be trained using the MindSpore Lite framework. The converted.ms
models can be used for both training and inference.
Linux Environment
Environment Preparation
MindSpore Lite model transfer tool (only suppot Linux OS) has provided multiple parameters. The procedure is as follows:
Compile or download the compiled model transfer tool.
Set the environment variables of the model transfer tool.
Parameters Description
The table below shows the parameters used in the MindSpore Lite model training transfer tool.
Parameters |
required |
Parameter Description |
Value Range |
Default Value |
---|---|---|---|---|
|
no |
Prints all the help information. |
- |
- |
|
yes |
Original format of the input model. |
MINDIR |
- |
|
yes |
Path of the input model. |
- |
- |
|
yes |
Path of the output model. The suffix |
- |
- |
|
yes |
Training on Device or not |
true, false |
false |
The parameter name and parameter value are separated by an equal sign (=) and no space is allowed between them.
If running the conversion command is failed, an errorcode will be output.
Example
Suppose the file to be converted is my_model.mindir
and run the following command:
./converter_lite --fmk=MINDIR --trainModel=true --modelFile=my_model.mindir --outputFile=my_model
If the command executes successfully, the model.ms
target file will be obtained and the console will print as follows:
CONVERTER RESULT SUCCESS:0
If running the conversion command is failed, an errorcode will be output.