Views
No views yet

| Base Model | MGEMMV | |
|---|---|---|
| 11B | meta-llama/Llama-3.2-11B-Vision-Instruct | bxsk2024/MGEMMV-Llama-11b |
| 7B | Qwen/Qwen2.5-VL-7B-Instruct | bxsk2024/MGEMMV-Qwen-7b |
1import torch
2from PIL import Image
3from transformers import AutoProcessor, AutoModelForVision2Seq
4
5# Load the model and processor
6device = 'cuda' if torch.cuda.is_available() else 'cpu'
7model_name = "/home/python/transformers/GEMMV-MultiModal-8b"
8processor = AutoProcessor.from_pretrained(model_name)
9model = AutoModelForVision2Seq.from_pretrained(model_name).to(device)
10
11# Load input image (circuit diagram)
12image = Image.open("example_gemm_diagram.jpg").convert("RGB")
13
14# Define the prompt/question
15prompt = "Generate Verilog code for the circuit diagram."
16
17# Preprocess input
18inputs = processor(text=prompt, images=image, return_tensors="pt").to(device)
19
20# Generate Verilog code
21outputs = model.generate(
22 **inputs,
23 max_length=4096,
24 temperature=0.8,
25 top_p=0.9,
26 do_sample=True
27)
28
29# Decode output and ensure Verilog ends properly
30response = processor.batch_decode(outputs, skip_special_tokens=True)[0]
31if not response.strip().endswith("endmodule"):
32 response += "\nendmodule"
33
34print("Generated Verilog:\n", response)
351@ARTICLE{3648843,
2 author={Zhang, Gaoche and Wang, Meiqi and Wang, Zhongfeng},
3 journal={IEEE Transactions on Circuits and Systems I: Regular Papers},
4 title={MGEMMV: A Multimodal LLM Framework for GEMM Verilog Generation From Circuit Diagrams},
5 year={2026},
6 volume={},
7 number={},
8 pages={},
9 keywords={Circuits;Hardware design languages;Hardware;Codes;Benchmark testing;Syntactics;AI accelerators;Optimization;Logic;Integrated circuit modeling;Electronic design automation (EDA);MLLMs;fine-tuning;GEMM;multimodal dataset},
10 doi={10.1109/TCSI.2025.3648843}
11}