pub struct CandleEngine { /* private fields */ }Expand description
Candle-backed inference engine.
Implementations§
Source§impl CandleEngine
impl CandleEngine
Sourcepub fn toy(vocab: usize, dim: usize, eos: Token) -> Result<Self>
pub fn toy(vocab: usize, dim: usize, eos: Token) -> Result<Self>
Build a deterministic toy model on the CPU — no model file required.
Uses fixed synthetic weights so tests are deterministic.
Sourcepub fn from_path(path: impl AsRef<Path>, eos: Token) -> Result<Self>
pub fn from_path(path: impl AsRef<Path>, eos: Token) -> Result<Self>
Load token_embd.weight and output.weight from a consumer-supplied GGUF file.
§Limitations
This engine’s forward pass is embed[last_token] · w_out — a single linear
projection. Only these two tensors are used; transformer blocks, attention,
RoPE, and norms present in the GGUF are ignored. Logits will not match a
real Llama/Mistral/etc. forward. This is the ADR-002 engine-seam proof; for
a full transformer forward implement a separate InferenceEngine using
candle-transformers.
Sourcepub fn from_bytes(data: &[u8], eos: Token) -> Result<Self>
pub fn from_bytes(data: &[u8], eos: Token) -> Result<Self>
Load from raw bytes (WASM / memory-mapped scenarios).
Same limitations as Self::from_path: only token_embd.weight and
output.weight are used; the forward is embed[last] · w_out.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CandleEngine
impl !UnwindSafe for CandleEngine
impl Freeze for CandleEngine
impl Send for CandleEngine
impl Sync for CandleEngine
impl Unpin for CandleEngine
impl UnsafeUnpin for CandleEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more