Skip to content

Commit

Permalink
[NeMo-UX] Wrap task config save in a try/except (#9956) (#9984)
Browse files Browse the repository at this point in the history
* wrap task config save in a try/except



* move fiddle import



---------

Signed-off-by: ashors1 <[email protected]>
Co-authored-by: Anna Shors <[email protected]>
  • Loading branch information
github-actions[bot] and ashors1 authored Aug 6, 2024
1 parent cb72f02 commit 7b7d02f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions nemo/lightning/nemo_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import lightning_fabric as fl
import pytorch_lightning as pl
from fiddle._src.experimental import serialization
from pytorch_lightning.callbacks.model_checkpoint import ModelCheckpoint as PTLModelCheckpoint
from pytorch_lightning.loggers import Logger, TensorBoardLogger, WandbLogger

Expand Down Expand Up @@ -211,10 +210,15 @@ def _setup_trainer_model_checkpoint(self, trainer, log_dir, ckpt=None):
ModelCheckpoint.CHECKPOINT_NAME_LAST = callback.filename + '-last'

def _handle_task_config(self, task_config, log_dir):
task_config.save_config_img(log_dir / "task.png")
task_json = serialization.dump_json(task_config)
with open(log_dir / "task.json", "w") as f:
f.write(task_json)
try:
from fiddle._src.experimental import serialization

task_config.save_config_img(log_dir / "task.png")
task_json = serialization.dump_json(task_config)
with open(log_dir / "task.json", "w") as f:
f.write(task_json)
except Exception as e:
logging.warning(f'Saving task config failed: {e}. Skipping saving')

def _setup_file_logging(self, log_dir):
"""Set up file logging based on rank settings."""
Expand Down

0 comments on commit 7b7d02f

Please sign in to comment.