Repository navigation
Safely import TELinearAdapter - #103
Conversation
Signed-off-by: Marc Romeyn <marcromeyn@gmail.com>
Signed-off-by: Marc Romeyn <marcromeyn@gmail.com>
|
/ok to test 1e499d9 |
|
/ok to test 1e499d9 |
| try: | ||
| import transformer_engine.pytorch as te | ||
|
|
||
| from megatron.hub.peft.lora_layers import TELinearAdapter | ||
|
|
||
| HAVE_TE = True | ||
| except ImportError: | ||
| te = None | ||
| TELinearAdapter = None | ||
| HAVE_TE = False |
There was a problem hiding this comment.
What do you think about raising a user-friendly error inside of LoRA explaining that they need TE to proceed?
There was a problem hiding this comment.
Also, what do you think about using nemo's safe import method?
Signed-off-by: Marc Romeyn <marcromeyn@gmail.com>
|
/ok to test 3864904 |
ko3n1g
left a comment
There was a problem hiding this comment.
Thanks for refactoring this!
QA RCCA Analysis1. Fix Reference
2. Root Cause
3. Trigger Configuration
4. Nature of the BugClassification: CODE BUG - ImportError when transformer-engine not installed 5. Existing Test CoverageIn Fix PR: NO - No test files In NMFW Tests: Not specifically covering optional TE import 6. Coverage Assessment
7. New Regression TestNOT ADDED - Optional dependency import fix. 8. ConclusionVerdict: PARTIAL COVERAGE - No dedicated test for optional TE import handling. |
Problem
The file
src/megatron/hub/peft/lora.pywas importingTELinearAdapterdirectly in the import statements:This causes an
ImportErrorwhen transformer-engine is not installed, even though the code properly handles the optional dependency elsewhere in the file.Solution
Move the
TELinearAdapterimport to the try-except block where transformer-engine is imported: