pub struct ModelCapabilities {
pub batch_capable: bool,
pub optimal_batch_size: Option<usize>,
pub gpu_capable: bool,
pub gpu_active: bool,
pub device: Option<String>,
pub streaming_capable: bool,
pub recommended_chunk_size: Option<usize>,
pub relation_capable: bool,
pub dynamic_labels: bool,
pub discontinuous_capable: bool,
}Expand description
Summary of a model’s capabilities, useful when working with Box<dyn Model>.
Since capability traits (BatchCapable, GpuCapable, etc.) can’t be queried
through a Box<dyn Model> without downcasting, this struct provides a static
summary of what the model supports.
§Example
use anno::{Model, ModelCapabilities};
fn process_with_model(model: &dyn Model) {
let caps = model.capabilities();
if caps.batch_capable {
println!("Model supports batch processing");
}
if caps.gpu_capable {
println!("Model can use GPU: {:?}", caps.device);
}
}Fields§
§batch_capable: boolTrue if the model implements BatchCapable.
optimal_batch_size: Option<usize>Optimal batch size, if batch capable.
gpu_capable: boolTrue if the model implements GpuCapable.
gpu_active: boolTrue if GPU is currently active.
device: Option<String>Device identifier (e.g., “cuda:0”, “cpu”), if GPU capable.
streaming_capable: boolTrue if the model implements StreamingCapable.
recommended_chunk_size: Option<usize>Recommended chunk size for streaming, if streaming capable.
relation_capable: boolTrue if the model implements RelationCapable.
dynamic_labels: boolTrue if the model implements DynamicLabels (zero-shot, caller-supplied entity types).
discontinuous_capable: boolTrue if the model can extract discontinuous entities spanning non-adjacent spans.
Only W2NER (when loaded with an ONNX session) sets this today.
Trait Implementations§
Source§impl Clone for ModelCapabilities
impl Clone for ModelCapabilities
Source§fn clone(&self) -> ModelCapabilities
fn clone(&self) -> ModelCapabilities
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModelCapabilities
impl Debug for ModelCapabilities
Source§impl Default for ModelCapabilities
impl Default for ModelCapabilities
Source§fn default() -> ModelCapabilities
fn default() -> ModelCapabilities
Auto Trait Implementations§
impl Freeze for ModelCapabilities
impl RefUnwindSafe for ModelCapabilities
impl Send for ModelCapabilities
impl Sync for ModelCapabilities
impl Unpin for ModelCapabilities
impl UnsafeUnpin for ModelCapabilities
impl UnwindSafe for ModelCapabilities
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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