Skip to main content

gigastt_core/
lib.rs

1#[cfg(all(
2    feature = "candle",
3    any(feature = "coreml", feature = "cuda", feature = "nnapi")
4))]
5compile_error!("feature `candle` is mutually exclusive with `coreml`/`cuda`/`nnapi`");
6
7#[cfg(all(
8    feature = "ane",
9    any(
10        feature = "coreml",
11        feature = "cuda",
12        feature = "nnapi",
13        feature = "candle"
14    )
15))]
16compile_error!("feature `ane` is mutually exclusive with `coreml`/`cuda`/`nnapi`/`candle`");
17
18pub mod error;
19pub mod export;
20pub mod inference;
21pub mod itn;
22pub mod lexicon;
23pub mod model;
24pub mod protocol;
25pub mod punctuation;
26
27/// INT8 quantizer, re-exported so `gigastt_core::quantize::quantize_model`
28/// keeps working. Behind the default-on `quantize` feature: lean embedders that
29/// side-load a pre-quantized model can turn it off and drop `prost` — and the
30/// `protoc` build requirement — entirely.
31#[cfg(feature = "quantize")]
32pub use gigastt_quantize as quantize;
33
34/// ONNX protobuf types used by the quantizer. Re-exported at the historical
35/// `gigastt_core::onnx_proto` path so existing dependents keep compiling.
36/// Nested modules are re-exported explicitly so paths like
37/// `onnx_proto::tensor_proto::DataType` remain reachable.
38#[cfg(feature = "quantize")]
39pub mod onnx_proto {
40    pub use gigastt_quantize::onnx_proto::AttributeProto;
41    pub use gigastt_quantize::onnx_proto::DeviceConfigurationProto;
42    pub use gigastt_quantize::onnx_proto::FunctionProto;
43    pub use gigastt_quantize::onnx_proto::GraphProto;
44    pub use gigastt_quantize::onnx_proto::IntIntListEntryProto;
45    pub use gigastt_quantize::onnx_proto::ModelProto;
46    pub use gigastt_quantize::onnx_proto::NodeDeviceConfigurationProto;
47    pub use gigastt_quantize::onnx_proto::NodeProto;
48    pub use gigastt_quantize::onnx_proto::OperatorSetIdProto;
49    pub use gigastt_quantize::onnx_proto::OperatorStatus;
50    pub use gigastt_quantize::onnx_proto::ShardedDimProto;
51    pub use gigastt_quantize::onnx_proto::ShardingSpecProto;
52    pub use gigastt_quantize::onnx_proto::SimpleShardedDimProto;
53    pub use gigastt_quantize::onnx_proto::SparseTensorProto;
54    pub use gigastt_quantize::onnx_proto::StringStringEntryProto;
55    pub use gigastt_quantize::onnx_proto::TensorAnnotation;
56    pub use gigastt_quantize::onnx_proto::TensorProto;
57    pub use gigastt_quantize::onnx_proto::TensorShapeProto;
58    pub use gigastt_quantize::onnx_proto::TrainingInfoProto;
59    pub use gigastt_quantize::onnx_proto::TypeProto;
60    pub use gigastt_quantize::onnx_proto::ValueInfoProto;
61    pub use gigastt_quantize::onnx_proto::Version;
62    pub use gigastt_quantize::onnx_proto::attribute_proto;
63    pub use gigastt_quantize::onnx_proto::simple_sharded_dim_proto;
64    pub use gigastt_quantize::onnx_proto::tensor_proto;
65    pub use gigastt_quantize::onnx_proto::tensor_shape_proto;
66    pub use gigastt_quantize::onnx_proto::type_proto;
67}
68
69pub(crate) mod runtime;
70mod sha256;
71pub mod vad;
72mod wordpiece;
73
74pub use runtime::cpu_factory;
75
76/// Runtime abstraction surface needed to drive backends directly (e.g. parity
77/// tests that construct and compare the ort and candle encoder sessions).
78pub mod runtime_api {
79    #[cfg(all(feature = "ane", target_os = "macos"))]
80    pub use crate::runtime::ane_factory;
81    #[cfg(feature = "candle")]
82    pub use crate::runtime::candle_factory;
83    pub use crate::runtime::{
84        Runtime, RuntimeError, RuntimeFactory, RuntimeSession, Shape, Tensor, TensorData,
85        TensorDataView, cpu_factory, production_factory,
86    };
87}