class Status(IntEnum) Values
SUCCESS | 0 | |
|---|---|---|
DEFERRED | 1 | |
OUT_OF_MEMORY | 2 | |
SHAPE_MISMATCH | 3 | |
UNSUPPORTED_LAYOUT | 4 | |
UNKNOWN_KIND | 5 | |
IO | 7 | |
DEVICE | 8 | |
MALFORMED | 9 | |
INTERNAL | 10 | |
CONFIG_MISMATCH | 13 | |
CONTENDED | 14 | |
CANCELLED | 15 | |
UNSUPPORTED | 16 | |
INVALID_ARGUMENT | 17 |
Every failure raises a subclass of uform.Error, itself a RuntimeError, and each carries the status the C ABI reported as its status attribute, a uform.Status member:
try:
model.on(executor).text_encode(texts, arena, progress=lambda completed, total: completed < 100)
except uform.CancelledError:
... # The handler stopped the call, which published nothing
except uform.Error as error:
print(error.status) # Status.SHAPE_MISMATCH, Status.DEVICE, ...SUCCESS and DEFERRED raise nothing, and every other member has its own class, which also derives the built-in naming the same fault where one exists:
OUT_OF_MEMORY → OutOfMemoryError, a MemoryErrorSHAPE_MISMATCH → ShapeMismatchError, a ValueErrorUNSUPPORTED_LAYOUT → UnsupportedLayoutError, a ValueErrorUNKNOWN_KIND → UnknownKindError, a ValueErrorIO → InputOutputError, an OSErrorDEVICE → DeviceErrorMALFORMED → MalformedError, a ValueErrorINTERNAL → InternalErrorCONFIG_MISMATCH → ConfigMismatchError, a ValueErrorCONTENDED → ContendedErrorCANCELLED → CancelledErrorUNSUPPORTED → UnsupportedError, a NotImplementedErrorINVALID_ARGUMENT → InvalidArgumentError, a ValueErrorA failure the binding catches before the boundary raises the class the library would have raised for the same fault.
Arguments the binding refuses raise at the call, while the library’s refusals of a deferred call raise at await or wait().
StatusWhat a call finished with, valued as uform_status_t: Error.status and Deferred.status.class Status(IntEnum) SUCCESS | 0 | |
|---|---|---|
DEFERRED | 1 | |
OUT_OF_MEMORY | 2 | |
SHAPE_MISMATCH | 3 | |
UNSUPPORTED_LAYOUT | 4 | |
UNKNOWN_KIND | 5 | |
IO | 7 | |
DEVICE | 8 | |
MALFORMED | 9 | |
INTERNAL | 10 | |
CONFIG_MISMATCH | 13 | |
CONTENDED | 14 | |
CANCELLED | 15 | |
UNSUPPORTED | 16 | |
INVALID_ARGUMENT | 17 |
OutOfMemoryErrorDevice, pinned, or host memory could not be allocated, or the scratch ceiling is too low.class OutOfMemoryError(Error, MemoryError) ShapeMismatchErrorItem counts, a pixel shape, or a batch envelope disagree with the call or the model.class ShapeMismatchError(Error, ValueError) UnsupportedLayoutErrorA stride or packing the model cannot read.class UnsupportedLayoutError(Error, ValueError) UnknownKindErrorA scalar, modality, or name this build does not know.class UnknownKindError(Error, ValueError) InputOutputErrorA checkpoint file could not be opened, read, or written.class InputOutputError(Error, OSError) DeviceErrorThe driver refused or the device faulted; after a fault the executor refuses every later call.class DeviceError(Error) MalformedErrorSupplied bytes could not be decoded: a checkpoint, an image, a clip, or a recording.class MalformedError(Error, ValueError) InternalErrorThe library reported neither success nor a failure - a defect.class InternalError(Error) ConfigMismatchErrorThe request contradicts a frozen configuration, like resuming a checkpoint of another geometry.class ConfigMismatchError(Error, ValueError) ContendedErrorAn executor's deferred table or an arena is already serving another call.class ContendedError(Error) CancelledErrorA progress handler stopped the call, which published nothing.class CancelledError(Error) UnsupportedErrorThe verb is declared, but this residency or model does not implement it.class UnsupportedError(Error, NotImplementedError) InvalidArgumentErrorAn argument breaks the verb's contract, a closed executor and a rewound arena's output included.class InvalidArgumentError(Error, ValueError) ErrorThe base of every failure the library reports, one subclass per status shared with the C API.1class Error(RuntimeError) statusstatus: Status