This repository was archived by the owner on Nov 22, 2022. It is now read-only.
Conditional check on accelerator_lowering availability #1631
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