PEFT
Safetensors
code
gemma
qlora
circuit-synthesis
verilog
llm
electronic-design-automation
google-colab
Instructions to use louijiec/veriforge-gemma-2b-it with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use louijiec/veriforge-gemma-2b-it with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("google/gemma-2b-it") model = PeftModel.from_pretrained(base_model, "louijiec/veriforge-gemma-2b-it") - Notebooks
- Google Colab
- Kaggle
Update model card with training details
Browse files
README.md
CHANGED
|
@@ -1,57 +1,80 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
base_model: google/gemma-2b-it
|
| 5 |
tags:
|
| 6 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
model-index:
|
| 8 |
-
- name: veriforge-gemma-2b-it
|
| 9 |
-
|
| 10 |
---
|
| 11 |
|
| 12 |
-
|
| 13 |
-
should probably proofread and complete it, then remove this comment. -->
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
-
|
|
|
|
|
|
|
| 26 |
|
| 27 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
|
| 31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
##
|
| 34 |
|
| 35 |
-
|
| 36 |
-
-
|
| 37 |
-
-
|
| 38 |
-
-
|
| 39 |
-
-
|
| 40 |
-
-
|
| 41 |
-
-
|
| 42 |
-
-
|
| 43 |
-
- lr_scheduler_type: linear
|
| 44 |
-
- num_epochs: 10
|
| 45 |
-
- mixed_precision_training: Native AMP
|
| 46 |
|
| 47 |
-
##
|
| 48 |
|
|
|
|
|
|
|
|
|
|
| 49 |
|
|
|
|
| 50 |
|
| 51 |
-
|
|
|
|
|
|
|
| 52 |
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
-
|
| 56 |
-
-
|
| 57 |
-
-
|
|
|
|
| 1 |
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language: code
|
|
|
|
| 4 |
tags:
|
| 5 |
+
- gemma
|
| 6 |
+
- qlora
|
| 7 |
+
- circuit-synthesis
|
| 8 |
+
- verilog
|
| 9 |
+
- llm
|
| 10 |
+
- electronic-design-automation
|
| 11 |
+
- peft
|
| 12 |
+
- google-colab
|
| 13 |
model-index:
|
| 14 |
+
- name: veriforge-gemma-2b-it
|
| 15 |
+
results: []
|
| 16 |
---
|
| 17 |
|
| 18 |
+
# Veriforge-Gemma-2B-IT 🔧
|
|
|
|
| 19 |
|
| 20 |
+
**`veriforge-gemma-2b-it`** is a QLoRA-fine-tuned version of [`google/gemma-2b-it`](https://huggingface.co/google/gemma-2b-it) that specializes in prompt-based circuit synthesis for digital logic design, specifically in Verilog HDL.
|
| 21 |
|
| 22 |
+
## 🚀 Model Description
|
| 23 |
|
| 24 |
+
- **Base Model**: [`google/gemma-2b-it`](https://huggingface.co/google/gemma-2b-it)
|
| 25 |
+
- **Fine-tuned By**: [louijiec](https://huggingface.co/louijiec)
|
| 26 |
+
- **Method**: QLoRA using PEFT and bitsandbytes
|
| 27 |
+
- **Data**: 500 simulated Verilog gate examples (AND, OR, NAND, etc.)
|
| 28 |
+
- **Platform**: Google Colab
|
| 29 |
|
| 30 |
+
## 🧐 Example Usage
|
| 31 |
|
| 32 |
+
```python
|
| 33 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 34 |
|
| 35 |
+
model_id = "louijiec/veriforge-gemma-2b-it"
|
| 36 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 37 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 38 |
|
| 39 |
+
prompt = "### Prompt:\nWrite Verilog code for a 3-input XOR gate.\n\n### Response:\n"
|
| 40 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 41 |
+
outputs = model.generate(**inputs, max_new_tokens=100)
|
| 42 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 43 |
+
```
|
| 44 |
|
| 45 |
+
## 🧪 Sample Output
|
| 46 |
|
| 47 |
+
```verilog
|
| 48 |
+
module nand_3_input (output y, input a0, a1, a2);
|
| 49 |
+
assign y = ~(a0 & a1 & a2);
|
| 50 |
+
endmodule
|
| 51 |
+
```
|
| 52 |
|
| 53 |
+
## 📚 Training Details
|
| 54 |
|
| 55 |
+
- LoRA rank: 8
|
| 56 |
+
- Bits: 4-bit (QLoRA)
|
| 57 |
+
- Max tokens: 512
|
| 58 |
+
- Optimizer: AdamW, FP16
|
| 59 |
+
- Epochs: 10
|
| 60 |
+
- Batch Size: 2
|
| 61 |
+
- Gradient Accumulation: 4
|
| 62 |
+
- Logging Steps: 10
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
+
## 📌 Citations
|
| 65 |
|
| 66 |
+
- Gemma by Google: https://huggingface.co/google/gemma-2b-it
|
| 67 |
+
- QLoRA: https://arxiv.org/abs/2305.14314
|
| 68 |
+
- PEFT: https://github.com/huggingface/peft
|
| 69 |
|
| 70 |
+
## ⚠️ Limitations
|
| 71 |
|
| 72 |
+
- Trained only on simple gates
|
| 73 |
+
- No memory/state logic (flip-flops, FSMs, etc.)
|
| 74 |
+
- No formal verification or testbench evaluation
|
| 75 |
|
| 76 |
+
## 💪 Future Work
|
| 77 |
+
|
| 78 |
+
- Add support for more circuit components (MUX, ALU)
|
| 79 |
+
- Formal testbench generation
|
| 80 |
+
- Build EDA pipeline integrations
|