Skip to content

Is it possible to export only one onnx file of DeepFilterNet? #696

Description

@hqynew

Hi,
We want to export and get the onnx of whole model.
When run the following export script with exprot-full mode:
def export(
model,
export_dir: str,
df_state: DF,
check: bool = True,
simplify: bool = True,
opset=14,
export_full: bool = True,
print_graph: bool = False,
):
model = deepcopy(model).to("cpu")
model.eval()
p = ModelParams()
audio = torch.randn((1, 1 * p.sr))
spec, feat_erb, feat_spec = df_features(audio, df_state, p.nb_df, device="cpu")

# Export full model
if export_full:
    path = os.path.join(export_dir, "deepfilternet3.onnx")
    input_names = ["spec", "feat_erb", "feat_spec"]
    dynamic_axes = {
        "spec": {2: "S"},
        "feat_erb": {2: "S"},
        "feat_spec": {2: "S"},
        "enh": {2: "S"},
        "m": {2: "S"},
        "lsnr": {1: "S"},
    }
    inputs = (spec, feat_erb, feat_spec)
    output_names = ["enh", "m", "lsnr", "coefs"]
    export_impl(
        path,
        model,
        inputs=inputs,
        input_names=input_names,
        output_names=output_names,
        dynamic_axes=dynamic_axes,
        jit=False,
        check=check,
        simplify=simplify,
        opset_version=opset,
        print_graph=print_graph,
    )

it outputs the error:
torch.onnx.errors.UnsupportedOperatorError: Exporting the operator 'aten::view_as_complex' to ONNX opset version 17 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub: https://github.com/pytorch/pytorch/issues.

opset = 14 also has same error.

Can anyone help?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions