pub struct MultiscreenEngine { /* private fields */ }Expand description
Main user-facing engine.
Implementations§
Source§impl MultiscreenEngine
impl MultiscreenEngine
Sourcepub fn new(config: MultiscreenConfig) -> Result<Self>
pub fn new(config: MultiscreenConfig) -> Result<Self>
Creates a new engine with the given configuration.
Sourcepub fn from_weights_file(path: impl AsRef<Path>) -> Result<Self>
pub fn from_weights_file(path: impl AsRef<Path>) -> Result<Self>
Creates a new engine by loading a weights file.
The config embedded in the weights file becomes the engine’s config. This is the easiest way to resume from a previously saved model.
Sourcepub fn config(&self) -> &MultiscreenConfig
pub fn config(&self) -> &MultiscreenConfig
Returns the active configuration.
Sourcepub fn train(&mut self, input: TrainInput) -> Result<TrainReport>
pub fn train(&mut self, input: TrainInput) -> Result<TrainReport>
Trains the lightweight transition state from token IDs.
Sourcepub fn infer_tokens(&self, input_ids: &[u32]) -> Result<InferenceOutput>
pub fn infer_tokens(&self, input_ids: &[u32]) -> Result<InferenceOutput>
Runs deterministic token inference.
Sourcepub fn save_weights(&self, path: impl AsRef<Path>) -> Result<()>
pub fn save_weights(&self, path: impl AsRef<Path>) -> Result<()>
Saves the engine’s config, learned state, and training report to a JSON weights file.
The file embeds the full MultiscreenConfig so that load_weights can
verify a match before restoring state.
Sourcepub fn load_weights(&mut self, path: impl AsRef<Path>) -> Result<TrainReport>
pub fn load_weights(&mut self, path: impl AsRef<Path>) -> Result<TrainReport>
Loads weights from a JSON file into this engine.
Config validation: the config stored in the weights file is compared
against this engine’s active config. If they do not match exactly, the
load is rejected and a Error::WeightsConfigMismatch is returned.
This prevents subtle bugs caused by running a state trained under one
configuration through an engine configured differently.
Trait Implementations§
Source§impl Clone for MultiscreenEngine
impl Clone for MultiscreenEngine
Source§fn clone(&self) -> MultiscreenEngine
fn clone(&self) -> MultiscreenEngine
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more