Skip to content

Commit

Permalink
Simplify import error handling
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Lasek <[email protected]>
  • Loading branch information
janekl committed Oct 2, 2024
1 parent 25d2ca5 commit 5ff2518
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions nemo/deploy/nlp/megatronllm_deployable.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@
except (ImportError, ModuleNotFoundError) as e:

HAVE_MEGATRON_CORE = False
IMPORT_ERROR = (
"megatron-core was not found. Please see the NeMo README for installation instructions: https://github.com/NVIDIA/NeMo#megatron-core."
f" Exact error: {e}"
)
IMPORT_ERROR = e


@wrapt.decorator
Expand Down Expand Up @@ -113,7 +110,7 @@ def __init__(
existing_model: MegatronGPTModel = None,
):
if not HAVE_MEGATRON_CORE:
raise ImportError(IMPORT_ERROR)
raise IMPORT_ERROR
if nemo_checkpoint_filepath is None and existing_model is None:
raise ValueError(
"MegatronLLMDeployable requires either a .nemo checkpoint filepath or an existing MegatronGPTModel, but both provided were None"
Expand Down

0 comments on commit 5ff2518

Please sign in to comment.