Text Generation
Transformers
Safetensors
Upper Grand Valley Dani
llama
genomic
text-generation-inference
Instructions to use HuggingFaceBio/Carbon-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HuggingFaceBio/Carbon-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="HuggingFaceBio/Carbon-3B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("HuggingFaceBio/Carbon-3B") model = AutoModelForCausalLM.from_pretrained("HuggingFaceBio/Carbon-3B") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use HuggingFaceBio/Carbon-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HuggingFaceBio/Carbon-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "HuggingFaceBio/Carbon-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/HuggingFaceBio/Carbon-3B
- SGLang
How to use HuggingFaceBio/Carbon-3B 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 "HuggingFaceBio/Carbon-3B" \ --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": "HuggingFaceBio/Carbon-3B", "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 "HuggingFaceBio/Carbon-3B" \ --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": "HuggingFaceBio/Carbon-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use HuggingFaceBio/Carbon-3B with Docker Model Runner:
docker model run hf.co/HuggingFaceBio/Carbon-3B
Update README.md
#2
by danaaubakirova HF Staff - opened
README.md
CHANGED
|
@@ -267,14 +267,14 @@ The data mixture during the stable phases of pre-training (Phase 1 and the stabl
|
|
| 267 |
|
| 268 |
The training uses a **staged objective and learning-rate schedule**:
|
| 269 |
|
| 270 |
-
- **Phase 1 — Cross-Entropy (0 →
|
| 271 |
-
- **Phase 2 — Factorised Nucleotide Supervision (
|
| 272 |
|
| 273 |
See the Carbon technical report for the full pre-training recipe.
|
| 274 |
|
| 275 |
### Long-context training
|
| 276 |
|
| 277 |
-
After pre-training, the model
|
| 278 |
|
| 279 |
| Component | Fraction |
|
| 280 |
|---|---|
|
|
@@ -285,7 +285,7 @@ After pre-training, the model is continued-trained for **50 B additional tokens
|
|
| 285 |
| GTDB bacterial genomes | 15.0 % |
|
| 286 |
| Promoter sequences | 1.2 % |
|
| 287 |
|
| 288 |
-
The optimizer is AdamW (
|
| 289 |
|
| 290 |
### Software & hardware
|
| 291 |
|
|
|
|
| 267 |
|
| 268 |
The training uses a **staged objective and learning-rate schedule**:
|
| 269 |
|
| 270 |
+
- **Phase 1 — Cross-Entropy (0 → 100B tokens)**. WSD learning-rate schedule with peak LR = 3e-4 and a 2,000-step linear warmup, then stable at peak through the end of Phase 1.
|
| 271 |
+
- **Phase 2 — Factorised Nucleotide Supervision (100B → 1T tokens)**. Switch to the hybrid FNS loss, lower the peak LR to 2e-5, and continue with a WSD schedule whose decay phase covers the last 20% of Phase-2 steps. During the decay phase, we rebalance the data mixture to upsample mRNA and prokaryotic data — we found that mRNA in particular meaningfully helps downstream tasks — using the following ratios: 50% Generator-style eukaryotic genes · 25% mature mRNA · 10% splice-enriched mRNA · 15% GTDB bacterial genomes.
|
| 272 |
|
| 273 |
See the Carbon technical report for the full pre-training recipe.
|
| 274 |
|
| 275 |
### Long-context training
|
| 276 |
|
| 277 |
+
After pre-training, the model undergoes continued training for 50B additional tokens at sequence length 32,768, with the rotary base shifted from 5 × 10^5 to 5 × 10^6. The long-context training mixture is:
|
| 278 |
|
| 279 |
| Component | Fraction |
|
| 280 |
|---|---|
|
|
|
|
| 285 |
| GTDB bacterial genomes | 15.0 % |
|
| 286 |
| Promoter sequences | 1.2 % |
|
| 287 |
|
| 288 |
+
The optimizer is AdamW (β₁ = 0.9, β₂ = 0.95, ε = 1e-8, weight decay = 0.1, gradient clipping = 1.0), with a WSD learning-rate schedule: 2,000 steps linear warmup from 0 to 3e-5, stable phase, then 4,000-step linear decay to 3e-6. Global batch size: 64 sequences × 32,768 tokens.
|
| 289 |
|
| 290 |
### Software & hardware
|
| 291 |
|