pub trait EmbeddingExtractor: Send + Sync {
// Required methods
fn extract(
&self,
samples: &[f32],
config: &DiarizationConfig,
) -> Result<Vec<f32>, EmbeddingError>;
fn embedding_dim(&self) -> usize;
}use the v1.0 Embedder trait in polyvoice::embedder
Expand description
Trait for speaker embedding extractors.
Implementors are expected to be thread-safe (either internally synchronized or cheaply clonable), so that they can be shared across concurrent diarizers.
use polyvoice::{EmbeddingExtractor, DummyExtractor, DiarizationConfig};
let extractor = DummyExtractor::new(256);
let config = DiarizationConfig::default();
let samples = vec![0.0f32; config.window_samples()];
let emb = extractor.extract(&samples, &config).unwrap();
assert_eq!(emb.len(), 256);Required Methods§
Sourcefn extract(
&self,
samples: &[f32],
config: &DiarizationConfig,
) -> Result<Vec<f32>, EmbeddingError>
👎Deprecated since 0.7.0: use the v1.0 Embedder trait in polyvoice::embedder
fn extract( &self, samples: &[f32], config: &DiarizationConfig, ) -> Result<Vec<f32>, EmbeddingError>
use the v1.0 Embedder trait in polyvoice::embedder
Extract an embedding from raw 16 kHz (or config.sample_rate) mono f32 samples.
The caller is responsible for ensuring the buffer length matches the model
expectations (usually config.window_samples()). Implementations may pad
or truncate, but should prefer returning an error when the input is unusable.
Sourcefn embedding_dim(&self) -> usize
👎Deprecated since 0.7.0: use the v1.0 Embedder trait in polyvoice::embedder
fn embedding_dim(&self) -> usize
use the v1.0 Embedder trait in polyvoice::embedder
Dimensionality of the produced embedding vectors.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl EmbeddingExtractor for DummyExtractor
impl EmbeddingExtractor for FbankOnnxExtractor
onnx only.impl EmbeddingExtractor for OnnxEmbeddingExtractor
onnx only.