Add model card with usage instructions
Browse files
README.md
CHANGED
@@ -1,25 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
-
#
|
3 |
|
4 |
-
This
|
5 |
|
6 |
-
##
|
7 |
|
8 |
- **Base Model**: Qwen/Qwen3-32B
|
9 |
-
- **
|
10 |
-
- **
|
11 |
-
- **
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
```
|
23 |
|
24 |
-
##
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: peft
|
3 |
+
base_model: Qwen/Qwen3-32B
|
4 |
+
tags:
|
5 |
+
- verilog
|
6 |
+
- code-generation
|
7 |
+
- lora
|
8 |
+
- qwen3
|
9 |
+
- verl
|
10 |
+
- grpo
|
11 |
+
license: apache-2.0
|
12 |
+
---
|
13 |
|
14 |
+
# qwen3-32b-verilog-lora
|
15 |
|
16 |
+
This is a LoRA (Low-Rank Adaptation) adapter for **Qwen/Qwen3-32B** fine-tuned for **Verilog code generation**.
|
17 |
|
18 |
+
## Training Details
|
19 |
|
20 |
- **Base Model**: Qwen/Qwen3-32B
|
21 |
+
- **Training Algorithm**: GRPO (Group Relative Policy Optimization)
|
22 |
+
- **LoRA Rank**: 32
|
23 |
+
- **LoRA Alpha**: 32
|
24 |
+
- **Target Modules**: o_proj, k_proj, up_proj, v_proj, gate_proj, q_proj, down_proj
|
25 |
+
- **Task**: Verilog hardware description language code generation
|
26 |
+
|
27 |
+
## Usage
|
28 |
+
|
29 |
+
```python
|
30 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
31 |
+
from peft import PeftModel
|
32 |
+
|
33 |
+
# Load base model and tokenizer
|
34 |
+
base_model_name = "Qwen/Qwen3-32B"
|
35 |
+
tokenizer = AutoTokenizer.from_pretrained(base_model_name)
|
36 |
+
base_model = AutoModelForCausalLM.from_pretrained(
|
37 |
+
base_model_name,
|
38 |
+
torch_dtype="auto",
|
39 |
+
device_map="auto"
|
40 |
+
)
|
41 |
+
|
42 |
+
# Load LoRA adapter
|
43 |
+
model = PeftModel.from_pretrained(base_model, "sonyashijin/qwen3-32b-verilog-lora")
|
44 |
+
|
45 |
+
# Generate Verilog code
|
46 |
+
prompt = "Create a 4-bit D flip-flop with enable and asynchronous reset:"
|
47 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
48 |
+
outputs = model.generate(**inputs, max_length=512, temperature=0.7)
|
49 |
+
generated_code = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
50 |
+
print(generated_code)
|
51 |
```
|
52 |
|
53 |
+
## Training Configuration
|
54 |
+
|
55 |
+
- **Data**: Custom Verilog training dataset
|
56 |
+
- **Batch Size**: 64
|
57 |
+
- **Learning Rate**: 3e-5
|
58 |
+
- **KL Loss Coefficient**: 0.001
|
59 |
+
- **Max Prompt Length**: 1200 tokens
|
60 |
+
- **Max Response Length**: 1200 tokens
|
61 |
+
|
62 |
+
## Files
|
63 |
+
|
64 |
+
- `adapter_config.json`: LoRA adapter configuration
|
65 |
+
- `adapter_model.safetensors`: LoRA adapter weights (safe tensors format)
|
66 |
+
|
67 |
+
## Citation
|
68 |
+
|
69 |
+
If you use this model, please cite the VERL (Verification Enhanced Reinforcement Learning) framework.
|
70 |
+
|
71 |
+
```bibtex
|
72 |
+
@misc{verl2024,
|
73 |
+
title={VERL: Verification Enhanced Reinforcement Learning for Verilog Code Generation},
|
74 |
+
author={Your Name},
|
75 |
+
year={2024},
|
76 |
+
url={https://huggingface.co/sonyashijin/qwen3-32b-verilog-lora}
|
77 |
+
}
|
78 |
+
```
|