zetane / viewer

ML models and internal tensors 3D visualizer
1.14k stars 124 forks source link

How to generate the corresponding model format? #9

Closed Harr7y closed 2 years ago

Harr7y commented 2 years ago

A usual saved format for Pytorch is '.pth', how could we generate the own ZTN or ONNX format self-designed models with Pytorch.

amansingh0330 commented 2 years ago

@Harr7y for pth models if you load it in python (generally you need model definition for pth models) then torch supports the onnx conversion implicitly

which is something like this torch.onnx.export(model, dummy_input, "alexnet.onnx", verbose=True, input_names=input_names, output_names=output_names)

after converting to onnx you can easily convert it to ztn following the zetane documentation

Harr7y commented 2 years ago

@Harr7y for pth models if you load it in python (generally you need model definition for pth models) then torch supports the onnx conversion implicitly

which is something like this torch.onnx.export(model, dummy_input, "alexnet.onnx", verbose=True, input_names=input_names, output_names=output_names)

after converting to onnx you can easily convert it to ztn following the zetane documentation

Thanks a lot for your reply.