Skip to content

Commit

Permalink
nemo_core - lgtm import fix
Browse files Browse the repository at this point in the history
Signed-off-by: Tomasz Kornuta <[email protected]>
  • Loading branch information
tkornuta-nvidia committed Feb 4, 2020
1 parent ecfd2cd commit face974
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/nlp/question_answering_squad.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
import json
import os

import nemo
import nemo.collections.nlp as nemo_nlp
import nemo.core as nemo_core
from nemo import logging
from nemo.collections.nlp.callbacks.qa_squad_callback import eval_epochs_done_callback, eval_iter_callback
from nemo.utils.lr_policies import get_lr_policy
Expand Down Expand Up @@ -257,8 +257,8 @@ def create_pipeline(
args.work_dir = f'{args.work_dir}/squad2.0'

# Instantiate neural factory with supported backend
nf = nemo.core.NeuralModuleFactory(
backend=nemo.core.Backend.PyTorch,
nf = nemo_core.NeuralModuleFactory(
backend=nemo_core.Backend.PyTorch,
local_rank=args.local_rank,
optimization_level=args.amp_opt_level,
log_dir=args.work_dir,
Expand Down Expand Up @@ -333,18 +333,18 @@ def create_pipeline(

if not args.evaluation_only:
logging.info(f"steps_per_epoch = {train_steps_per_epoch}")
callback_train = nemo.core.SimpleLossLoggerCallback(
callback_train = nemo_core.SimpleLossLoggerCallback(
tensors=[train_loss],
print_func=lambda x: print("Loss: {:.3f}".format(x[0].item())),
get_tb_values=lambda x: [["loss", x[0]]],
step_freq=args.loss_step_freq,
tb_writer=nf.tb_writer,
)

ckpt_callback = nemo.core.CheckpointCallback(
ckpt_callback = nemo_core.CheckpointCallback(
folder=nf.checkpoint_dir, epoch_freq=args.save_epoch_freq, step_freq=args.save_step_freq
)
callbacks_eval = nemo.core.EvaluatorCallback(
callbacks_eval = nemo_core.EvaluatorCallback(
eval_tensors=eval_output,
user_iter_callback=lambda x, y: eval_iter_callback(x, y),
user_epochs_done_callback=lambda x: eval_epochs_done_callback(
Expand Down

0 comments on commit face974

Please sign in to comment.