Text Generation
Transformers
Safetensors
Upper Grand Valley Dani
llama
genomic
text-generation-inference
Run this model with HF Jobs
Run HuggingFaceBio/Carbon-8B 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-8B. 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-8B 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-8B. 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-8B. 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-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HuggingFaceBio/Carbon-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="HuggingFaceBio/Carbon-8B")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("HuggingFaceBio/Carbon-8B") model = AutoModelForCausalLM.from_pretrained("HuggingFaceBio/Carbon-8B", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use HuggingFaceBio/Carbon-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "HuggingFaceBio/Carbon-8B" # 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-8B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/HuggingFaceBio/Carbon-8B
- SGLang
How to use HuggingFaceBio/Carbon-8B 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-8B" \ --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-8B", "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-8B" \ --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-8B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use HuggingFaceBio/Carbon-8B with Docker Model Runner:
docker model run hf.co/HuggingFaceBio/Carbon-8B
load chat_template in from_pretrained (vLLM apply_chat_template fix)
Browse files579 unmodified lines580581582583584585586587588589590591592593594595596597598599600601602603604605606607608579 unmodified linesreturn (save_directory,)@classmethoddef from_pretrained(cls, pretrained_model_name_or_path, *args, **kwargs):# Custom loader: PreTrainedTokenizer.from_pretrained is incompatible with this# tokenizer's __init__ (it re-passes bos_token etc.), so construct directly from# bio_config/dna_config. That bypasses standard metadata loading, so also read# chat_template from tokenizer_config.json (vLLM / apply_chat_template need it).import os as _os, json as _jsoncfg = {}for _name in ("bio_config.json", "dna_config.json"):_p = _os.path.join(pretrained_model_name_or_path, _name)if _os.path.exists(_p):with open(_p, "r", encoding="utf-8") as _f:cfg = _json.load(_f)break_init = {"base_tokenizer_path": pretrained_model_name_or_path}for _key in ("k", "tail", "auto_dna_tags"):if _key in cfg:_init[_key] = cfg[_key]tok = cls(**_init, **kwargs)if getattr(tok, "chat_template", None) is None:_tc = _os.path.join(pretrained_model_name_or_path, "tokenizer_config.json")if _os.path.exists(_tc):with open(_tc, "r", encoding="utf-8") as _f:_c = _json.load(_f)if _c.get("chat_template"):tok.chat_template = _c["chat_template"]return tok579 unmodified lines580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640579 unmodified linesreturn (save_directory,)@classmethoddef from_pretrained(cls,pretrained_model_name_or_path,*args,cache_dir=None,local_files_only=False,token=None,revision="main",trust_remote_code=False,**kwargs,):# Custom loader: PreTrainedTokenizer.from_pretrained is incompatible with this# tokenizer's __init__ (it re-passes bos_token etc.), so construct directly from# bio_config/dna_config. That bypasses standard metadata loading, so also read# chat_template from tokenizer_config.json (vLLM / apply_chat_template need it).from transformers.utils.hub import cached_fileproxies = kwargs.pop("proxies", None)subfolder = kwargs.pop("subfolder", None)commit_hash = kwargs.pop("_commit_hash", None)hub_kwargs = {"cache_dir": cache_dir,"local_files_only": local_files_only,"proxies": proxies,"revision": revision,"subfolder": subfolder,"token": token,"_commit_hash": commit_hash,"_raise_exceptions_for_missing_entries": False,}cfg = {}for _name in ("bio_config.json", "dna_config.json"):_p = cached_file(pretrained_model_name_or_path, _name, **hub_kwargs)if _p is not None:with open(_p, encoding="utf-8") as _f:cfg = json.load(_f)break_init = {"base_tokenizer_path": pretrained_model_name_or_path}for _key in ("k", "tail", "auto_dna_tags"):if _key in cfg:_init[_key] = cfg[_key]tokenizer_config_path = cached_file(pretrained_model_name_or_path, "tokenizer_config.json", **hub_kwargs)if tokenizer_config_path is not None:with open(tokenizer_config_path, encoding="utf-8") as _f:tokenizer_config = json.load(_f)if tokenizer_config.get("chat_template"):_init["chat_template"] = tokenizer_config["chat_template"]chat_template_path = cached_file(pretrained_model_name_or_path, "chat_template.jinja", **hub_kwargs)if chat_template_path is not None:with open(chat_template_path, encoding="utf-8") as _f:_init["chat_template"] = _f.read()_init.update(kwargs)return cls(**_init)
tokenizer.py+47-15