Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NeMo-UX] Wrap task config save in a try/except #9984

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -187,10 +186,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