Text Generation
Transformers
PyTorch
English
llama
gene-set-analysis
biomedical
reasoning
conversational
text-generation-inference
Run this model with HF Jobs
Run ncbi/Gene-R1-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/ncbi/Gene-R1-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/ncbi/Gene-R1-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/ncbi/Gene-R1-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/ncbi/Gene-R1-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 ncbi/Gene-R1-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ncbi/Gene-R1-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ncbi/Gene-R1-8B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ncbi/Gene-R1-8B") model = AutoModelForCausalLM.from_pretrained("ncbi/Gene-R1-8B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ncbi/Gene-R1-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ncbi/Gene-R1-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ncbi/Gene-R1-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ncbi/Gene-R1-8B
- SGLang
How to use ncbi/Gene-R1-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 "ncbi/Gene-R1-8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ncbi/Gene-R1-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "ncbi/Gene-R1-8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ncbi/Gene-R1-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ncbi/Gene-R1-8B with Docker Model Runner:
docker model run hf.co/ncbi/Gene-R1-8B
Update README.md
Browse files123456789101112131415161717 unmodified lines3536373839404142434445464748495059 unmodified lines110111112113114115---license: otherlicense_name: public-domainlicense_link: LICENSElanguage:- enbase_model:- meta-llama/Llama-3.1-8B-Instruct- meta-llama/Llama-3.2-1B-Instruct- meta-llama/Llama-3.2-3B-Instructtags:- GSApipeline_tag: text-generationlibrary_name: transformers---# Overview of Gene-R117 unmodified lines```pythonimport transformersfrom transformers import AutoTokenizer, AutoModelForCausalLMtokenizer_test = AutoTokenizer.from_pretrained(model_path = "xxxxxxxxx", # The local path where the model is locatedtoken = "xxxxxxxxx" # Your access key of hugging face)model_test = AutoModelForCausalLM.from_pretrained(model_path = "xxxxxxxxx", # The local path where the model is locateddevice_map = "auto",token = "xxxxxxxxx" # Your access key of hugging face)def complete_chat(system, prompt, model, tokenizer):model.generation_config.do_sample=False59 unmodified linesMore details of model usage can be referred at our GitHub: [GitHub](https://github.com/ncbi-nlp/Gene-R1)# AcknowledgmentsThis research was supported in part by the Intramural Research Program of the National Institutes of Health (NIH).12345678910111213141516171817 unmodified lines36373839404142434445464748495051525354555657585960616263646566676859 unmodified lines128129130131132133134135136137138139140141142143144145146---license: otherlibrary_name: transformerspipeline_tag: text-generationlanguage:- entags:- gene-set-analysis- biomedical- reasoning- llamabase_model:- meta-llama/Llama-3.2-1B-Instruct- meta-llama/Llama-3.2-3B-Instruct- meta-llama/Llama-3.1-8B-Instruct---# Overview of Gene-R117 unmodified lines```pythonimport transformersfrom transformers import AutoTokenizer, AutoModelForCausalLMmodel_id = "ncbi/Gene-R1"tokenizer_test = AutoTokenizer.from_pretrained(model_id,token = "xxxxxxxxx" # Your access key of hugging face)model_test = AutoModelForCausalLM.from_pretrained(model_id,device_map = "auto",token = "xxxxxxxxx" # Your access key of hugging face)# If you want to download a specific model of Gene-R1, using below code:<!-- model_id = "ncbi/Gene-R1"subfolder = "3B"tokenizer_test = AutoTokenizer.from_pretrained(model_id,subfolder=subfolder,token = "xxxxxxxxx" # Your access key of hugging face)model_test = AutoModelForCausalLM.from_pretrained(model_id,subfolder=subfolder,device_map = "auto",token = "xxxxxxxxx" # Your access key of hugging face)-->def complete_chat(system, prompt, model, tokenizer):model.generation_config.do_sample=False59 unmodified linesMore details of model usage can be referred at our GitHub: [GitHub](https://github.com/ncbi-nlp/Gene-R1)# Download statisticsHugging Face tracks downloads automatically based on requests to model query files such as `config.json`.To ensure downloads are counted, please load the full models directly from the Hub using `transformers`:```pythonfrom transformers import AutoTokenizer, AutoModelForCausalLMmodel_id = "ncbi/Gene-R1"tokenizer = AutoTokenizer.from_pretrained(model_id, hf_token)model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto", hf_token)```# AcknowledgmentsThis research was supported in part by the Intramural Research Program of the National Institutes of Health (NIH).
README.md+41-10