Skip to content

Reference for ultralytics/utils/errors.py

Note

This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/utils/errors.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!



ultralytics.utils.errors.HUBModelError

Bases: Exception

Custom exception class for handling errors related to model fetching in Ultralytics YOLO.

This exception is raised when a requested model is not found or cannot be retrieved. The message is also processed to include emojis for better user experience.

Attributes:

Name Type Description
message str

The error message displayed when the exception is raised.

Note

The message is automatically processed through the 'emojis' function from the 'ultralytics.utils' package.

Source code in ultralytics/utils/errors.py
class HUBModelError(Exception):
    """
    Custom exception class for handling errors related to model fetching in Ultralytics YOLO.

    This exception is raised when a requested model is not found or cannot be retrieved.
    The message is also processed to include emojis for better user experience.

    Attributes:
        message (str): The error message displayed when the exception is raised.

    Note:
        The message is automatically processed through the 'emojis' function from the 'ultralytics.utils' package.
    """

    def __init__(self, message="Model not found. Please check model URL and try again."):
        """Create an exception for when a model is not found."""
        super().__init__(emojis(message))

__init__(message='Model not found. Please check model URL and try again.')

Create an exception for when a model is not found.

Source code in ultralytics/utils/errors.py
def __init__(self, message="Model not found. Please check model URL and try again."):
    """Create an exception for when a model is not found."""
    super().__init__(emojis(message))





Created 2023-11-12, Updated 2023-11-25
Authors: glenn-jocher (3)