Skip to content

Commit 9c4fa08

Browse files
committed
Linting/Formatting of models folder
1 parent e7bbbf4 commit 9c4fa08

File tree

7 files changed

+581
-424
lines changed

7 files changed

+581
-424
lines changed

app/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""MLX model implementations for different architectures."""

app/models/errors.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""Custom exceptions for the models module."""
2+
3+
from __future__ import annotations
4+
5+
6+
class FluxModelError(Exception):
7+
"""Base exception for Flux model errors."""
8+
9+
10+
class ModelLoadError(FluxModelError):
11+
"""Raised when model loading fails."""
12+
13+
def __init__(self, message_or_path: str, original_exception: Exception | None = None) -> None:
14+
if original_exception is not None:
15+
self.model_path = message_or_path
16+
self.original_exception = original_exception
17+
super().__init__(f"Failed to load model from {message_or_path}: {original_exception}")
18+
else:
19+
super().__init__(message_or_path)
20+
21+
22+
class ModelGenerationError(FluxModelError):
23+
"""Raised when image generation fails."""
24+
25+
26+
class InvalidConfigurationError(FluxModelError):
27+
"""Raised when configuration is invalid."""

0 commit comments

Comments
 (0)