pub struct AmplifyRunner { /* private fields */ }Implementations§
Source§impl AmplifyRunner
impl AmplifyRunner
Sourcepub fn from_pretrained(
modeltype: AmplifyModels,
device: Device,
) -> Result<AmplifyRunner>
pub fn from_pretrained( modeltype: AmplifyModels, device: Device, ) -> Result<AmplifyRunner>
Load model from HuggingFace hub at F32.
Use from_pretrained_with for F16 or BF16.
Sourcepub fn load_model(
modeltype: AmplifyModels,
device: Device,
) -> Result<AmplifyRunner>
👎Deprecated since 0.4.0: renamed to from_pretrained
pub fn load_model( modeltype: AmplifyModels, device: Device, ) -> Result<AmplifyRunner>
renamed to from_pretrained
Renamed to from_pretrained (ferritin-100.8).
Sourcepub fn load_model_with(
modeltype: AmplifyModels,
opts: &LoadOptions,
) -> Result<AmplifyRunner>
👎Deprecated since 0.4.0: renamed to from_pretrained_with
pub fn load_model_with( modeltype: AmplifyModels, opts: &LoadOptions, ) -> Result<AmplifyRunner>
renamed to from_pretrained_with
Renamed to from_pretrained_with (ferritin-100.8).
Sourcepub fn from_pretrained_with(
modeltype: AmplifyModels,
opts: &LoadOptions,
) -> Result<AmplifyRunner>
pub fn from_pretrained_with( modeltype: AmplifyModels, opts: &LoadOptions, ) -> Result<AmplifyRunner>
Load model with an explicit device and dtype.
Reduced precision halves the memory footprint but changes the numerics;
see tests/test_plm_dtype_parity.rs for the achievable tolerance
(ferritin-100.9).
pub fn run_forward(&self, prot_sequence: &str) -> Result<AmplifyOutput>
pub fn get_best_prediction( &self, prot_sequence: &str, ) -> Result<String, Box<dyn Error + Send + Sync>>
Sourcepub fn get_pseudo_probabilities(
&self,
prot_sequence: &str,
) -> Result<Vec<PseudoProbability>>
pub fn get_pseudo_probabilities( &self, prot_sequence: &str, ) -> Result<Vec<PseudoProbability>>
Per-residue pseudo-probabilities over the full AMPLIFY vocabulary.
position is the residue index: BOS and EOS rows are stripped first,
so there is exactly one position per input residue. Previously these
rows were included, which both over-counted positions by two and
shifted every label by one — position 0 was BOS, not the first residue
(ferritin-100.18).
Unlike crate::ESM2Runner::get_pseudo_probabilities, every amino acid is
returned rather than only those above a probability threshold.
pub fn get_contact_map(&self, prot_sequence: &str) -> Result<Vec<ContactMap>>
Trait Implementations§
Source§impl PlmRunner for AmplifyRunner
impl PlmRunner for AmplifyRunner
Source§fn embed(&self, sequence: &str) -> Result<Tensor>
fn embed(&self, sequence: &str) -> Result<Tensor>
Run AMPLIFY and return the last-layer hidden states as per-residue embeddings.
Shape: (1, L, hidden_size) where L includes BOS and EOS tokens.
Source§fn special_tokens(&self) -> SpecialTokenLayout
fn special_tokens(&self) -> SpecialTokenLayout
AMPLIFY’s tokenizer.json has a TemplateProcessing post-processor
that adds <bos> (3) and <eos> (4), so encode(.., true) wraps the
sequence.
Source§fn embed_batch(&self, sequences: &[&str]) -> Result<Tensor>
fn embed_batch(&self, sequences: &[&str]) -> Result<Tensor>
One batched forward pass over right-padded sequences (ferritin-100.12).
AMPLIFY’s pad_mask is additive, not 1 = real — it is added to
the attention scores — so the (batch, seq_len) mask goes through
additive_padding_mask in the model’s dtype before it is passed in.
Handing forward a 0/1 mask instead raises no error and masks nothing:
real keys would get +1.0 and pads +0.0, so an unpadded row shifts
uniformly and cancels in softmax, while a padded row leaves its pad
keys with the highest bias of all.
Source§fn model_name(&self) -> &str
fn model_name(&self) -> &str
Source§fn metadata(&self) -> ModelMetadata
fn metadata(&self) -> ModelMetadata
Source§fn residue_count(&self, sequence: &str) -> usize
fn residue_count(&self, sequence: &str) -> usize
sequence encodes. Read moreAuto Trait Implementations§
impl !Freeze for AmplifyRunner
impl !RefUnwindSafe for AmplifyRunner
impl !UnwindSafe for AmplifyRunner
impl Send for AmplifyRunner
impl Sync for AmplifyRunner
impl Unpin for AmplifyRunner
impl UnsafeUnpin for AmplifyRunner
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
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,
§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>
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>
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