Skip to content

fix: add error handling and logging to model generator scripts#16

Open
harz05 wants to merge 1 commit intoML4EP:gpu/alpakafrom
harz05:fix/generator-error-handling
Open

fix: add error handling and logging to model generator scripts#16
harz05 wants to merge 1 commit intoML4EP:gpu/alpakafrom
harz05:fix/generator-error-handling

Conversation

@harz05
Copy link
Copy Markdown

@harz05 harz05 commented Mar 21, 2026

Fixes #15 (SOFIE equivalent of root-project/root#21190)

Changes

All 6 model generator scripts in src/SOFIE_core/test/ had no error handling. This adds:

  • try/except around torch.onnx.export() calls so failures are caught and logged
  • validation that the output .onnx file exists and is non-empty after export
  • sys.exit(1) on failure so CI can detect it
  • Fixed unclosed file handles by using with open() instead of bare open()
  • added logging for progress and error messages

Files changed:

  • LinearModelGenerator.py
  • Conv1dModelGenerator.py
  • Conv2dModelGenerator.py
  • Conv3dModelGenerator.py
  • ConvTrans2dModelGenerator.py
  • RecurrentModelGenerator.py

All changes are consistent across the 6 files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant