muratkarahan's picture
Upload folder using huggingface_hub
1221328 verified
|
Raw History Blame Contribute Delete
3.6 kB
# VerilogEval v1 Benchmark β€” H100 Kurulum ve Calistirma
## Amac
CodeV paper (arXiv:2407.10424) ile karsilastirmaya uygun benchmark testi.
3 model Γ— 2 benchmark Γ— 3 temperature = 18 run.
4x H100 SXM ile tahmini sure: ~1-1.5 saat.
## Modeller
| Model | HuggingFace ID | Inference Modu |
|---|---|---|
| qwen-base | Qwen/Qwen2.5-Coder-7B | Raw completion (prompt oldugu gibi) |
| qwen-instruct | Qwen/Qwen2.5-Coder-7B-Instruct | Chat template + system prompt |
| codev-qwen | muratkarahan/codev-qwen2.5-coder-7B | `### Instruction:\n...\n\n### Response:\n` |
## Benchmark
VerilogEval v1 (tag v1.0.0, commit 4b9b16e):
- Machine: 143 GPT-generated problem (JSONL)
- Human: 156 el yapimi problem (JSONL)
- Testbench icinde reference_module gomulu
- Pass kriteri: `Mismatches: 0 in N samples`
## Adimlar
### 1. Dosyalari sunucuya kopyala
Bu dizindeki tum dosyalari sunucuya kopyala:
```
h100_benchmark_package/
β”œβ”€β”€ setup.sh # Ortam kurulumu
β”œβ”€β”€ run_benchmark_v1.py # Ana benchmark scripti
β”œβ”€β”€ run_all.sh # Tum modelleri calistir
β”œβ”€β”€ collect_results.py # Sonuclari topla ve paper ile karsilastir
└── PROMPT.md # Bu dosya
```
### 2. Setup (ilk seferlik)
```bash
cd h100_benchmark_package
bash setup.sh
```
Bu script:
- Python venv olusturur
- torch, transformers, accelerate, tqdm, huggingface_hub kurar
- iverilog kurar (apt ile)
- VerilogEval v1 dataset'i klonlar
- 3 modeli HuggingFace'den cache'e indirir (~15 GB toplam)
### 3. Benchmark calistir
```bash
bash run_all.sh 2>&1 | tee benchmark_log.txt
```
18 run sirayla calisir. Her run sonunda checkpoint kaydedilir,
kesintide kaldigindan devam eder. Sonuclar `results_v1/` dizinine yazilir.
### 4. Sonuclari topla
```bash
python3 collect_results.py
```
Paper ile karsilastirma tablosu olusturur. Beklenen cikti:
- Per-metric best temperature (paper yontemi)
- Paper referans degerleri ile yan yana
## Onemli notlar
- **CodeV-Qwen prompt formati**: Model `### Instruction:\n...\n\n### Response:\n` formatiyla
egitilmis. Chat template KULLANMA. Script bunu otomatik yapiyor.
- **Qwen-base raw completion**: Base model chat template tanimaz. Prompt oldugu gibi
gonderilir (modul header -> model body'yi tamamlar). Script bunu otomatik yapiyor.
- **VerilogEval v1 formati**: Prompt = modul header (`module top_module(...);`).
Model body'yi uretir, script prompt + body birlestirerek tam modulu olusturur.
Eger model tam modul uretirse (module...endmodule), script bunu otomatik algilar.
- **max_tokens=2048**: Paper ile uyumlu. Onceki testlerimizde 1024 kullanmistik,
bu dusuk deger uzun modullerin kesilmesine yol acabilir.
- **Temperature sweep**: {0.2, 0.5, 0.8}. Paper her pass@k icin ayri ayri en iyi
temperature'i raporluyor (per-metric best). collect_results.py bunu otomatik yapar.
- **n_samples=20**: Her problem icin 20 sample uretilir. pass@k formuluyle degerlendirilir.
## Paper referans degerleri (karsilastirma icin)
CodeV paper Table III:
| Model | Machine p@1 | Machine p@5 | Machine p@10 | Human p@1 | Human p@5 | Human p@10 |
|---|---|---|---|---|---|---|
| Qwen2.5-Coder-7B (base) | 66.2 | 79.2 | 83.9 | 34.6 | 45.6 | 51.0 |
| CodeV-Verilog-QC (fine-tuned) | 80.1 | 87.9 | 90.5 | 59.2 | 65.8 | 69.1 |
## Sorun giderme
- `iverilog not found`: `apt-get install iverilog` veya PATH'e ekle
- CUDA OOM: `device_map="auto"` ile otomatik dagilim yapar, 4x H100 icin sorun olmaz
- Model indirme hatasi: `HF_TOKEN` ortam degiskenini ayarla
- Checkpoint sorunlari: `results_v1/*_checkpoint.json` dosyalarini silerek sifirdan baslat