feat(转换工具): 1. 添加模型转换示例 2. 更新 Cargo.toml 文件以包含新依赖 3. 删除过时的模型指南文档 4. 更新 README 文件以反映项目结构和使用说明
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "convert"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[[bin]]
|
||||
name = "convert"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
minicpm-convert = { path = "../../crates/minicpm-convert" }
|
||||
burn = { version = "0.21", default-features = false, features = ["std", "flex"] }
|
||||
anyhow = "1.0"
|
||||
@@ -0,0 +1,20 @@
|
||||
use burn::backend::{flex::FlexDevice, Flex};
|
||||
use minicpm_convert::{run_export, ExportTask, Format};
|
||||
use std::path::Path;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let safetensors_path = Path::new("MiniCPM5-1B/model-00000-of-00001.safetensors");
|
||||
let config_path = Path::new("MiniCPM5-1B/config.json");
|
||||
let tokenizer_path = Path::new("MiniCPM5-1B/tokenizer.json");
|
||||
|
||||
println!("模型转换工具");
|
||||
println!("源文件: {:?}", safetensors_path);
|
||||
println!();
|
||||
|
||||
let device = FlexDevice::default();
|
||||
let tasks = vec![ExportTask::new(Format::Full)];
|
||||
|
||||
run_export::<Flex>(safetensors_path, config_path, tokenizer_path, &tasks, &device)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user