1mod chat_template;
2mod content;
3mod gguf_tokenizer;
4use strum::EnumString;
5
6use anyhow::{Context, Result};
7pub(crate) use chat_template::get_gguf_chat_template;
8pub(crate) use content::Content;
9pub(crate) use gguf_tokenizer::{convert_gguf_to_hf_tokenizer, GgufTokenizerConversion};
10use std::str::FromStr;
11
12pub const GGUF_MULTI_FILE_DELIMITER: &str = ";";
13
14#[derive(Debug, EnumString, Clone, Copy, strum::Display)]
15#[strum(serialize_all = "lowercase")]
16pub enum GGUFArchitecture {
17 Llama,
18 Mpt,
19 Gptneox,
20 Gptj,
21 Gpt2,
22 Bloom,
23 Falcon,
24 Mamba,
25 Rwkv,
26 Phi2,
27 Phi3,
28 Starcoder2,
29 Qwen2,
30 Qwen3,
31 Qwen3MoE,
32 Qwen35,
33 Qwen35MoE,
34 Mistral3,
35}
36
37impl GGUFArchitecture {
41 pub fn from_value<T: AsRef<str> + std::fmt::Display>(value: T) -> Result<Self> {
42 Self::from_str(&value.as_ref().to_ascii_lowercase())
43 .with_context(|| format!("Unknown GGUF architecture `{value}`"))
44 .map_err(anyhow::Error::msg)
45 }
46}