CodonLLM-1.5B is an autoregressive language model fine-tuned for general synonymous codon optimization. The model translates arbitrary protein amino acid sequences into biologically viable DNA coding sequences while strictly preserving 100% amino acid sequence fidelity and open reading frames.
unsloth/Qwen2.5-Coder-1.5B-Instruct-bnb-4bit (Qwen2.5-Coder-1.5B)q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_projfrom unsloth import FastLanguageModel
# Load model and tokenizer
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="<your-hf-username>/CodonLLM-1.5B",
max_seq_length=2048,
load_in_4bit=True,
)
FastLanguageModel.for_inference(model)
# Target protein sequence
protein = "MSKGEELFTGVVPILVELDGDVNGHKFSVSGEGEGDATYGKLTLKFICTTGKLPVPWPTLVTTFSYGVQCFSRYPDHMKQHDFFKSAMPEGYVQERTIFFKDDGNYKTRAEVKFEGDTLVNRIELKGIDFKEDGNILGHKLEYNYNSHNVYIMADKQKNGIKVNFKIRHNIEDGSVQLADHYQQNTPIGDGPVLLPDNHYLSTQSALSKDPNEKRDHMVLLEFVTAAGITHGMDELYK"
# Instruction prompt
prompt = f"""Below is an instruction that describes a biological task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
Optimize the following protein sequence into a high-expression DNA coding sequence.
### Input:
{protein}
### Response:
"""
inputs = tokenizer([prompt], return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=492)
response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print("Generated Coding DNA:\n", response.strip())
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_name = "unsloth/Qwen2.5-Coder-1.5B-Instruct-bnb-4bit"
adapter_repo = "<your-hf-username>/CodonLLM-1.5B"
tokenizer = AutoTokenizer.from_pretrained(adapter_repo)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_name,
torch_dtype=torch.bfloat16,
device_map="auto"
)
model = PeftModel.from_pretrained(base_model, adapter_repo)
train_on_responses_only).This model and its adapter weights are distributed under the Apache License, Version 2.0.
unsloth/Qwen2.5-Coder-1.5B-Instruct-bnb-4bit