Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Bugfix issue2485 #2524

Merged
merged 11 commits into from
Jun 11, 2020
Merged

Bugfix issue2485 #2524

merged 11 commits into from
Jun 11, 2020

Conversation

zheng-ningxin
Copy link
Contributor

@zheng-ningxin zheng-ningxin commented Jun 3, 2020

Fix the bug mentioned in issue 2485.
In addition, to pass the merge check pipeline, I also fix several pylint warnings.

I visualize the resnet18, resnet34, mobilev2, googlenet, squeezenet1_1 by TorchModuleGraph for testing, and it works fine.

Ningxin added 2 commits June 2, 2020 12:46
Signed-off-by: Ningxin <[email protected]>
@chicm-ms
Copy link
Contributor

chicm-ms commented Jun 3, 2020

would you add a test case with shared nn.Module in test_graph_utils.py and/or test_model_speedup.py?

@chicm-ms chicm-ms closed this Jun 3, 2020
@chicm-ms chicm-ms reopened this Jun 3, 2020
@zheng-ningxin
Copy link
Contributor Author

Fix the bug by adding a function called _expand_module_node without touching compressor.py. However, it does give us a reminder that you should be careful when using the name obtained by find_successor to get the corresponding module from the model.

Signed-off-by: Ningxin <[email protected]>
@zheng-ningxin zheng-ningxin requested a review from chicm-ms June 8, 2020 01:18
@QuanluZhang QuanluZhang self-requested a review June 8, 2020 03:15
@zheng-ningxin zheng-ningxin mentioned this pull request Jun 10, 2020
while modulegraph.find_successors(node):
nodes = modulegraph.find_successors(node)
assert len(nodes) == 1
node = nodes[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the previous implementation, this while loop will never end?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the previous implementation, it does have a directed loop in the graph: relu->liner2, liner2->relu. However, it will not loop forever, because it will fail on "the assert len(nodes) == 1".
In the previous implementation, relu will have two successors (liner2, linear3).

Copy link
Contributor

@QuanluZhang QuanluZhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great!

@chicm-ms chicm-ms merged commit 7ee5036 into microsoft:master Jun 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TorchModuleGraph: graph construct error when the model has shared layers
3 participants