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
GroupColumnsMismatch
The scales/biases column count does not equal in_features / 128.
Fields
BufferLengthMismatch
A sub-tensor buffer had an unexpected element count for the stated shape.
Fields
InFeaturesNotAligned
in_features is not a positive multiple of 128 (the TQ2_0_g128 group size).
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
AsymmetricBias
The affine bias was not exactly -scale, breaking the symmetric-ternary
assumption (w = scale·(q-1)).
Trait Implementations§
Source§impl Error for PackError
impl Error for PackError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for PackError
impl RefUnwindSafe for PackError
impl Send for PackError
impl Sync for PackError
impl Unpin for PackError
impl UnsafeUnpin for PackError
impl UnwindSafe for PackError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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