anonymous-review-0000/VeriLadder
Viewer • Updated • 824k • 12
How to use anonymous-review-0000/VeriLadder-QwenCoder-7B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="anonymous-review-0000/VeriLadder-QwenCoder-7B")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("anonymous-review-0000/VeriLadder-QwenCoder-7B")
model = AutoModelForCausalLM.from_pretrained("anonymous-review-0000/VeriLadder-QwenCoder-7B", device_map="auto")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use anonymous-review-0000/VeriLadder-QwenCoder-7B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "anonymous-review-0000/VeriLadder-QwenCoder-7B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "anonymous-review-0000/VeriLadder-QwenCoder-7B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/anonymous-review-0000/VeriLadder-QwenCoder-7B
How to use anonymous-review-0000/VeriLadder-QwenCoder-7B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "anonymous-review-0000/VeriLadder-QwenCoder-7B" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "anonymous-review-0000/VeriLadder-QwenCoder-7B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "anonymous-review-0000/VeriLadder-QwenCoder-7B" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "anonymous-review-0000/VeriLadder-QwenCoder-7B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use anonymous-review-0000/VeriLadder-QwenCoder-7B with Docker Model Runner:
docker model run hf.co/anonymous-review-0000/VeriLadder-QwenCoder-7B
Qwen/Qwen2.5-Coder-7B-Instruct fine-tuned to write Verilog from a natural-language specification. It is trained on the refined specifications of VeriLadder, whose every specification is verified by a formal equivalence check to determine its circuit.
transformers or vLLM.lora/: the LoRA adapter alone (rank 16, alpha 32, all attention and MLP projections), to apply on top of
Qwen/Qwen2.5-Coder-7B-Instruct.from transformers import AutoModelForCausalLM, AutoTokenizer
name = "anonymous-review-0000/VeriLadder-QwenCoder-7B"
tok = AutoTokenizer.from_pretrained(name)
model = AutoModelForCausalLM.from_pretrained(name, dtype="bfloat16", device_map="auto")
spec = "A 4-bit counter with a synchronous active-high reset."
messages = [
{"role": "system", "content": "You are a Verilog RTL designer that only writes code using correct Verilog syntax."},
{"role": "user", "content": spec + "\n\nWrite the Verilog code for this design."},
]
ids = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(ids, max_new_tokens=3072, do_sample=True, temperature=0.2, top_p=0.95)
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True))
With the adapter instead of the merged weights:
from peft import PeftModel
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-7B-Instruct", dtype="bfloat16", device_map="auto")
model = PeftModel.from_pretrained(base, "anonymous-review-0000/VeriLadder-QwenCoder-7B", subfolder="lora")
Functional pass@1 / pass@5 (%), five samples per problem.
| Model | VerilogEval v2 | RTLLM v2 | VeriLadder-Bench |
|---|---|---|---|
| Qwen2.5-Coder-7B-Instruct | 31.7 / 47.3 | 35.0 / 50.0 | 61.7 / 79.5 |
| VeriLadder-QwenCoder-7B | 50.0 / 61.5 | 45.2 / 54.0 | 83.1 / 92.3 |
Supervised fine-tuning with LoRA (rank 16, alpha 32, three epochs) on VeriLadder.