Run this model with HF Jobs
Run HuggingFaceBio/Carbon-3B on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/HuggingFaceBio/Carbon-3B. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/HuggingFaceBio/Carbon-3B on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/HuggingFaceBio/Carbon-3B. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/HuggingFaceBio/Carbon-3B. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
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")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("HuggingFaceBio/Carbon-3B") model = AutoModelForCausalLM.from_pretrained("HuggingFaceBio/Carbon-3B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- 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 model card namespace references (#3)
Browse files- Update model card namespace references (4a06cee42649739cf7b177f9aa48976f448e6533)
27 unmodified lines2829303132333420 unmodified lines55565758596061102 unmodified lines16416516616716816917017117217317417517617751 unmodified lines22923023123223323423527 unmodified lines26326426526626726826927 unmodified lines**Carbon-3B** is a 3B-parameter decoder-only autoregressive genomic foundation model trained on DNA and RNA sequences, with a primary focus on eukaryotes. It has a native context length of **32,768 6-mer tokens (β 197k DNA base pairs)** and extends to **64,000 tokens (β 384 kbp)** at inference time via YaRN. Carbon-3B is designed to be both strong and efficient: on generative tasks (sequence recovery), variant-effect prediction, and motif-perturbation discrimination, it matches the capability of substantially larger single-nucleotide baselines such as Evo2-7B while running several times faster.Carbon-3B is the **flagship** model of the Carbon family. We also release [**Carbon-8B**](https://huggingface.co/hf-carbon/) for users who need additional capability at higher inference cost, and [**Carbon-500M**](https://huggingface.co/hf-carbon/) β a small generative model intended for speculative decoding alongside Carbon-3B (or Carbon-8B).### Key features20 unmodified linesfrom transformers import AutoModelForCausalLM, AutoTokenizerimport torchrepo = "hf-carbon/Carbon-3B"# Tokenizer needs trust_remote_code for the DNA-specific logictok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)102 unmodified lines### Speculative decoding with Carbon-500MCarbon-3B and Carbon-500M share the same tokenizer and DNA template format, so [Carbon-500M](https://huggingface.co/hf-carbon/) can be used as a draft model for speculative decoding with Carbon-3B (or Carbon-8B) as the target model, reducing wall-clock generation cost at no quality loss.```pythonfrom transformers import AutoModelForCausalLM, AutoTokenizerimport torchdraft = AutoModelForCausalLM.from_pretrained("hf-carbon/carbon-500M",torch_dtype=torch.bfloat16,).cuda().eval()target = model # Carbon-3B, loaded above51 unmodified lines>### Long-context retrieval (Genome-NIAH)[Genome-NIAH](https://huggingface.co/datasets/hf-carbon/genome-niah) is a long context benchmark, inspired from NIAH and RULER benchmarks for English. The model needs to retrieves a random 24 bp VALUE planted in a real-genome haystack at one of five depths, evaluated at six context lengths from 24 kbp to 786 kbp. The benchmark contains 500 examples per (task, context) cell.Below are the scores on `niah`:| Context length | Carbon 3B 32k (native / YaRN 4Γ) | GENERator-v2 3B | Evo2-7B |27 unmodified linesCarbon-3B is pre-trained for **1T 6-mer tokens (β 6T DNA base pairs)** at sequence length 8 192, with a global batch size of 256 sequences (β 2 M tokens / step). The optimizer is AdamW throughout.The data mixture during the stable phases of pre-training (Phase 1 and the stable portion of Phase 2) is the one documented on the [`hf-carbon/carbon-pretraining-corpus` dataset card](https://huggingface.co/datasets/hf-carbon/carbon-pretraining-corpus): β 70 % Generator-style eukaryotic genomic DNA, with mRNA, splice-enriched mRNA, and GTDB bacterial genomes alongside metadata-conditioned templates.The training uses a **staged objective and learning-rate schedule**:27 unmodified lines2829303132333420 unmodified lines55565758596061102 unmodified lines16416516616716816917017117217317417517617751 unmodified lines22923023123223323423527 unmodified lines26326426526626726826927 unmodified lines**Carbon-3B** is a 3B-parameter decoder-only autoregressive genomic foundation model trained on DNA and RNA sequences, with a primary focus on eukaryotes. It has a native context length of **32,768 6-mer tokens (β 197k DNA base pairs)** and extends to **64,000 tokens (β 384 kbp)** at inference time via YaRN. Carbon-3B is designed to be both strong and efficient: on generative tasks (sequence recovery), variant-effect prediction, and motif-perturbation discrimination, it matches the capability of substantially larger single-nucleotide baselines such as Evo2-7B while running several times faster.Carbon-3B is the **flagship** model of the Carbon family. We also release [**Carbon-8B**](https://huggingface.co/HuggingFaceBio/) for users who need additional capability at higher inference cost, and [**Carbon-500M**](https://huggingface.co/HuggingFaceBio/) β a small generative model intended for speculative decoding alongside Carbon-3B (or Carbon-8B).### Key features20 unmodified linesfrom transformers import AutoModelForCausalLM, AutoTokenizerimport torchrepo = "HuggingFaceBio/Carbon-3B"# Tokenizer needs trust_remote_code for the DNA-specific logictok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)102 unmodified lines### Speculative decoding with Carbon-500MCarbon-3B and Carbon-500M share the same tokenizer and DNA template format, so [Carbon-500M](https://huggingface.co/HuggingFaceBio/) can be used as a draft model for speculative decoding with Carbon-3B (or Carbon-8B) as the target model, reducing wall-clock generation cost at no quality loss.```pythonfrom transformers import AutoModelForCausalLM, AutoTokenizerimport torchdraft = AutoModelForCausalLM.from_pretrained("HuggingFaceBio/carbon-500M",torch_dtype=torch.bfloat16,).cuda().eval()target = model # Carbon-3B, loaded above51 unmodified lines>### Long-context retrieval (Genome-NIAH)[Genome-NIAH](https://huggingface.co/datasets/HuggingFaceBio/genome-niah) is a long context benchmark, inspired from NIAH and RULER benchmarks for English. The model needs to retrieves a random 24 bp VALUE planted in a real-genome haystack at one of five depths, evaluated at six context lengths from 24 kbp to 786 kbp. The benchmark contains 500 examples per (task, context) cell.Below are the scores on `niah`:| Context length | Carbon 3B 32k (native / YaRN 4Γ) | GENERator-v2 3B | Evo2-7B |27 unmodified linesCarbon-3B is pre-trained for **1T 6-mer tokens (β 6T DNA base pairs)** at sequence length 8 192, with a global batch size of 256 sequences (β 2 M tokens / step). The optimizer is AdamW throughout.The data mixture during the stable phases of pre-training (Phase 1 and the stable portion of Phase 2) is the one documented on the [`HuggingFaceBio/carbon-pretraining-corpus` dataset card](https://huggingface.co/datasets/HuggingFaceBio/carbon-pretraining-corpus): β 70 % Generator-style eukaryotic genomic DNA, with mRNA, splice-enriched mRNA, and GTDB bacterial genomes alongside metadata-conditioned templates.The training uses a **staged objective and learning-rate schedule**:
README.md+6-6