#![cfg(feature = "tokenizers")]
use cortex_rust::Llama;
mod common;
#[test]
fn test_load_converted_model() {
let model_path = common::get_test_model_path();
if !model_path.join("model.safetensors").exists() || !model_path.join("config.json").exists() {
eprintln!(
"Skipping test: model directory not found at {:?}",
model_path
);
eprintln!("Required: model.safetensors + config.json");
return;
}
println!("Loading model from: {:?}", model_path);
let result = Llama::load_auto(model_path);
match result {
Ok(mut llama) => {
println!("✅ Model loaded successfully!");
println!(" Layers: {}", llama.model.layers.len());
let test_prompt = "Hello";
match llama.generate(test_prompt, 5) {
Ok(output) => {
println!("✅ Generation successful!");
println!(" Output: {}", output);
}
Err(e) => {
println!("⚠️ Generation failed (model loaded OK): {}", e);
}
}
}
Err(e) => {
println!("❌ Model loading failed: {}", e);
println!("This is expected if BitLlamaBlock doesn't fully support weight_packed yet");
}
}
}