[hotfix/rotor] fix variable names#1597
Merged
FrankLeeeee merged 27 commits intohpcaitech:mainfrom Sep 14, 2022
Merged
Conversation
…o feature/better_flop_tensor
…o feature/better_flop_tensor
…o hotfix/rotor_variable_names
super-dainiu
commented
Sep 14, 2022
|
|
||
|
|
||
| class Stage(Enum): | ||
| class Phase(Enum): |
Contributor
Author
There was a problem hiding this comment.
Stage should be Phase with respect to RPC phase.
super-dainiu
commented
Sep 14, 2022
super-dainiu
commented
Sep 14, 2022
| setattr(n, 'node_size', n.meta.get('fwd_mem_tmp', 0) + n.meta.get('fwd_mem_out', 0)) | ||
| for par in n.all_input_nodes: | ||
| par.meta['fwd_mem_out'] = par.meta.get('fwd_mem_out', 0) + n.meta.get('fwd_mem_in', 0) | ||
| par.meta['fwd_mem_out'] = max(par.meta.get('fwd_mem_out', 0), n.meta.get('fwd_mem_in', 0)) |
Contributor
Author
There was a problem hiding this comment.
max is more plausible for this calculation.
super-dainiu
commented
Sep 14, 2022
| n.meta['tensor_meta'] = tensor_meta | ||
| n.meta = {**n.meta, **asdict(meta_info)} # extend MetaInfo to `n.meta` | ||
|
|
||
| n.meta = {**n.meta, **asdict(meta_info), 'fwd_mem_out': 0} # extend MetaInfo to `n.meta` |
Contributor
Author
There was a problem hiding this comment.
Avoid doubled MetaInfoProp that introduces doubled fwd_mem_out.
FrankLeeeee
reviewed
Sep 14, 2022
FrankLeeeee
reviewed
Sep 14, 2022
super-dainiu
commented
Sep 14, 2022
Comment on lines
+410
to
+411
| print(chain) | ||
| print(node_list) |
FrankLeeeee
reviewed
Sep 14, 2022
Comment on lines
+51
to
+68
| def is_forward(n: Node): | ||
| assert 'stage' in n.meta, f'Node meta of {n} has no key `stage`!' | ||
| return n.meta['stage'] == Stage.FORWARD | ||
| assert 'phase' in n.meta, f'Node meta of {n} has no key `phase`!' | ||
| return n.meta['phase'] == Phase.FORWARD | ||
|
|
||
|
|
||
| def is_loss(n: Node): | ||
| assert 'stage' in n.meta, f'Node meta of {n} has no key `stage`!' | ||
| return n.meta['stage'] == Stage.LOSS | ||
| assert 'phase' in n.meta, f'Node meta of {n} has no key `phase`!' | ||
| return n.meta['phase'] == Phase.LOSS | ||
|
|
||
|
|
||
| def is_placeholder(n: Node): | ||
| assert 'stage' in n.meta, f'Node meta of {n} has no key `stage`!' | ||
| return n.meta['stage'] == Stage.PLACEHOLDER | ||
| assert 'phase' in n.meta, f'Node meta of {n} has no key `phase`!' | ||
| return n.meta['phase'] == Phase.PLACEHOLDER | ||
|
|
||
|
|
||
| def is_backward(n: Node): | ||
| assert 'stage' in n.meta, f'Node meta of {n} has no key `stage`!' | ||
| return n.meta['stage'] == Stage.BACKWARD | ||
| assert 'phase' in n.meta, f'Node meta of {n} has no key `phase`!' | ||
| return n.meta['phase'] == Phase.BACKWARD |
Contributor
There was a problem hiding this comment.
These can be merged into one function e.g. is_stage(node: Node, stage: Phase)
Contributor
There was a problem hiding this comment.
The var name in my code should be phase for consistency
FrankLeeeee
approved these changes
Sep 14, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's fixed?
In the last PR #1587, we modified some naming of variables. This hotfix will change the names correctly.
Testing