Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ONNXGraph] delete_orphaned_node_branches utility function #1694

Merged
merged 3 commits into from
Jul 31, 2023

Conversation

bfineran
Copy link
Member

utility function that deletes all node branches in an ONNX graph that do not lead to a model output
necessary for the latest LLM graph transformations as rewiring the graphs to take positions and causal masks directly leaves the graphs with orphaned node branches

example_usage:

import onnx
from sparseml.onnx.utils import ONNXGraph

model = onnx.load(PATH_TO_MODEL)
graph = ONNXGraph(model)

graph.delete_orphaned_node_branches()

test_plan:
@dbogunowicz to test with LLMs story. will verify that extraneous nodes are deleted and model correctness remains

@bfineran bfineran self-assigned this Jul 28, 2023
@bfineran bfineran merged commit d199188 into main Jul 31, 2023
10 checks passed
@bfineran bfineran deleted the delete-orphaned-nodes branch July 31, 2023 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants