Skip to content

Commit

Permalink
Addressing code review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Boris Fomitchev <bfomitchev@nvidia.com>
  • Loading branch information
borisfom committed Jul 6, 2024
1 parent 7f8105f commit 965a58c
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions examples/nlp/language_modeling/megatron_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

from omegaconf import OmegaConf, open_dict
from pytorch_lightning import Trainer
from torch.export import Dim

from nemo.collections.nlp.models.language_modeling.megatron_bart_model import MegatronBARTModel
from nemo.collections.nlp.models.language_modeling.megatron_bert_model import MegatronBertModel
Expand Down Expand Up @@ -75,7 +74,6 @@ def nemo_export(cfg):
assert nemo_in is not None, "NeMo model not provided. Please provide the path to the .nemo or .ckpt file"

onnx_out = cfg.onnx_model_file
print(f"onnx_out: {onnx_out}")
trainer = Trainer(strategy=NLPDDPStrategy(), **cfg.trainer)
assert (
cfg.trainer.devices * cfg.trainer.num_nodes
Expand Down Expand Up @@ -154,11 +152,6 @@ def nemo_export(cfg):
sequence = "sequence"
batch = "batch"

use_dynamo = False
if use_dynamo:
sequence = Dim("sequence")
batch = Dim("batch")

model.export(
onnx_out,
onnx_opset_version=cfg.export_options.onnx_opset,
Expand All @@ -171,7 +164,6 @@ def nemo_export(cfg):
'position_ids': {0: sequence, 1: batch},
'logits': {0: sequence, 1: batch},
},
use_dynamo=use_dynamo,
)
except Exception as e:
logging.error(
Expand Down

0 comments on commit 965a58c

Please sign in to comment.