feat(转换工具): 1. 更新依赖库 burn,启用 wgpu、fusion 和 autotune 特性 2. 修改主程序以使用 Wgpu 设备进行模型转换 3. 更新输出信息以反映 GPU 加速

This commit is contained in:
2026-07-08 15:22:00 +08:00
parent e235edee4a
commit 564b1e4a09
3 changed files with 6 additions and 10 deletions
Generated
-4
View File
@@ -564,7 +564,6 @@ version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0098bf6555c151517b4c98ca0e8ed1ab6a976e40f5f4e967c117b00eee21e192" checksum = "0098bf6555c151517b4c98ca0e8ed1ab6a976e40f5f4e967c117b00eee21e192"
dependencies = [ dependencies = [
"aligned-vec",
"burn-backend", "burn-backend",
"burn-ir", "burn-ir",
"burn-std", "burn-std",
@@ -572,9 +571,7 @@ dependencies = [
"gemm", "gemm",
"half", "half",
"libm", "libm",
"macerator",
"num-traits", "num-traits",
"rayon",
] ]
[[package]] [[package]]
@@ -752,7 +749,6 @@ dependencies = [
"aligned-vec", "aligned-vec",
"bon", "bon",
"burn-cubecl", "burn-cubecl",
"burn-flex",
"burn-fusion", "burn-fusion",
"burn-ir", "burn-ir",
"burn-tensor", "burn-tensor",
+1 -1
View File
@@ -9,5 +9,5 @@ path = "src/main.rs"
[dependencies] [dependencies]
minicpm-convert = { path = "../../crates/minicpm-convert" } 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" anyhow = "1.0"
+4 -4
View File
@@ -1,4 +1,4 @@
use burn::backend::{flex::FlexDevice, Flex}; use burn::backend::{wgpu::WgpuDevice, Wgpu};
use minicpm_convert::{run_export, ExportTask, Format}; use minicpm_convert::{run_export, ExportTask, Format};
use std::path::Path; use std::path::Path;
@@ -7,14 +7,14 @@ fn main() -> anyhow::Result<()> {
let config_path = Path::new("MiniCPM5-1B/config.json"); let config_path = Path::new("MiniCPM5-1B/config.json");
let tokenizer_path = Path::new("MiniCPM5-1B/tokenizer.json"); let tokenizer_path = Path::new("MiniCPM5-1B/tokenizer.json");
println!("模型转换工具"); println!("模型转换工具 (Wgpu GPU 加速)");
println!("源文件: {:?}", safetensors_path); println!("源文件: {:?}", safetensors_path);
println!(); println!();
let device = FlexDevice::default(); let device = WgpuDevice::default();
let tasks = vec![ExportTask::new(Format::Full)]; 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(()) Ok(())
} }