MONAI icon indicating copy to clipboard operation
MONAI copied to clipboard

Make the _export function support saver input

Open binliunls opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. The _export function in the bundle script is for converting models from one format to another one, e.g. converting a pytorch model to a torchscript model. It takes a converter and a model as inputs, converts the given model with the converter and save the converted model to a given path.

However, the saving logic in the _export function just suits to save the torchscript model. Given a converter which exports a torchsciprt model to an onnx model, this logic would fail to save the model. To make the _export function more general, a saver which takes model, savepath, extra_kwargs, should be passed to it instead of the current saving logic.

Describe the solution you'd like Add a saver to the input parameters of the _export function. Replace the current saving logic in the _export function with a call of the saver. Use the _export function to rewrite the onnx_export function.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

binliunls avatar Apr 17 '23 06:04 binliunls