summaryrefslogtreecommitdiff
path: root/candle-examples/examples/ggml/main.rs
blob: 9e3e1ba6ebcb1d001721b7313127d786a09edff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use anyhow::Result;
use clap::Parser;
use std::fs::File;

use candle::quantized::ggml_file::Content;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
    /// GGML file to load, typically a .bin file generated by the quantize command from llama.cpp
    #[arg(long)]
    model: String,
}

fn main() -> Result<()> {
    let args = Args::parse();

    let mut file = File::open(args.model)?;
    let start = std::time::Instant::now();
    let model = Content::read(&mut file)?;

    println!(
        "Loaded {:?} tensors in {:?}",
        model.tensors.len(),
        start.elapsed()
    );
    Ok(())
}