mirror of
https://github.com/tracel-ai/burn.git
synced 2026-05-31 19:49:48 +09:00
* Move ONNX import into burn-onnx crate * Update publish * Update burn-import -> burn-onnx * Fix clippy warnings that are no longer allowed * Allow unused * Update contributor book references to burn-onnx Update all burn-import path references in the ONNX development guide to point to the new burn-onnx crate location. * Remove ONNX integration steps from burn op guide Deleted the section detailing how to add a new operation to burn-onnx, including ONNX IR and code generation mapping steps. This streamlines the guide and removes outdated or redundant ONNX-specific instructions. * Update onnx-ir references from burn-import to burn-onnx Update documentation and code comments to reference the new burn-onnx crate instead of burn-import. * Update ONNX test producer name to burn-onnx-test Update producer_name metadata in Python test scripts from "burn-import-test" to "burn-onnx-test" for consistency. * Undo ONNX file changes
34 lines
1.2 KiB
Rust
34 lines
1.2 KiB
Rust
use burn_onnx::ModelGen;
|
|
use std::path::Path;
|
|
|
|
fn main() {
|
|
let onnx_path = "artifacts/clip-vit-b-32-text_opset16.onnx";
|
|
let test_data_path = "artifacts/test_data.pt";
|
|
|
|
// Tell Cargo to only rebuild if these files change
|
|
println!("cargo:rerun-if-changed={}", onnx_path);
|
|
println!("cargo:rerun-if-changed={}", test_data_path);
|
|
println!("cargo:rerun-if-changed=build.rs");
|
|
|
|
// Check if the ONNX model file exists
|
|
if !Path::new(onnx_path).exists() {
|
|
eprintln!("Error: ONNX model file not found at '{}'", onnx_path);
|
|
eprintln!();
|
|
eprintln!("Please run the following command to download and prepare the model:");
|
|
eprintln!(" python get_model.py");
|
|
eprintln!();
|
|
eprintln!("Or if you prefer using uv:");
|
|
eprintln!(" uv run get_model.py");
|
|
eprintln!();
|
|
eprintln!("This will download the CLIP ViT-B-32-text model and convert it to ONNX format.");
|
|
std::process::exit(1);
|
|
}
|
|
|
|
// Generate the model code from the ONNX file
|
|
// Use double precision to handle large Int64 constants in CLIP
|
|
ModelGen::new()
|
|
.input(onnx_path)
|
|
.out_dir("model/")
|
|
.run_from_script();
|
|
}
|