Skip to content

Add error handling and logging to Python model generator scripts #15

Description

@harz05

Related Issue: This is the ML4EP/SOFIE equivalent of root-project/root#21190.

In root-project/root#21190, @dpiparo explicitly asked for this to be reopened here first

Problem

The Python model generator scripts in src/SOFIE_core/test/ currently have no error handling:

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

If a model export fails silently, there is no way to tell which step failed, no meaningful exit code and no validation that the .onnx file was actually created.

Proposed fix

  • Wrap model export calls in try/except so failures are caught and logged
  • Validate the .onnx file exists and is non-empty after each export
  • Exit with sys.exit(1) on failure so CI can detect it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions