1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//! Execution module - Metadata-driven model execution engine.
//!
//! This module implements the core execution logic that interprets ModelMetadata
//! and runs inference without hard-coding model-specific logic.
//!
//! ## Module Organization
//!
//! The execution module is organized into focused submodules:
//!
//! | Module | Purpose |
//! |--------|---------|
//! | [`template`] | Model metadata schema (model_metadata.json types) |
//! | [`executor`] | Main TemplateExecutor struct and execute method |
//! | [`types`] | Data types (PreprocessedData, RawOutputs) |
//! | [`voice_loader`] | Voice embedding loading for TTS (mockable) |
//! | [`session_factory`] | Inference session creation (mockable) |
//! | [`preprocessing`] | Preprocessing step implementations |
//! | [`postprocessing`] | Postprocessing step implementations |
//! | [`modes`] | Execution mode implementations (SingleShot, Autoregressive, Whisper, TTS, BERT) |
//!
//! ## Execution Flow
//!
//! ```text
//! Envelope (input)
//! │
//! ├── Preprocessing (mel, tokenize, phonemize, etc.)
//! │ │
//! │ ▼
//! ├── PreprocessedData
//! │ │
//! ├── Execution (Onnx, SafeTensors, CoreMl, TfLite, ModelGraph)
//! │ │
//! │ ▼
//! ├── RawOutputs
//! │ │
//! ├── Postprocessing (decode, argmax, softmax, etc.)
//! │ │
//! │ ▼
//! └── Envelope (output)
//! ```
//!
//! ## Usage
//!
//! ```no_run
//! # fn _example() -> Result<(), Box<dyn std::error::Error>> {
//! use xybrid_core::execution::{TemplateExecutor, template::ModelMetadata};
//! use xybrid_core::ir::{Envelope, EnvelopeKind};
//!
//! # let config_json = "{}";
//! # let audio_bytes: Vec<u8> = vec![];
//! let metadata: ModelMetadata = serde_json::from_str(config_json)?;
//! let mut executor = TemplateExecutor::with_base_path("/path/to/model-dir");
//!
//! let input = Envelope::new(EnvelopeKind::Audio(audio_bytes));
//! let output = executor.execute(&metadata, &input, None)?;
//! # let _ = output;
//! # Ok(())
//! # }
//! ```
// Template types (model_metadata.json schema)
// Chat template formatting for LLM prompts
pub use ;
// Re-export commonly used template types at execution:: level
pub use ;
// Data types (internal)
pub
pub use ;
// Voice loader (mockable, internal)
pub
pub use ;
// Session factory (mockable, internal)
pub
pub use ;
// Main executor
pub use TemplateExecutor;
// Preprocessing steps (internal implementation details)
pub
// Postprocessing steps (internal implementation details)
pub
// Execution modes (SingleShot, Autoregressive, Whisper, TTS, BERT)
pub
// Execution listener (global hook for observing executor events)
// Execution strategies (modular execution paths, internal)
pub
pub use ;