-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PaddlePaddle конвертер #561
PaddlePaddle конвертер #561
Conversation
@IgorKonovalovAleks, проверка стиля кодирования не прошла, проверьте, пожалуйста. |
Usage of the script: | ||
|
||
```sh | ||
python converter.py -m <path/to/input/model> -f <source_framework> -p <Pytorch/module/name> -d <output_directory> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pytorch? Либо все мелкими буквами (предпочтительно) или в соответствии с названием библиотеки.
|
||
### Paddle converter parameters | ||
|
||
- `--model_path` Path to an .onnx or .pth file with the original model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is a path
|
||
- `--model_path` Path to an .onnx or .pth file with the original model. | ||
- `--framework` is a source framework for convertion to PaddlePaddle format. | ||
- `--pytorch_module_name` Module name for PyTorch model (necessary if source framework is Pytorch). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is a module name
- `--model_path` Path to an .onnx or .pth file with the original model. | ||
- `--framework` is a source framework for convertion to PaddlePaddle format. | ||
- `--pytorch_module_name` Module name for PyTorch model (necessary if source framework is Pytorch). | ||
- `--save_dir` Directory for converted model to be saved to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is a directory
python converter.py -m .\public\ctdet_coco_dlav0_512\ctdet_coco_dlav0_512.onnx -f onnx -d pd | ||
``` | ||
|
||
# Conversion from PaddlePaddle |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Директория называется x2paddle, но откуда-то возник обратный конвертер?! Надо либо вынести, либо переименовать директорию.
|
||
- `--model_dir` Path to the directory with the original model. | ||
- `--model_filename` Name of the model file name. | ||
- `--params_filename` Name of the parameters file name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is a name
- `--model_dir` Path to the directory with the original model. | ||
- `--model_filename` Name of the model file name. | ||
- `--params_filename` Name of the parameters file name. | ||
- `--model_path` Path to the resulting .onnx file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is a path
- `--model_filename` Name of the model file name. | ||
- `--params_filename` Name of the parameters file name. | ||
- `--model_path` Path to the resulting .onnx file. | ||
- `--opset_version` Desired opset version of the resulting ONNX model. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is a desired...
input_examples=[torch.tensor(input_data)]) | ||
|
||
def convert_onnx_to_paddle(model_path: str, save_dir: str): | ||
print(f'x2paddle --framework=onnx --model={model_path} --save_dir={save_dir}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нигде в ридми нет информации, что требуется какой-то внешний инструмент. Надо где-то это написать.
|
||
def convert_paddle_to_onnx(model_dir: str, model_filename: str, params_filename: str, | ||
model_path: str, opset_version: str): | ||
os.system(f'paddle2onnx --model_dir {model_dir} \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Аналогично, нигде в ридми нет информации, что требуется какой-то внешний инструмент. Надо где-то это написать.
type=str, | ||
dest='model_path') | ||
parser.add_argument('-f', '--framework', | ||
help='Original model framework (ONNX or Pytorch)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyTorch вместо Pytorch
@@ -0,0 +1,58 @@ | |||
# Conversion to PaddlePaddle | |||
|
|||
PaddlePaddle converter supports conversion to Paddle format from Pytorch and ONNX formats. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyTorch вместо Pytorch
Usage of the script: | ||
|
||
```sh | ||
python converter.py -m <path/to/input/model> -f <source_framework> -p <PyTorch/module/name> -d <output_directory> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Думаю, что имеет смысл название скрипта изменить, например, srcf2paddle
No description provided.