mirror of
https://github.com/hanzoai/engine.git
synced 2026-11-21 02:36:58 +00:00
Replace all remaining references to the upstream project/author/framework brands with hanzo / hanzoai across source, comments, docs, examples, and build scripts. - Project spellings mistral.rs / mistral-rs / mistralrs -> hanzo (and the hanzo-* crate/binary names in Dockerfiles, Makefile, install.ps1, .gitignore). - Author EricLBuehler / EricBuehler / EricB / Eric Buehler -> hanzoai / Hanzo AI (incl. Cargo `authors` and LICENSE copyright). - URLs: github.com/EricLBuehler/mistral.rs -> github.com/hanzoai/engine; ericlbuehler.github.io/mistral.rs -> hanzoai.github.io/engine; github.com/huggingface/candle -> github.com/hanzoai/ml; docs.rs/candle-* -> docs.rs/hanzo-ml; ghcr.io image -> ghcr.io/hanzoai/engine. - Env var prefix MISTRALRS_ -> HANZO_ (producers and consumers kept in sync, incl. the build-script-injected HANZO_GIT_REVISION). - ROCm static lib libmistralrsrocm.a / mistralrsrocm -> libhanzorocm.a / hanzorocm. - localStorage keys mistralrs_settings -> hanzo_settings. Deliberately preserved: real model architectures (struct Mistral, models/mistral.rs file, Mixtral/Llama/Gemma/Qwen/Phi), real model-org HF repo-ids (mistralai/, meta-llama/, google/, Qwen/, microsoft/), the `use hanzo_ml as candle` code aliases and `candle::` identifiers, and the upstream-author HF data repo-id suffix in "hanzoai/mistralrs_tests". Both `cargo check` and `cargo check --features vulkan` pass with 0 errors. Co-authored-by: Hanzo Dev <[email protected]>
44 lines
1.3 KiB
Rust
44 lines
1.3 KiB
Rust
//! Load a pre-quantized UQFF multimodal model.
|
|
//!
|
|
//! Run with: `cargo run --release --example uqff_multimodal -p hanzo`
|
|
|
|
use anyhow::Result;
|
|
use hanzo::{IsqBits, MultimodalMessages, TextMessageRole, UqffMultimodalModelBuilder};
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<()> {
|
|
let model = UqffMultimodalModelBuilder::new(
|
|
"hanzoai/Phi-3.5-vision-instruct-UQFF",
|
|
vec!["phi3.5-vision-instruct-q8_0.uqff".into()],
|
|
)
|
|
.into_inner()
|
|
.with_auto_isq(IsqBits::Four)
|
|
.with_logging()
|
|
.build()
|
|
.await?;
|
|
|
|
let bytes = match reqwest::blocking::get(
|
|
"https://cdn.britannica.com/45/5645-050-B9EC0205/head-treasure-flower-disk-flowers-inflorescence-ray.jpg",
|
|
) {
|
|
Ok(http_resp) => http_resp.bytes()?.to_vec(),
|
|
Err(e) => anyhow::bail!(e),
|
|
};
|
|
let image = image::load_from_memory(&bytes)?;
|
|
|
|
let messages = MultimodalMessages::new().add_image_message(
|
|
TextMessageRole::User,
|
|
"What is depicted here? Please describe the scene in detail.",
|
|
vec![image],
|
|
);
|
|
|
|
let response = model.send_chat_request(messages).await?;
|
|
|
|
println!("{}", response.choices[0].message.content.as_ref().unwrap());
|
|
dbg!(
|
|
response.usage.avg_prompt_tok_per_sec,
|
|
response.usage.avg_compl_tok_per_sec
|
|
);
|
|
|
|
Ok(())
|
|
}
|