//! Factories for candle models

use crate::prelude::*;

use super::{Builder, Candle};

/// Instantiate a `llama` model
pub fn llama(repo: impl Into<String>, model: impl Into<String>) -> Builder
{
  Candle::build()
    .model(repo, model)
    .tokenizer_repo("hf-internal-testing/llama-tokenizer")
    .end_of_stream("</s>")
    .template(template::Template::new(include_str!("../../data/templates/plain")).unwrap())
}

/// Instantiate a `llama` 2 7B model
pub fn llama2_7b() -> Builder
{
  llama("TheBloke/Llama-2-7B-GGML", "llama-2-7b.ggmlv3.q4_0.bin")
}

/// Instantiate a `SmolLM` 2 1.7B model
pub fn smol_lm_2_1_7b() -> Builder
{
  Candle::build()
    .model(
      "HuggingFaceTB/SmolLM2-1.7B-Instruct-GGUF",
      "smollm2-1.7b-instruct-q4_k_m.gguf",
    )
    .tokenizer_repo("HuggingFaceTB/SmolLM2-1.7B-Instruct")
    .end_of_stream("<|im_end|>")
    .template(template::Template::new(include_str!("../../data/templates/smol")).unwrap())
}
