Text Generation
Transformers
Safetensors
gpt2
biology
plasmid
dna
synthetic-biology
grpo
reinforcement-learning
text-generation-inference
Instructions to use UCL-CSSB/PlasmidGPT-GRPO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use UCL-CSSB/PlasmidGPT-GRPO with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="UCL-CSSB/PlasmidGPT-GRPO")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("UCL-CSSB/PlasmidGPT-GRPO") model = AutoModelForCausalLM.from_pretrained("UCL-CSSB/PlasmidGPT-GRPO", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use UCL-CSSB/PlasmidGPT-GRPO with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "UCL-CSSB/PlasmidGPT-GRPO" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "UCL-CSSB/PlasmidGPT-GRPO", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/UCL-CSSB/PlasmidGPT-GRPO
- SGLang
How to use UCL-CSSB/PlasmidGPT-GRPO with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "UCL-CSSB/PlasmidGPT-GRPO" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "UCL-CSSB/PlasmidGPT-GRPO", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "UCL-CSSB/PlasmidGPT-GRPO" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "UCL-CSSB/PlasmidGPT-GRPO", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use UCL-CSSB/PlasmidGPT-GRPO with Docker Model Runner:
docker model run hf.co/UCL-CSSB/PlasmidGPT-GRPO
metadata
base_model: McClain/plasmidgpt-addgene-gpt2
library_name: transformers
model_name: PlasmidGPT-GRPO
tags:
- generated_from_trainer
- grpo
- trl
- biology
- plasmid
- dna
- synthetic-biology
license: mit
datasets:
- McClain/plasmids-ncbi-addgene
pipeline_tag: text-generation
PlasmidGPT-GRPO
A generative model for plasmid DNA sequences, fine-tuned with Group Relative Policy Optimization (GRPO) reinforcement learning.
Model Description
This model is a fine-tuned version of PlasmidGPT optimized using GRPO to generate valid, functional plasmid sequences with:
- Origin of replication (ORI) - Required for plasmid maintenance
- Antibiotic resistance marker (AMR) - Required for selection
Performance
At temperature 1.3, this model achieves:
- 90% QC pass rate (valid ORI + AMR)
- 3 unique ORI types (ColE1, Col(pHAD28), Col440I)
- 100% unique sequences (no duplicates)
Quick Start
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("UCL-CSSB/PlasmidGPT-GRPO")
tokenizer = AutoTokenizer.from_pretrained("UCL-CSSB/PlasmidGPT-GRPO")
# Generate a plasmid starting with ATG (start codon)
prompt = "ATG"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(
**inputs,
max_new_tokens=2000,
temperature=1.3,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
sequence = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(sequence)
Training
This model was trained with GRPO (Group Relative Policy Optimization), a method introduced in DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models.
The reward function optimizes for:
- Presence of a valid origin of replication (ORI)
- Presence of a valid antibiotic resistance marker (AMR)
- Absence of long repetitive sequences
Framework Versions
- TRL: 0.23.1
- Transformers: 4.57.0
- PyTorch: 2.8.0
- Datasets: 4.1.1
- Tokenizers: 0.22.1
Recommended Sampling Parameters
| Temperature | Pass Rate | ORI Diversity | Notes |
|---|---|---|---|
| 0.8 | 37% | 1 type | Collapsed - avoid |
| 0.95 | 63% | 2 types | Conservative |
| 1.15 | 76% | 2 types | Balanced |
| 1.3 | 90% | 3 types | Recommended |
Citation
@article{shao2024deepseekmath,
title={{DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models}},
author={Zhihong Shao and Peiyi Wang and Qihao Zhu and Runxin Xu and Junxiao Song and Mingchuan Zhang and Y. K. Li and Y. Wu and Daya Guo},
year=2024,
eprint={arXiv:2402.03300},
}
@misc{vonwerra2022trl,
title={{TRL: Transformer Reinforcement Learning}},
author={Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
year=2020,
journal={GitHub repository},
publisher={GitHub},
howpublished={\url{https://github.com/huggingface/trl}}
}