Text Generation
Transformers
Safetensors
gemma4_unified
image-text-to-text
biology
bioinformatics
genomics
computational-biology
conversational
Instructions to use yashm/gemma4-12b-bioinfo with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yashm/gemma4-12b-bioinfo with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yashm/gemma4-12b-bioinfo") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("yashm/gemma4-12b-bioinfo") model = AutoModelForMultimodalLM.from_pretrained("yashm/gemma4-12b-bioinfo", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use yashm/gemma4-12b-bioinfo with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yashm/gemma4-12b-bioinfo" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yashm/gemma4-12b-bioinfo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yashm/gemma4-12b-bioinfo
- SGLang
How to use yashm/gemma4-12b-bioinfo 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 "yashm/gemma4-12b-bioinfo" \ --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": "yashm/gemma4-12b-bioinfo", "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 "yashm/gemma4-12b-bioinfo" \ --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": "yashm/gemma4-12b-bioinfo", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use yashm/gemma4-12b-bioinfo with Docker Model Runner:
docker model run hf.co/yashm/gemma4-12b-bioinfo
Update model card with correct Transformers usage
Browse files
README.md
CHANGED
|
@@ -1,50 +1,113 @@
|
|
| 1 |
---
|
| 2 |
license: gemma
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
- biology
|
| 5 |
- bioinformatics
|
| 6 |
- genomics
|
|
|
|
| 7 |
- text-generation
|
| 8 |
pipeline_tag: text-generation
|
| 9 |
---
|
| 10 |
|
| 11 |
# gemma4-12b-bioinfo
|
| 12 |
|
| 13 |
-
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
## Model Details
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
|
|
|
| 25 |
|
| 26 |
-
## Quick Start Transformers
|
|
|
|
|
|
|
| 27 |
|
| 28 |
```python
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
```
|
| 39 |
|
| 40 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
```bibtex
|
| 45 |
@misc{gemma4-12b-bioinfo_2026,
|
| 46 |
author = {yashm},
|
| 47 |
-
title = {gemma4-12b-bioinfo:
|
| 48 |
year = {2026},
|
| 49 |
publisher = {Hugging Face},
|
| 50 |
howpublished = {\url{https://huggingface.co/yashm/gemma4-12b-bioinfo}}
|
|
|
|
| 1 |
---
|
| 2 |
license: gemma
|
| 3 |
+
base_model: google/gemma-4-12B-it
|
| 4 |
+
library_name: transformers
|
| 5 |
tags:
|
| 6 |
- biology
|
| 7 |
- bioinformatics
|
| 8 |
- genomics
|
| 9 |
+
- computational-biology
|
| 10 |
- text-generation
|
| 11 |
pipeline_tag: text-generation
|
| 12 |
---
|
| 13 |
|
| 14 |
# gemma4-12b-bioinfo
|
| 15 |
|
| 16 |
+
`gemma4-12b-bioinfo` is a fine-tuned **Gemma 4 12B instruction model** for bioinformatics, genomics, and computational biology question answering.
|
| 17 |
|
| 18 |
+
The LoRA adapter was merged into the base model, so this repository is intended for direct use with Hugging Face `transformers`.
|
| 19 |
|
| 20 |
+
For the optimized local-inference GGUF files, use: [yashm/gemma4-12b-bioinfo-GGUF](https://huggingface.co/yashm/gemma4-12b-bioinfo-GGUF).
|
| 21 |
+
|
| 22 |
+
## Intended Use
|
| 23 |
+
|
| 24 |
+
This model is intended for research, education, and computational biology assistance. It is **not** a medical device and should not be used for clinical diagnosis, treatment decisions, or professional medical advice.
|
| 25 |
|
| 26 |
## Model Details
|
| 27 |
|
| 28 |
+
- **Base model:** `google/gemma-4-12B-it`
|
| 29 |
+
- **Fine-tuning method:** QLoRA / SFT, merged into full model
|
| 30 |
+
- **Domain:** bioinformatics, genomics, transcriptomics, proteomics, sequence analysis, biological databases, and common bioinformatics tools
|
| 31 |
+
- **Primary format:** Hugging Face `transformers`
|
| 32 |
+
- **GGUF format:** available in `yashm/gemma4-12b-bioinfo-GGUF`
|
| 33 |
|
| 34 |
+
## Quick Start: Transformers
|
| 35 |
+
|
| 36 |
+
Gemma 4 uses `AutoModelForImageTextToText` in this notebook, not `AutoModelForCausalLM`.
|
| 37 |
|
| 38 |
```python
|
| 39 |
+
import torch
|
| 40 |
+
from transformers import AutoTokenizer, AutoModelForImageTextToText
|
| 41 |
+
|
| 42 |
+
repo_id = "yashm/gemma4-12b-bioinfo"
|
| 43 |
+
|
| 44 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 45 |
+
repo_id,
|
| 46 |
+
trust_remote_code=True,
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
model = AutoModelForImageTextToText.from_pretrained(
|
| 50 |
+
repo_id,
|
| 51 |
+
device_map="auto",
|
| 52 |
+
dtype=torch.bfloat16,
|
| 53 |
+
attn_implementation="eager",
|
| 54 |
+
trust_remote_code=True,
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
system_prompt = (
|
| 58 |
+
"You are an expert bioinformatics assistant with deep knowledge of "
|
| 59 |
+
"genomics, proteomics, transcriptomics, sequence analysis, biological "
|
| 60 |
+
"databases, and bioinformatics tools. Provide accurate, concise, and "
|
| 61 |
+
"scientifically rigorous answers."
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
messages = [
|
| 65 |
+
{"role": "system", "content": system_prompt},
|
| 66 |
+
{"role": "user", "content": "Explain the difference between local and global sequence alignment."},
|
| 67 |
+
]
|
| 68 |
|
| 69 |
+
prompt = tokenizer.apply_chat_template(
|
| 70 |
+
messages,
|
| 71 |
+
tokenize=False,
|
| 72 |
+
add_generation_prompt=True,
|
| 73 |
+
)
|
| 74 |
|
| 75 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 76 |
+
|
| 77 |
+
with torch.inference_mode():
|
| 78 |
+
output_ids = model.generate(
|
| 79 |
+
**inputs,
|
| 80 |
+
max_new_tokens=512,
|
| 81 |
+
do_sample=True,
|
| 82 |
+
temperature=0.2,
|
| 83 |
+
top_p=0.9,
|
| 84 |
+
repetition_penalty=1.1,
|
| 85 |
+
pad_token_id=tokenizer.pad_token_id,
|
| 86 |
+
eos_token_id=tokenizer.eos_token_id,
|
| 87 |
+
)
|
| 88 |
+
|
| 89 |
+
new_tokens = output_ids[0, inputs["input_ids"].shape[-1]:]
|
| 90 |
+
answer = tokenizer.decode(new_tokens, skip_special_tokens=True).strip()
|
| 91 |
+
print(answer)
|
| 92 |
```
|
| 93 |
|
| 94 |
+
## Recommended Generation Settings
|
| 95 |
+
|
| 96 |
+
- `temperature=0.2` for factual bioinformatics answers
|
| 97 |
+
- `top_p=0.9`
|
| 98 |
+
- `repetition_penalty=1.1`
|
| 99 |
+
- `max_new_tokens=512`
|
| 100 |
|
| 101 |
+
## Limitations
|
| 102 |
+
|
| 103 |
+
The model may produce incorrect or incomplete biological interpretations. Always verify outputs against trusted scientific literature, databases, and domain experts.
|
| 104 |
+
|
| 105 |
+
## Citation
|
| 106 |
|
| 107 |
```bibtex
|
| 108 |
@misc{gemma4-12b-bioinfo_2026,
|
| 109 |
author = {yashm},
|
| 110 |
+
title = {gemma4-12b-bioinfo: Fine-Tuned Gemma 4 12B for Bioinformatics},
|
| 111 |
year = {2026},
|
| 112 |
publisher = {Hugging Face},
|
| 113 |
howpublished = {\url{https://huggingface.co/yashm/gemma4-12b-bioinfo}}
|