refactor(项目结构) 重构为 workspace 多成员项目
- 将项目拆分为三个 crate:minicpm-core(核心模型)、minicpm-convert(转换功能)、minicpm-inference(推理功能) - 添加两个示例:minimal-inference(最小推理)和 convert(模型转换) - 转换后自动拷贝 config.json 和 tokenizer.json 到 model 目录 - 更新 README 说明 workspace 结构和使用方式
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
use burn::backend::Wgpu;
|
||||
use minicpm_convert::export_model;
|
||||
use std::path::Path;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let device = Default::default();
|
||||
|
||||
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");
|
||||
let output_dir = Path::new("model");
|
||||
|
||||
export_model::<Wgpu>(
|
||||
safetensors_path,
|
||||
config_path,
|
||||
tokenizer_path,
|
||||
output_dir,
|
||||
&device,
|
||||
)?;
|
||||
|
||||
println!("模型转换完成!");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user