mirror of
https://github.com/huggingface/candle.git
synced 2025-06-18 19:47:12 +00:00
Add some preliminary ONNX support (#1260)
* Add the onnx protos. * Move the reading bits. * Install protoc on the CI. * Install protoc on the cuda CI too. * Use clap for the onnx tool. * Tweak the CI protoc install. * Add some simple evalution function. * Add some binary operator support.
This commit is contained in:
14
candle-onnx/src/lib.rs
Normal file
14
candle-onnx/src/lib.rs
Normal file
@ -0,0 +1,14 @@
|
||||
use candle::Result;
|
||||
use prost::Message;
|
||||
|
||||
pub mod onnx {
|
||||
include!(concat!(env!("OUT_DIR"), "/onnx.rs"));
|
||||
}
|
||||
|
||||
mod eval;
|
||||
pub use eval::simple_eval;
|
||||
|
||||
pub fn read_file<P: AsRef<std::path::Path>>(p: P) -> Result<onnx::ModelProto> {
|
||||
let buf = std::fs::read(p)?;
|
||||
onnx::ModelProto::decode(buf.as_slice()).map_err(candle::Error::wrap)
|
||||
}
|
Reference in New Issue
Block a user