feat(转换工具): 1. 更新依赖库 burn,启用 wgpu、fusion 和 autotune 特性 2. 修改主程序以使用 Wgpu 设备进行模型转换 3. 更新输出信息以反映 GPU 加速
This commit is contained in:
@@ -9,5 +9,5 @@ path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
minicpm-convert = { path = "../../crates/minicpm-convert" }
|
||||
burn = { version = "0.21", default-features = false, features = ["std", "flex"] }
|
||||
burn = { version = "0.21", default-features = false, features = ["std", "wgpu", "fusion", "autotune"] }
|
||||
anyhow = "1.0"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use burn::backend::{flex::FlexDevice, Flex};
|
||||
use burn::backend::{wgpu::WgpuDevice, Wgpu};
|
||||
use minicpm_convert::{run_export, ExportTask, Format};
|
||||
use std::path::Path;
|
||||
|
||||
@@ -7,14 +7,14 @@ fn main() -> anyhow::Result<()> {
|
||||
let config_path = Path::new("MiniCPM5-1B/config.json");
|
||||
let tokenizer_path = Path::new("MiniCPM5-1B/tokenizer.json");
|
||||
|
||||
println!("模型转换工具");
|
||||
println!("模型转换工具 (Wgpu GPU 加速)");
|
||||
println!("源文件: {:?}", safetensors_path);
|
||||
println!();
|
||||
|
||||
let device = FlexDevice::default();
|
||||
let device = WgpuDevice::default();
|
||||
let tasks = vec![ExportTask::new(Format::Full)];
|
||||
|
||||
run_export::<Flex>(safetensors_path, config_path, tokenizer_path, &tasks, &device)?;
|
||||
run_export::<Wgpu>(safetensors_path, config_path, tokenizer_path, &tasks, &device)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user