pipeline_tag: 文本生成
inference: true
widget:
-
text: module display_hello_word
example_title: 你好世界
group: Verilog
license: bigcode-openrail-m
datasets:
-
shailja/Verilog_GitHub
library_name: transformers
tags:
-
代码
model-index:
-
name: VeriGen
results:
- task:
type: 文本生成
dataset:
type: openai_humaneval
name: VeriEval(提示版)
metrics:
- name: pass@1
type: pass@1
value:
verified: false
extra_gated_prompt: >-
模型许可协议
请在接受前阅读BigCode的OpenRAIL-M许可协议。
extra_gated_fields:
我接受上述许可协议,并将遵守使用限制和共享要求使用该模型: checkbox
VeriGen
目录
- 模型概述
- 使用
- 限制
- 训练
- 许可
- 引用
模型概述
VeriGen模型是基于CodeGen-multi-16B微调的6B参数模型,训练数据来自Verilog代码数据集。
使用
预期用途
该模型基于GitHub和教材中的Verilog代码训练。因此它_不是_一个指令模型,类似"编写一个实现2选1多路器的模块"这样的命令效果不佳。但通过添加部分模块头部如"module mux"并结合提示文本,可以使其成为一个有效的Verilog教学助手。
欢迎在社区标签页分享您的生成结果!
生成示例
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
prompt = "//module half adder "
device='cuda'
model_name = "shailja/fine-tuned-codegen-6B-Verilog"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name).to(device)
input_ids = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
sample = model.generate(input_ids, max_length=128, temperature=0.5, top_p=0.9)
print(tokenizer.decode(sample[0], truncate_before_pattern=[r"endmodule"]) + "endmodule")
归属要求及其他
该模型的预训练数据集未仅筛选宽松许可的内容。尽管如此,模型可能逐字生成数据集中的源代码。这些代码的许可可能要求署名和/或满足其他特定要求。
限制
该模型基于公开Verilog源代码训练。源代码中主要自然语言是英语,但也包含其他语言。因此模型能够在提供上下文的情况下生成Verilog片段,但不能保证生成代码按预期工作。可能存在效率低下、错误或漏洞问题。详见论文对模型限制的深入讨论。
训练
模型
- 架构: 采用多查询注意力机制的GPT-2模型
- 预训练步数: 15万
- 预训练标记数: ~720亿
- 精度: fp16
硬件
- GPU: 4块Tesla A100
- 训练时间: 10天
许可
本模型采用BigCode OpenRAIL-M v1许可协议。完整协议参见此处。
引用
@misc{https://doi.org/10.48550/arxiv.2212.11140,
doi = {10.48550/ARXIV.2212.11140},
url = {https://arxiv.org/abs/2212.11140},
author = {Thakur, Shailja and Ahmad, Baleegh and Fan, Zhenxing and Pearce, Hammond and Tan, Benjamin and Karri, Ramesh and Dolan-Gavitt, Brendan and Garg, Siddharth},
title = {Benchmarking Large Language Models for Automated Verilog RTL Code Generation},
publisher = {arXiv},
year = {2022},
copyright = {arXiv.org perpetual, non-exclusive license}
}