use super::*;
pub struct GLiNERConfig {
pub prefer_quantized: bool,
pub optimization_level: u8,
pub num_threads: usize,
pub prompt_cache_size: usize,
pub bi_encoder: Option<bool>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum EncoderMode {
Uni,
Bi,
}
#[cfg(feature = "onnx")]
#[derive(Debug, Clone)]
pub(crate) struct LabelEmbedding {
#[allow(dead_code)]
pub(crate) embedding: Vec<f32>,
}
#[cfg(feature = "onnx")]
impl Default for GLiNERConfig {
fn default() -> Self {
Self {
prefer_quantized: true,
optimization_level: 3,
num_threads: 4,
prompt_cache_size: 100,
bi_encoder: None,
}
}
}
#[cfg(feature = "onnx")]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub(super) struct PromptCacheKey {
pub(super) text_hash: u64,
pub(super) entity_types_hash: u64,
pub(super) model_id: String,
}
#[cfg(feature = "onnx")]
#[derive(Debug, Clone)]
pub(super) struct PromptCacheValue {
pub(super) input_ids: Vec<i64>,
pub(super) attention_mask: Vec<i64>,
pub(super) words_mask: Vec<i64>,
pub(super) text_lengths: i64,
pub(super) entity_count: usize,
}