Skip to content
This repository was archived by the owner on Apr 24, 2025. It is now read-only.
This repository was archived by the owner on Apr 24, 2025. It is now read-only.

Persistent Compiled Model for Intel NPU Acceleration Library #26

@BICHENG

Description

@BICHENG

Problem Description

When using the Intel NPU Acceleration Library to accelerate large models like speech recognition networks or UNet(≥1GB), the compilation time can be excessively long, even though the acceleration effect is good. The library currently lacks the ability to export compiled binary files or binary caches, which means that every time a PyTorch model is loaded, it needs to be loaded into the CPU first and then compiled, which can take a long time. This can be especially problematic when distributing to other machines with lower configurations, where factors like insufficient memory or CPU power limitations can make the compilation time nearly impossible to complete.

Proposed Solution

Provide a persistence mechanism to decouple the model loading step from PyTorch in certain environments. Possible approaches:

  1. Export an intermediate representation (IR) file similar to OpenVINO's IR format. This would avoid the need to use PyTorch for subsequent runs, even if some internal compilation still needs to be done (but at least it would complete your version of the static graph trace and weight saving, rather than relying on ONNX).

  2. Provide a mechanism similar to OpenVINO's UMD Dynamic Model Caching. Perhaps the underlying work is the same as yours. Consider providing a UID or directly exposing the cache file, so that it can be hit without having to load the model into the CPU each time using a third-party library (PyTorch) before compiling.

Alternatives Considered

Exporting OpenVINO's IR file directly was considered. However, it is clear that the mechanisms are different, as this would require ONNX conversion, which may reduce optimization possibilities. Therefore, this is not an ideal approach.

Additional Context

The long compilation times can be a significant bottleneck, especially when distributing to machines with lower configurations. Introducing a persistence mechanism to save the compiled model and avoid relying on PyTorch for model loading could greatly improve the usability and efficiency of the library in various environments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions