Text Generation
Transformers
Safetensors
gpt2
biology
plasmid
dna
synthetic-biology
text-generation-inference
Instructions to use UCL-CSSB/PlasmidGPT-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use UCL-CSSB/PlasmidGPT-SFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="UCL-CSSB/PlasmidGPT-SFT")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("UCL-CSSB/PlasmidGPT-SFT") model = AutoModelForCausalLM.from_pretrained("UCL-CSSB/PlasmidGPT-SFT", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use UCL-CSSB/PlasmidGPT-SFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "UCL-CSSB/PlasmidGPT-SFT" # 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-SFT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/UCL-CSSB/PlasmidGPT-SFT
- SGLang
How to use UCL-CSSB/PlasmidGPT-SFT 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-SFT" \ --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-SFT", "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-SFT" \ --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-SFT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use UCL-CSSB/PlasmidGPT-SFT with Docker Model Runner:
docker model run hf.co/UCL-CSSB/PlasmidGPT-SFT
Camera-ready README: simplified to what-it-is / quick start / citation
Browse files
README.md
CHANGED
|
@@ -1,56 +1,41 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
| 6 |
|
| 7 |
-
##
|
| 8 |
-
|
| 9 |
-
- **Architecture**: GPT-2
|
| 10 |
-
- **Vocab Size**: 30,002
|
| 11 |
-
- **Hidden Size**: 768
|
| 12 |
-
- **Number of Layers**: 12
|
| 13 |
-
- **Number of Heads**: 12
|
| 14 |
-
- **Max Position Embeddings**: 2048
|
| 15 |
-
- **Parameters**: ~124M
|
| 16 |
-
|
| 17 |
-
## Usage
|
| 18 |
|
| 19 |
```python
|
| 20 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 21 |
|
| 22 |
-
model = AutoModelForCausalLM.from_pretrained("
|
| 23 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
| 24 |
-
|
| 25 |
-
# Basic generation
|
| 26 |
-
inputs = tokenizer("ATGC", return_tensors="pt")
|
| 27 |
-
outputs = model.generate(**inputs, max_length=100)
|
| 28 |
-
generated_sequence = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 29 |
-
print(generated_sequence)
|
| 30 |
|
| 31 |
-
|
| 32 |
-
outputs = model.generate(
|
| 33 |
-
|
| 34 |
-
print(generated_sequence)
|
| 35 |
```
|
| 36 |
|
| 37 |
-
##
|
| 38 |
-
|
| 39 |
-
**Input:** `ATGCGATCG`
|
| 40 |
-
**Generated:** `ATGCGATCGGTGGTAGGCACTGGATGATGGCCCTGCAGTGTAGCCGTAGTTATGAGCCTCGGGATTCTTTGATGATTCAGCCACCCTCATCATCCTCCTCCTCC...`
|
| 41 |
-
|
| 42 |
-
**Input:** `ATGGCC`
|
| 43 |
-
**Generated:** `ATGGCCTACATACCTTCAATTACCGAAACAAGGTGGTTCATCTCTAACGCTGTCCATAAAACCGCCCAGTCTAGCTATCGCCATTTGCGCATCTAACGTGGTAGGCACTCCGGGTCCGCGCC...`
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
- `tokenizer.json`: Fast tokenizer data
|
| 55 |
-
- `tokenizer_config.json`: Tokenizer configuration
|
| 56 |
-
- `special_tokens_map.json`: Special token mappings
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
base_model: UCL-CSSB/PlasmidGPT
|
| 6 |
+
tags:
|
| 7 |
+
- biology
|
| 8 |
+
- plasmid
|
| 9 |
+
- dna
|
| 10 |
+
- synthetic-biology
|
| 11 |
+
- gpt2
|
| 12 |
+
---
|
| 13 |
|
| 14 |
+
# PlasmidGPT-SFT
|
| 15 |
|
| 16 |
+
Supervised fine-tune of [PlasmidGPT](https://huggingface.co/UCL-CSSB/PlasmidGPT) on a curated corpus of ~15k engineered *E. coli* plasmids from PlasmidScope and Addgene (Cunningham et al., 2025). Used as a baseline for the GRPO-trained [PlasmidGPT-GRPO](https://huggingface.co/UCL-CSSB/PlasmidGPT-GRPO).
|
| 17 |
|
| 18 |
+
## Quick start
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
```python
|
| 21 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 22 |
|
| 23 |
+
model = AutoModelForCausalLM.from_pretrained("UCL-CSSB/PlasmidGPT-SFT")
|
| 24 |
+
tokenizer = AutoTokenizer.from_pretrained("UCL-CSSB/PlasmidGPT-SFT")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
input_ids = tokenizer("ATG", return_tensors="pt").input_ids
|
| 27 |
+
outputs = model.generate(input_ids, max_new_tokens=512, do_sample=True, temperature=1.0)
|
| 28 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
|
|
|
| 29 |
```
|
| 30 |
|
| 31 |
+
## Citation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
+
```bibtex
|
| 34 |
+
@article{cunningham2025plasmidsft,
|
| 35 |
+
title = {Generative design and construction of functional plasmids with a {DNA} language model},
|
| 36 |
+
author = {Cunningham, Angus G. and Dekker, Linda and Shcherbakova, Anastasiia and Barnes, Chris P.},
|
| 37 |
+
journal = {bioRxiv},
|
| 38 |
+
year = {2025},
|
| 39 |
+
doi = {10.64898/2025.12.06.692736}
|
| 40 |
+
}
|
| 41 |
+
```
|
|
|
|
|
|
|
|
|