Run this model with HF Jobs
Run shailja/fine-tuned-codegen-16B-Verilog on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/shailja/fine-tuned-codegen-16B-Verilog. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/shailja/fine-tuned-codegen-16B-Verilog on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/shailja/fine-tuned-codegen-16B-Verilog. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/shailja/fine-tuned-codegen-16B-Verilog. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use shailja/fine-tuned-codegen-16B-Verilog with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shailja/fine-tuned-codegen-16B-Verilog with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="shailja/fine-tuned-codegen-16B-Verilog")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("shailja/fine-tuned-codegen-16B-Verilog") model = AutoModelForCausalLM.from_pretrained("shailja/fine-tuned-codegen-16B-Verilog", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use shailja/fine-tuned-codegen-16B-Verilog with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "shailja/fine-tuned-codegen-16B-Verilog" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shailja/fine-tuned-codegen-16B-Verilog", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/shailja/fine-tuned-codegen-16B-Verilog
- SGLang
How to use shailja/fine-tuned-codegen-16B-Verilog with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "shailja/fine-tuned-codegen-16B-Verilog" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shailja/fine-tuned-codegen-16B-Verilog", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "shailja/fine-tuned-codegen-16B-Verilog" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "shailja/fine-tuned-codegen-16B-Verilog", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use shailja/fine-tuned-codegen-16B-Verilog with Docker Model Runner:
docker model run hf.co/shailja/fine-tuned-codegen-16B-Verilog
VeriGen
Table of Contents
Model Summary
The VeriGen model is 16B parameter models fine-tuned version of CodeGen-multi-16B trained on Verilog code dataset .
- Repository: shailja-thakur/VGen
- Baseline LLM SalesForce/CodeGen
- Paper: Benchmarking Large Language Models for Automated Verilog RTL Code Generation
- Point of Contact: contact@shailja
- Languages: Verilog (Hardware Description Language)
Use
Intended use
The model was trained on Verilog from GitHub and textbooks. As such it is not an instruction model and commands like "Write a module that implements a 2-to-1 Mux." do not work well. However, by additing a partial line of module header like "module mux" in addition with the text in the prompt turns it into a capable Verilog teaching assistant.
Feel free to share your generations in the Community tab!
Generation
# pip install -q transformers
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
# Prompt
prompt = "//module half adder "
device='cuda'
# Load model and tokenizer
model_name = "shailja/fine-tuned-codegen-16B-Verilog"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name).to(device)
# Sample
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")
Attribution & Other Requirements
The pretraining dataset of the model was not filtered for permissive licenses only. Nevertheless, the model can generate source code verbatim from the dataset. The code's license might require attribution and/or other specific requirements that must be respected.
Limitations
The model has been trained on Verilog source code from open sources. The predominant natural language in source code is English, although other languages are also present. As such the model is capable of generating Verilog snippets provided some context but the generated code is not guaranteed to work as intended. It can be inefficient, contain bugs or exploits. See the paper for an in-depth discussion of the model limitations.
Training
Model
- Architecture: GPT-2 model with multi-query attention
- Pretraining steps: 150k
- Pretraining tokens: ~72B
- Precision: fp16
Hardware
- GPUs: 4 Tesla A100
- Training time: 15 days
License
The model is licensed under the BigCode OpenRAIL-M v1 license agreement. You can find the full agreement here.
Citation
@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}
}
- Downloads last month
- 240
Dataset used to train shailja/fine-tuned-codegen-16B-Verilog
Paper for shailja/fine-tuned-codegen-16B-Verilog
Evaluation results
- pass@1 on VeriEval (Prompted)self-reported