mirror of
https://github.com/KimberleyJensen/Mel-Band-Roformer-Vocal-Model.git
synced 2026-04-03 00:09:24 -06:00
Enhance CPU Inference Efficiency: Add ONNX/TorchScript Conversion Support for CPU-Only Deployment #3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tensimixt on 4/5/2025
Background
The current implementation of the Mel-Band-Roformer-Vocal-Model is optimized for GPU inference. However, many users run inference in CPU-only environments and have reported high CPU usage and suboptimal latency. Converting the model to ONNX—or optionally using TorchScript—could significantly reduce CPU overhead and improve performance on such systems.
Proposed Enhancement
ONNX Conversion Support
Use
torch.onnx.exportto export the model into an ONNX graph.Ensure that custom layers (e.g., RoFormer blocks and any non-standard operations) are properly handled, potentially by implementing custom symbolic functions if needed.
Provide documentation or an example script to guide users through the conversion process.
Optional TorchScript Support
Offer a conversion path using TorchScript (via
torch.jit.traceortorch.jit.script) to optimize the model for CPU inference.Benchmark and compare the performance between the ONNX and TorchScript approaches.
Benefits
Lower CPU usage and reduced inference latency for CPU-only deployments.
Enables users without GPU access to deploy the model more effectively.
Allows users to choose between ONNX and TorchScript based on their deployment needs and environment constraints.