pub struct BertModel { /* private fields */ }Expand description
BERT encoder-only transformer model
Implementations§
Trait Implementations§
Source§impl Model for BertModel
impl Model for BertModel
Source§fn forward(
&self,
tokens: &[u32],
ctx: &mut InferenceContext,
) -> ModelResult<Tensor>
fn forward( &self, tokens: &[u32], ctx: &mut InferenceContext, ) -> ModelResult<Tensor>
Run forward pass and return logits Read more
Source§fn config(&self) -> &ModelConfig
fn config(&self) -> &ModelConfig
Get model configuration
Source§fn architecture(&self) -> Architecture
fn architecture(&self) -> Architecture
Get model architecture
Source§fn create_context(&self, backend: Arc<dyn Backend>) -> InferenceContext
fn create_context(&self, backend: Arc<dyn Backend>) -> InferenceContext
Create an InferenceContext with the right state for this model.
Source§fn vocab_size(&self) -> usize
fn vocab_size(&self) -> usize
Get vocabulary size
Source§fn max_seq_len(&self) -> usize
fn max_seq_len(&self) -> usize
Get maximum sequence length
Auto Trait Implementations§
impl Freeze for BertModel
impl RefUnwindSafe for BertModel
impl Send for BertModel
impl Sync for BertModel
impl Unpin for BertModel
impl UnsafeUnpin for BertModel
impl UnwindSafe for BertModel
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<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 more