yashm commited on
Commit
f8f5cc8
·
verified ·
1 Parent(s): 843e54f

Update model card with correct Transformers usage

Browse files
Files changed (1) hide show
  1. README.md +81 -18
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
- **gemma4-12b-bioinfo** is a state-of-the-art, fine-tuned large language model based on Google's Gemma 4 (12B) architecture. It has been specifically optimized to understand, analyze, and generate text related to complex bioinformatics, genomics, and computational biology.
14
 
15
- ## ⚠️ Intended Use & Limitations
16
 
17
- **Research Purposes Only:** This model is designed strictly for academic, research, and educational purposes. It is **not** intended to provide medical advice, clinical diagnosis, or treatment recommendations. The outputs of this model should always be verified by qualified domain experts.
 
 
 
 
18
 
19
  ## Model Details
20
 
21
- * **Base Architecture:** Gemma 4 (12B)
22
- * **Language:** English
23
- * **Format:** `transformers` FP16 / BF16
24
- * **GGUF Version:** Available at [yashm/gemma4-12b-bioinfo-GGUF](https://huggingface.co/yashm/gemma4-12b-bioinfo-GGUF)
 
25
 
26
- ## Quick Start Transformers
 
 
27
 
28
  ```python
29
- from transformers import AutoModelForCausalLM, AutoTokenizer
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
- tokenizer = AutoTokenizer.from_pretrained("yashm/gemma4-12b-bioinfo")
32
- model = AutoModelForCausalLM.from_pretrained("yashm/gemma4-12b-bioinfo", device_map="auto")
 
 
 
33
 
34
- prompt = "<bos><|turn>user\nExplain the significance of CRISPR-Cas9 in functional genomics.<|turn>model\n"
35
- inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
36
- outputs = model.generate(**inputs, max_new_tokens=512)
37
- print(tokenizer.decode(outputs[0], skip_special_tokens=True))
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  ```
39
 
40
- ## Citation
 
 
 
 
 
41
 
42
- If you use this model in your research, please cite it as follows:
 
 
 
 
43
 
44
  ```bibtex
45
  @misc{gemma4-12b-bioinfo_2026,
46
  author = {yashm},
47
- title = {gemma4-12b-bioinfo: A Fine-Tuned Gemma 4 Model for Bioinformatics},
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}}