pub struct ESMCRunner { /* private fields */ }Expand description
Wraps a loaded ESMC model for sequence embedding inference.
Implementations§
Source§impl ESMCRunner
impl ESMCRunner
Sourcepub fn from_pretrained(model: ESMCModels, device: Device) -> Result<Self>
pub fn from_pretrained(model: ESMCModels, device: Device) -> Result<Self>
Download weights from HuggingFace and load the model.
Handles the ESMCForMaskedLM wrapper prefix (esmc.) transparently:
probes for esmc.embed.weight in the safetensors and sets the
VarBuilder root to vb.pp("esmc") when found, otherwise uses the
flat (unwrapped) layout.
Sourcepub fn embed_sequence(&self, sequence: &str) -> Result<Tensor>
pub fn embed_sequence(&self, sequence: &str) -> Result<Tensor>
Tokenize sequence and run a forward pass.
Returns per-residue embeddings with shape (1, L, d_model) where
L includes the BOS and EOS tokens added by the tokenizer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ESMCRunner
impl !RefUnwindSafe for ESMCRunner
impl !Send for ESMCRunner
impl !Sync for ESMCRunner
impl Unpin for ESMCRunner
impl UnsafeUnpin for ESMCRunner
impl !UnwindSafe for ESMCRunner
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<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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