torchcell.models.nucleotide_transformer.NucleotideTransformer

class NucleotideTransformer[source]

Bases: NucleotideModel

InstaDeepAI Nucleotide Transformer for DNA sequence embeddings.

property max_sequence_size: int

Return the maximum supported input sequence length in bases.

load_model(model_name: str = 'InstaDeepAI/nucleotide-transformer-2.5b-multi-species') → None[source]

Load the named Hub checkpoint’s tokenizer and model onto the device.

embed(sequences: str | list[str], mean_embedding: bool = False) → Tensor[source]

Embed DNA sequences: per-token [batch, tokens, dim] or mean [batch, dim].

With mean_embedding the last hidden state is averaged over the non-pad tokens of each sequence.