pub struct NeedleModel { /* private fields */ }Implementations§
Source§impl NeedleModel
impl NeedleModel
Sourcepub fn load(safetensors: &Path, device: &Device) -> Result<Self>
pub fn load(safetensors: &Path, device: &Device) -> Result<Self>
Load from the needle-1 bf16 safetensors (HF naming). Runs in f32 on CPU.
Sourcepub fn encode(&self, enc_ids: &Tensor) -> Result<Tensor>
pub fn encode(&self, enc_ids: &Tensor) -> Result<Tensor>
Encode enc_ids: [B,Te] → encoder states [B,Te,D] (no padding mask; assumes packed sequences).
Sourcepub fn decode(&self, dec_ids: &Tensor, enc_out: &Tensor) -> Result<Tensor>
pub fn decode(&self, dec_ids: &Tensor, enc_out: &Tensor) -> Result<Tensor>
Decode dec_ids: [B,Td] against enc_out → logits [B,Td,VOCAB] (causal self-attn).
Sourcepub fn forward(&self, enc_ids: &Tensor, dec_ids: &Tensor) -> Result<Tensor>
pub fn forward(&self, enc_ids: &Tensor, dec_ids: &Tensor) -> Result<Tensor>
Full teacher-forced forward: (enc_ids, dec_ids) → logits [B,Td,VOCAB].
pub fn device(&self) -> &Device
Auto Trait Implementations§
impl !RefUnwindSafe for NeedleModel
impl !UnwindSafe for NeedleModel
impl Freeze for NeedleModel
impl Send for NeedleModel
impl Sync for NeedleModel
impl Unpin for NeedleModel
impl UnsafeUnpin for NeedleModel
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
Converts
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> ⓘ
Converts
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 moreCreates a shared type from an unshared type.