Text Generation
Transformers
Safetensors
English
plasmid_lm
biology
genomics
plasmid
dna
causal-lm
synthetic-biology
custom_code
Instructions to use McClain/PlasmidLM-kmer6 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use McClain/PlasmidLM-kmer6 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="McClain/PlasmidLM-kmer6", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("McClain/PlasmidLM-kmer6", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use McClain/PlasmidLM-kmer6 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "McClain/PlasmidLM-kmer6" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "McClain/PlasmidLM-kmer6", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/McClain/PlasmidLM-kmer6
- SGLang
How to use McClain/PlasmidLM-kmer6 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 "McClain/PlasmidLM-kmer6" \ --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": "McClain/PlasmidLM-kmer6", "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 "McClain/PlasmidLM-kmer6" \ --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": "McClain/PlasmidLM-kmer6", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use McClain/PlasmidLM-kmer6 with Docker Model Runner:
docker model run hf.co/McClain/PlasmidLM-kmer6
File size: 1,896 Bytes
f34ec9d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | """HuggingFace configuration for PlasmidLM."""
from transformers import PretrainedConfig
class PlasmidLMConfig(PretrainedConfig):
model_type = "plasmid_lm"
def __init__(
self,
vocab_size: int = 112,
hidden_size: int = 384,
num_hidden_layers: int = 10,
num_attention_heads: int = 8,
intermediate_size: int = 1536,
hidden_act: str = "gelu",
rms_norm_eps: float = 1e-5,
max_position_embeddings: int = 16384,
rope_theta: float = 10000.0,
tie_word_embeddings: bool = True,
# MoE
use_moe: bool = False,
num_experts: int = 6,
num_experts_per_tok: int = 2,
moe_intermediate_size: int | None = None,
aux_loss_coef: float = 0.01,
# Tokenizer metadata (informational, saved in checkpoint)
tokenizer_type: str = "char",
kmer_k: int | None = None,
kmer_stride: int | None = None,
**kwargs,
):
self.hidden_size = hidden_size
self.num_hidden_layers = num_hidden_layers
self.num_attention_heads = num_attention_heads
self.intermediate_size = intermediate_size
self.hidden_act = hidden_act
self.rms_norm_eps = rms_norm_eps
self.max_position_embeddings = max_position_embeddings
self.rope_theta = rope_theta
# MoE
self.use_moe = use_moe
self.num_experts = num_experts
self.num_experts_per_tok = num_experts_per_tok
self.moe_intermediate_size = moe_intermediate_size or intermediate_size
self.aux_loss_coef = aux_loss_coef
# Tokenizer metadata
self.tokenizer_type = tokenizer_type
self.kmer_k = kmer_k
self.kmer_stride = kmer_stride
super().__init__(
vocab_size=vocab_size,
tie_word_embeddings=tie_word_embeddings,
**kwargs,
)
|