pub enum ConstrainedGenerateError {
Runtime(Error),
Constraint(ConstraintError),
}Expand description
Either a normal runtime error, or the constraint leaving no valid token —
the two failure modes generate_constrained can hit.
Kept crate-local (hand-rolled Display/Error, no thiserror) rather than
bolted onto kopitiam_core::Error: this crate does not own that enum, and
“the grammar constraint masked every token” is a decoding-policy fact that
belongs next to the decoding code, not in the shared tensor-error vocabulary.
A ? on any inner runtime call folds into Runtime; a
? on ConstrainedSampler::try_sample folds into
Constraint.
Variants§
Runtime(Error)
A normal runtime failure (tokenize / forward pass / decode).
Constraint(ConstraintError)
The constraint masked every in-range token at some step — see
ConstraintError. Almost always means the constraint is missing an
escape hatch (e.g. it never allows EOS), not a broken model.
Trait Implementations§
Source§impl Debug for ConstrainedGenerateError
impl Debug for ConstrainedGenerateError
Source§impl Display for ConstrainedGenerateError
impl Display for ConstrainedGenerateError
Source§impl Error for ConstrainedGenerateError
impl Error for ConstrainedGenerateError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()