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
//! # abyo-speculate
//!
//! Pure Rust Speculative Decoding library for local LLMs, optimized for batch size 1.
//!
//! See the [crate README](https://github.com/abyo-software/abyo-speculate) and
//! the project plan for design context.
//!
//! ## Quick example
//!
//! ```no_run
//! use abyo_speculate::{SpeculateEngine, Method};
//!
//! # fn main() -> anyhow::Result<()> {
//! let mut engine = SpeculateEngine::builder()
//! .target_model("llama-3.1-8b-instruct")
//! .method(Method::Vanilla)
//! .draft_model("tinyllama-1.1b")
//! .build()?;
//!
//! // engine.with_target(...).with_draft(...) attach loaded models;
//! // see model::qwen2::Qwen2Decoder for a concrete loader.
//! let _tokens = engine.generate_tokens(&[1u32, 2, 3], 64)?;
//! # Ok(())
//! # }
//! ```
pub use ;
pub use ;
pub use Method;