ElnaggarLab / ankh3-xl

huggingface.co
Total runs: 85
24-hour runs: -1
7-day runs: 7
30-day runs: -44
Model's Last Updated: June 04 2025
feature-extraction

Introduction of ankh3-xl

Model Details of ankh3-xl

Model Details:

Ankh3 is a protein language model that is jointly optimized on two objectives:

  • Masked language modeling with multiple masking probabilities
  • Protein sequence completion.
  1. Masked Language Modeling:
  • The idea of this task is to intentionally 'corrupt' an input protein sequence by masking a certain percentage (X%) of its individual tokens (amino acids), and then train the model to reconstruct the original sequence.

  • Example on a protein sequence before and after corruption:

    Original protein sequence: MKAYVLINSRGP

    This sequence will be masked/corrupted using sentinel tokens as shown below: Sequence after corruption: M A Y L I S R G

    The decoder learns to correspond each sentinel token to the actual amino acid that was masked. In this example: K means that corresponds to the "K" amino acid and so on.

    Decoder output: K V N P

  1. Protein Sequence Completion:
  • The idea of this task is to cut the input sequence into two segments, where the first segment is fed to the encoder and the decoder is tasked to auto-regressively generate the second segment conditioned on the first segment representation outputted from the encoder.

  • Example on protein sequence completion:

    Original sequence: MKAYVLINSRGP

    We will pass "MKAYVL" of it to the encoder, and the decoder is trained that given the representation of the first part provided by the encoder, it should output the second part which is: "INSRGP"

How to use:

For Embedding Extraction:
from transformers import T5ForConditionalGeneration, T5Tokenizer, T5EncoderModel
import torch

# Random sequence from uniprot, most likely Ankh3 saw it during pre-training.
sequence = "MDTAYPREDTRAPTPSKAGAHTALTLGAPHPPPRDHLIWSVFSTLYLNLCCLGFLALAYSIKARDQKVVGDLEAARRFGSKAKCYNILAAMWTLVPPLLLLGLVVTGALHLARLAKDSAAFFSTKFDDADYD"

ckpt = "ElnaggarLab/ankh3-xl"

# Make sure that you must use `T5Tokenizer` not `AutoTokenizer`.
tokenizer = T5Tokenizer.from_pretrained(ckpt)

# To use the encoder representation using the NLU prefix:
encoder_model = T5EncoderModel.from_pretrained(ckpt).eval()


# For extracting embeddings, consider trying the '[S2S]' prefix.
# Since this prefix was specifically used to denote sequence completion
# during the model's pre-training, its use can sometimes
# lead to improved embedding quality.

nlu_sequence = "[NLU]" + sequence
encoded_nlu_sequence = tokenizer(nlu_sequence, add_special_tokens=True, return_tensors="pt", is_split_into_words=False)

with torch.no_grad():
  embedding = encoder_model(**encoded_nlu_sequence)
For Sequence Completion:
from transformers import T5ForConditionalGeneration, T5Tokenizer
from transformers.generation import GenerationConfig
import torch

sequence = "MDTAYPREDTRAPTPSKAGAHTALTLGAPHPPPRDHLIWSVFSTLYLNLCCLGFLALAYSIKARDQKVVGDLEAARRFGSKAKCYNILAAMWTLVPPLLLLGLVVTGALHLARLAKDSAAFFSTKFDDADYD"

ckpt = "ElnaggarLab/ankh3-xl"
tokenizer = T5Tokenizer.from_pretrained(ckpt)
# To use the sequence to sequence task using the S2S prefix:
model = T5ForConditionalGeneration.from_pretrained(ckpt).eval()


half_length = int(len(sequence) * 0.5)
s2s_sequence = "[S2S]" + sequence[:half_length]
encoded_s2s_sequence = tokenizer(s2s_sequence, add_special_tokens=True, return_tensors="pt", is_split_into_words=False)
# + 1 to account for the start of sequence token.
gen_config = GenerationConfig(min_length=half_length + 1, max_length=half_length + 1, do_sample=False, num_beams=1)
generated_sequence = model.generate(encoded_s2s_sequence["input_ids"], gen_config, )
predicted_sequence = sequence[:half_length] + tokenizer.batch_decode(generated_sequence)[0]

Runs of ElnaggarLab ankh3-xl on huggingface.co

85
Total runs
-1
24-hour runs
-3
3-day runs
7
7-day runs
-44
30-day runs

More Information About ankh3-xl huggingface.co Model

ankh3-xl huggingface.co

ankh3-xl huggingface.co is an AI model on huggingface.co that provides ankh3-xl's model effect (), which can be used instantly with this ElnaggarLab ankh3-xl model. huggingface.co supports a free trial of the ankh3-xl model, and also provides paid use of the ankh3-xl. Support call ankh3-xl model through api, including Node.js, Python, http.

ElnaggarLab ankh3-xl online free

ankh3-xl huggingface.co is an online trial and call api platform, which integrates ankh3-xl's modeling effects, including api services, and provides a free online trial of ankh3-xl, you can try ankh3-xl online for free by clicking the link below.

ElnaggarLab ankh3-xl online free url in huggingface.co:

https://huggingface.co/ElnaggarLab/ankh3-xl

ankh3-xl install

ankh3-xl is an open source model from GitHub that offers a free installation service, and any user can find ankh3-xl on GitHub to install. At the same time, huggingface.co provides the effect of ankh3-xl install, users can directly use ankh3-xl installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

ankh3-xl install url in huggingface.co:

https://huggingface.co/ElnaggarLab/ankh3-xl

Url of ankh3-xl

Provider of ankh3-xl huggingface.co

ElnaggarLab
ORGANIZATIONS

Other API from ElnaggarLab

huggingface.co

Total runs: 39.4K
Run Growth: 3.7K
Growth Rate: 9.42%
Updated:December 18 2023
huggingface.co

Total runs: 14.2K
Run Growth: 10.3K
Growth Rate: 72.50%
Updated:December 18 2023