Views
No views yet
rotary_embedding_torch
einops1
2import torch
3from transformers import AutoTokenizer, AutoModel
4
5# Load the tokenizer and model using the pretrained model name
6tokenizer = AutoTokenizer.from_pretrained("isyslab/DNAFlash")
7model = AutoModel.from_pretrained("isyslab/DNAFlash", trust_remote_code=True)
8
9
10# Define input sequences
11sequences = [
12 "GAATTCCATGAGGCTATAGAATAATCTAAGAGAAATATATATATATTGAAAAAAAAAAAAAAAAAAAAAAAGGGG"
13]
14
15# Tokenize the sequences
16inputs = tokenizer(
17 sequences,
18 add_special_tokens=True,
19 return_tensors="pt",
20 padding=True,
21 truncation=True
22)
23
24# Perform a forward pass through the model to obtain the outputs, including hidden states
25with torch.inference_mode():
26 outputs = model(input_ids=inputs["input_ids"], attention_mask=inputs["attention_mask"])