aboutsummaryrefslogtreecommitdiff
path: root/src/mlia/backend/vela
diff options
context:
space:
mode:
Diffstat (limited to 'src/mlia/backend/vela')
-rw-r--r--src/mlia/backend/vela/compiler.py8
-rw-r--r--src/mlia/backend/vela/performance.py4
2 files changed, 8 insertions, 4 deletions
diff --git a/src/mlia/backend/vela/compiler.py b/src/mlia/backend/vela/compiler.py
index afad05b..78f97b2 100644
--- a/src/mlia/backend/vela/compiler.py
+++ b/src/mlia/backend/vela/compiler.py
@@ -129,7 +129,7 @@ class VelaCompiler: # pylint: disable=too-many-instance-attributes
nng, network_type = model.nng, NetworkType.TFLite
if not nng:
- raise Exception("Unable to read model")
+ raise ValueError("Unable to read model: model.nng is not available")
output_basename = f"{self.output_dir}/{nng.name}"
@@ -152,7 +152,9 @@ class VelaCompiler: # pylint: disable=too-many-instance-attributes
return OptimizedModel(nng, arch, compiler_options, scheduler_options)
except (SystemExit, Exception) as err:
- raise Exception("Model could not be optimized with Vela compiler") from err
+ raise RuntimeError(
+ "Model could not be optimized with Vela compiler."
+ ) from err
def get_config(self) -> dict[str, Any]:
"""Get compiler configuration."""
@@ -200,7 +202,7 @@ class VelaCompiler: # pylint: disable=too-many-instance-attributes
):
return read_model(model_path, ModelReaderOptions()) # type: ignore
except (SystemExit, Exception) as err:
- raise Exception(f"Unable to read model {model_path}") from err
+ raise RuntimeError(f"Unable to read model {model_path}.") from err
def _architecture_features(self) -> ArchitectureFeatures:
"""Return ArchitectureFeatures instance."""
diff --git a/src/mlia/backend/vela/performance.py b/src/mlia/backend/vela/performance.py
index e545b85..a548b26 100644
--- a/src/mlia/backend/vela/performance.py
+++ b/src/mlia/backend/vela/performance.py
@@ -56,7 +56,9 @@ def estimate_performance(
initial_model = vela_compiler.read_model(model_path)
if initial_model.optimized:
- raise Exception("Unable to estimate performance for the given optimized model")
+ raise ValueError(
+ "Unable to estimate performance for the given optimized model."
+ )
optimized_model = vela_compiler.compile_model(initial_model)