Unverified Commit 5f91bdfa authored by Yuge Zhang's avatar Yuge Zhang Committed by GitHub
Browse files

Catch exception from ONNX conversion (#4034)

parent 800c675f
...@@ -178,7 +178,10 @@ class _SupervisedLearningModule(LightningModule): ...@@ -178,7 +178,10 @@ class _SupervisedLearningModule(LightningModule):
y_hat = self(x) y_hat = self(x)
if not self._already_exported: if not self._already_exported:
self.to_onnx(self.export_onnx, x, export_params=True) try:
self.to_onnx(self.export_onnx, x, export_params=True)
except RuntimeError as e:
warnings.warn(f'ONNX conversion failed. As a result, you might not be able to use visualization. Error message: {e}')
self._already_exported = True self._already_exported = True
self.log('val_loss', self.criterion(y_hat, y), prog_bar=True) self.log('val_loss', self.criterion(y_hat, y), prog_bar=True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment