Skip to main content

PackError

Enum PackError 

Source
pub enum PackError {
    WeightColumnsMismatch {
        module: String,
        got: usize,
        expected: usize,
        in_features: usize,
    },
    GroupColumnsMismatch {
        module: String,
        which: &'static str,
        got: usize,
        expected: usize,
        in_features: usize,
    },
    BufferLengthMismatch {
        module: String,
        which: &'static str,
        got: usize,
        expected: usize,
    },
    InFeaturesNotAligned {
        module: String,
        in_features: usize,
    },
    CodeOutOfRange {
        module: String,
        row: usize,
        group: usize,
        value: u8,
    },
    AsymmetricBias {
        module: String,
        row: usize,
        group: usize,
        bias: f32,
        scale: f32,
    },
}
Expand description

Errors raised while packing a single MLX-quantized linear module into BlockTQ2_0_g128 blocks.

These are the parity guards described in the converter design: any violation means the MLX tensor does not match the validated ternary assumptions, so we refuse to produce a silently-wrong GGUF file.

Variants§

§

WeightColumnsMismatch

The packed-weight column count does not equal in_features / 16.

Fields

§module: String

Diffusers module name.

§got: usize

Observed weight column count.

§expected: usize

Expected column count (in_features / 16).

§in_features: usize

Logical input-feature dimension.

§

GroupColumnsMismatch

The scales/biases column count does not equal in_features / 128.

Fields

§module: String

Diffusers module name.

§which: &'static str

Which sub-tensor ("scales" or "biases").

§got: usize

Observed column count.

§expected: usize

Expected column count (in_features / 128).

§in_features: usize

Logical input-feature dimension.

§

BufferLengthMismatch

A sub-tensor buffer had an unexpected element count for the stated shape.

Fields

§module: String

Diffusers module name.

§which: &'static str

Which sub-tensor ("weight", "scales", "biases").

§got: usize

Observed element count.

§expected: usize

Expected element count from out × cols.

§

InFeaturesNotAligned

in_features is not a positive multiple of 128 (the TQ2_0_g128 group size).

Fields

§module: String

Diffusers module name.

§in_features: usize

Logical input-feature dimension.

§

CodeOutOfRange

A 2-bit MLX code exceeded 2 (i.e. a reserved q=3 was found), which is inconsistent with the validated ternary assumption (q ∈ {0, 1, 2}).

Fields

§module: String

Diffusers module name.

§row: usize

Output-feature row index.

§group: usize

128-element group index along the input dimension.

§value: u8

Observed code value (always > 2 when this error is raised).

§

AsymmetricBias

The affine bias was not exactly -scale, breaking the symmetric-ternary assumption (w = scale·(q-1)).

Fields

§module: String

Diffusers module name.

§row: usize

Output-feature row index.

§group: usize

128-element group index along the input dimension.

§bias: f32

Decoded bias value (f32).

§scale: f32

Decoded scale value (f32).

Trait Implementations§

Source§

impl Debug for PackError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for PackError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for PackError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<PackError> for MlxImageImportError

Source§

fn from(source: PackError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more