pub enum Quantization {
Show 63 variants
Iq1S,
Iq1M,
UdIq1S,
UdIq1M,
Tq1_0,
UdTq1_0,
Iq2Xxs,
UdIq2Xxs,
Iq2Xs,
Iq2S,
Iq2M,
UdIq2M,
Q2KXl,
Q2KL,
Q2K,
Iq3Xxs,
UdIq3Xxs,
Iq3Xs,
Iq3S,
UdIq3S,
Iq3M,
Q3KXl,
Q3KL,
Q3KM,
UdQ3KM,
Q3KS,
UdQ3KS,
Iq4Xs,
UdIq4Xs,
Iq4Nl,
UdIq4Nl,
Q4KXl,
Q4KL,
Q4KM,
UdQ4KM,
Q4KS,
UdQ4KS,
Q4_1,
Q4_0,
Mxfp4,
Q4,
Q5KXl,
Q5KL,
Q5KM,
UdQ5KM,
Q5KS,
UdQ5KS,
Q5_0,
Q5_1,
Q5,
Q6KXl,
Q6KL,
Q6K,
UdQ6K,
Q6,
Q8KXl,
Q8_0,
Q8,
Bf16,
F16,
F32,
Imatrix,
Unknown,
}Expand description
Represents the quantization type of a GGUF model file.
This enum provides type-safe handling of quantization types commonly used in GGUF model naming conventions.
§Unsloth Dynamic (“UD-”) quants
Unsloth publishes many repos with both a plain quant (e.g. Q6_K) and a
“UD-” prefixed Unsloth Dynamic quant (e.g. UD-Q6_K) that otherwise shares
the exact same bit-depth suffix. These are modeled as distinct variants
(Q6K vs UdQ6K) so they are never conflated: without this distinction, a
naive filename match would treat Q6_K/model.gguf and UD-Q6_K/model.gguf
as the same quantization, which previously caused both to be downloaded
together as if they were shards of one request. See from_filename for
how the “UD-” modifier is detected.
Variants§
Iq1S
Iq1M
UdIq1S
Unsloth Dynamic (“UD-”) variant of Self::Iq1S.
UdIq1M
Unsloth Dynamic (“UD-”) variant of Self::Iq1M.
Tq1_0
UdTq1_0
Unsloth Dynamic (“UD-”) variant of Self::Tq1_0.
Iq2Xxs
UdIq2Xxs
Unsloth Dynamic (“UD-”) variant of Self::Iq2Xxs.
Iq2Xs
Iq2S
Iq2M
UdIq2M
Unsloth Dynamic (“UD-”) variant of Self::Iq2M.
Q2KXl
Q2KL
Q2K
Iq3Xxs
UdIq3Xxs
Unsloth Dynamic (“UD-”) variant of Self::Iq3Xxs.
Iq3Xs
Iq3S
UdIq3S
Unsloth Dynamic (“UD-”) variant of Self::Iq3S.
Iq3M
Q3KXl
Q3KL
Q3KM
UdQ3KM
Unsloth Dynamic (“UD-”) variant of Self::Q3KM.
Q3KS
UdQ3KS
Unsloth Dynamic (“UD-”) variant of Self::Q3KS.
Iq4Xs
UdIq4Xs
Unsloth Dynamic (“UD-”) variant of Self::Iq4Xs.
Iq4Nl
UdIq4Nl
Unsloth Dynamic (“UD-”) variant of Self::Iq4Nl.
Q4KXl
Q4KL
Q4KM
UdQ4KM
Unsloth Dynamic (“UD-”) variant of Self::Q4KM.
Q4KS
UdQ4KS
Unsloth Dynamic (“UD-”) variant of Self::Q4KS.
Q4_1
Q4_0
Mxfp4
Q4
Q5KXl
Q5KL
Q5KM
UdQ5KM
Unsloth Dynamic (“UD-”) variant of Self::Q5KM.
Q5KS
UdQ5KS
Unsloth Dynamic (“UD-”) variant of Self::Q5KS.
Q5_0
Q5_1
Q5
Q6KXl
Q6KL
Q6K
UdQ6K
Unsloth Dynamic (“UD-”) variant of Self::Q6K.
Q6
Q8KXl
Q8_0
Q8
Bf16
F16
F32
Imatrix
Unknown
Implementations§
Source§impl Quantization
impl Quantization
Sourcepub const fn is_unknown(&self) -> bool
pub const fn is_unknown(&self) -> bool
Returns true if this quantization type is unknown.
Sourcepub fn from_filename(filename: &str) -> Self
pub fn from_filename(filename: &str) -> Self
Extract quantization type from a filename.
Matching is boundary-aware and allocation-free: a pattern only counts as
a match when it is flanked by non-alphanumeric characters (or the
start/end of the string), which avoids false positives against
unrelated alphanumeric substrings in a model name. When multiple
patterns match, the longest one wins, so correctness does not depend
on QUANT_PATTERNS ordering.
Unsloth’s “UD-” (“Unsloth Dynamic”) naming convention is detected as an
orthogonal, delimited token immediately preceding the matched base
pattern (see UD_VARIANT_MAP), rather than by duplicating full
pattern strings like "UD-Q6_K" — this keeps e.g. Q6_K and UD-Q6_K
as distinct values even though they share the same underlying
bit-depth pattern.
Sourcepub fn canonical_patterns() -> impl Iterator<Item = &'static str>
pub fn canonical_patterns() -> impl Iterator<Item = &'static str>
Every canonical filename pattern string recognized by
Self::from_filename, for callers that need to generate
candidate filenames rather than match an existing one — e.g. probing
a repository for known-quantization files when a richer listing API
is unavailable.
Exposes only the pattern strings, not the private "UD-" variant
table: candidate generation only needs the string half, and the
smaller surface avoids committing to more than the current caller
needs.
Trait Implementations§
Source§impl Clone for Quantization
impl Clone for Quantization
Source§fn clone(&self) -> Quantization
fn clone(&self) -> Quantization
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Quantization
impl Debug for Quantization
Source§impl Default for Quantization
impl Default for Quantization
Source§fn default() -> Quantization
fn default() -> Quantization
Source§impl<'de> Deserialize<'de> for Quantization
impl<'de> Deserialize<'de> for Quantization
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for Quantization
impl Display for Quantization
Source§impl FromStr for Quantization
impl FromStr for Quantization
Source§impl PartialEq for Quantization
impl PartialEq for Quantization
Source§fn eq(&self, other: &Quantization) -> bool
fn eq(&self, other: &Quantization) -> bool
self and other values to be equal, and is used by ==.