This repository has been archived by the owner on Nov 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 799
Conditional check on accelerator_lowering availability #1631
Open
jeffreyliu3230
wants to merge
1
commit into
facebookresearch:main
Choose a base branch
from
jeffreyliu3230:export-D26871262
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conditional check on accelerator_lowering availability #1631
jeffreyliu3230
wants to merge
1
commit into
facebookresearch:main
from
jeffreyliu3230:export-D26871262
Conversation
This file contains 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
Summary: This is the first proposed approach to handle missing dependency in new_task.py by using a try block to import the functions defined in accelerator_lowering.py. This requires only changing a few lines of code in new_task.py where the functions lower_modules_to_accelerator and swap_modules_for_accelerator were called. Although swap_modules_for_accelerator doesn't require internal library, the accelerator decorator would be imported as a side effect. By wrapping it by the try block with lower_modules_to_accelerator during importing it would eliminate dependency of accelerator_lowering.py completely when not used. Differential Revision: D26871262 fbshipit-source-id: 16159de5838820b6d0dd4309b746f3e3814bb830
facebook-github-bot
added
CLA Signed
Do not delete this pull request or issue due to inactivity.
fb-exported
labels
Mar 6, 2021
This pull request was exported from Phabricator. Differential Revision: D26871262 |
jeffreyliu3230
pushed a commit
to jeffreyliu3230/pytext
that referenced
this pull request
Mar 8, 2021
Summary: Alternative approach to facebookresearch#1631. Handling ImportError of accelerator in accelerator_lowering.py instead of new_task.py. accelerator function is both used as a declarator on class AcceleratorTransformerLayers and called directly in lower_modules_to_accelerator. In addition to adding the try block for importing accelerator, accelerator_lowering_supported is used in lower_modules_to_accelerator to avoid ImportError. Differential Revision: D26885302 fbshipit-source-id: 5b938b3f4535dca9a9fbeaf6ee4c43f42ed5df3c
jeffreyliu3230
pushed a commit
to jeffreyliu3230/pytext
that referenced
this pull request
Mar 8, 2021
facebookresearch#1633) Summary: Pull Request resolved: facebookresearch#1633 Alternative approach to facebookresearch#1631. Handling ImportError of accelerator in accelerator_lowering.py instead of new_task.py. accelerator function is both used as a declarator on class AcceleratorTransformerLayers and called directly in lower_modules_to_accelerator. In addition to adding the try block for importing accelerator, accelerator_lowering_supported is used in lower_modules_to_accelerator to avoid ImportError. Differential Revision: D26885302 fbshipit-source-id: 13f8c9c23fa56db573c1ea32c582fee91a001972
jeffreyliu3230
pushed a commit
to jeffreyliu3230/pytext
that referenced
this pull request
Mar 8, 2021
facebookresearch#1633) Summary: Pull Request resolved: facebookresearch#1633 Alternative approach to facebookresearch#1631. Handling ImportError of accelerator in accelerator_lowering.py instead of new_task.py. accelerator function is both used as a declarator on class AcceleratorTransformerLayers and called directly in lower_modules_to_accelerator. In addition to adding the try block for importing accelerator, accelerator_lowering_supported is used in lower_modules_to_accelerator to avoid ImportError. Differential Revision: D26885302 fbshipit-source-id: 7540b0443678fd5ca0536aafd0a1c0402b044ec0
facebook-github-bot
pushed a commit
that referenced
this pull request
Mar 9, 2021
#1633) Summary: Pull Request resolved: #1633 Alternative approach to #1631. Handling ImportError of accelerator in accelerator_lowering.py instead of new_task.py. accelerator function is both used as a declarator on class AcceleratorTransformerLayers and called directly in lower_modules_to_accelerator. In addition to adding the try block for importing accelerator, accelerator_lowering_supported is used in lower_modules_to_accelerator to avoid ImportError. Reviewed By: mikekgfb Differential Revision: D26885302 fbshipit-source-id: 0630494f5d44fff9869e8d88e3bb23224fe4826f
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
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.
Summary: This is the first proposed approach to handle missing dependency in new_task.py by using a try block to import the functions defined in accelerator_lowering.py. This requires only changing a few lines of code in new_task.py where the functions lower_modules_to_accelerator and swap_modules_for_accelerator were called. Although swap_modules_for_accelerator doesn't require internal library, the accelerator decorator would be imported as a side effect. By wrapping it by the try block with lower_modules_to_accelerator during importing it would eliminate dependency of accelerator_lowering.py completely when not used.
Differential Revision: D26871262