Pablo-Flores-Mollinedo commited on
Commit
8bcc6f1
·
verified ·
1 Parent(s): ba43804

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: Qwen/Qwen2.5-Coder-7B-Instruct
3
+ library_name: peft
4
+ pipeline_tag: text-generation
5
+ tags:
6
+ - verilog
7
+ - rtl
8
+ - qwen2.5-coder
9
+ - lora
10
+ - peft
11
+ ---
12
+
13
+ # verilog-qwen2.5-coder-7b-v10-auto-distilled-direct-lora
14
+
15
+ LoRA/PEFT adapter for Verilog RTL code generation, trained from `Qwen/Qwen2.5-Coder-7B-Instruct` through the project adapter chain.
16
+
17
+ ## Intended use
18
+
19
+ Load base model `Qwen/Qwen2.5-Coder-7B-Instruct` and this adapter with PEFT. Prompt for complete synthesizable Verilog. This repo contains adapter files plus tokenizer/config dependencies needed for PEFT loading.
20
+
21
+ ## Local VerilogEval v2 spec-to-RTL direct result
22
+
23
+ - Compile: 136/156 = 87.18%
24
+ - Functional pass: 66/156 = 42.31%
25
+
26
+ Compile improved vs v9, functional regressed by one task; analysis artifact.
27
+
28
+ ## Caveat
29
+
30
+ This adapter is benchmark-targeted. Training data includes VerilogEval-distilled passing outputs and verified/retention data. Do not present these numbers as clean zero-shot leaderboard results.
31
+
32
+ ## Training summary
33
+
34
+ - Base adapter input: v8 combined verified direct (for v9); v9 auto distilled direct (for v10)
35
+ - Dataset style: direct `spec -> verified passing Verilog code`
36
+ - LoRA r/alpha: 16/32
37
+ - LR: 3e-7
38
+ - Epochs: 1
39
+ - Checkpointing: enabled every 25 steps during training
40
+
41
+ ## Loading sketch
42
+
43
+ ```python
44
+ from transformers import AutoTokenizer, AutoModelForCausalLM
45
+ from peft import PeftModel
46
+
47
+ base = "Qwen/Qwen2.5-Coder-7B-Instruct"
48
+ adapter = "Pablo-Flores-Mollinedo/verilog-qwen2.5-coder-7b-v10-auto-distilled-direct-lora"
49
+
50
+ tok = AutoTokenizer.from_pretrained(adapter, trust_remote_code=True)
51
+ model = AutoModelForCausalLM.from_pretrained(base, device_map="auto", trust_remote_code=True)
52
+ model = PeftModel.from_pretrained(model, adapter)
53
+ ```
adapter_config.json ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": null,
6
+ "base_model_name_or_path": "Qwen/Qwen2.5-Coder-7B-Instruct",
7
+ "bias": "none",
8
+ "corda_config": null,
9
+ "ensure_weight_tying": false,
10
+ "eva_config": null,
11
+ "exclude_modules": null,
12
+ "fan_in_fan_out": false,
13
+ "inference_mode": true,
14
+ "init_lora_weights": true,
15
+ "layer_replication": null,
16
+ "layers_pattern": null,
17
+ "layers_to_transform": null,
18
+ "loftq_config": {},
19
+ "lora_alpha": 64,
20
+ "lora_bias": false,
21
+ "lora_dropout": 0.05,
22
+ "lora_ga_config": null,
23
+ "megatron_config": null,
24
+ "megatron_core": "megatron.core",
25
+ "modules_to_save": null,
26
+ "peft_type": "LORA",
27
+ "peft_version": "0.19.1",
28
+ "qalora_group_size": 16,
29
+ "r": 32,
30
+ "rank_pattern": {},
31
+ "revision": null,
32
+ "target_modules": [
33
+ "o_proj",
34
+ "q_proj",
35
+ "v_proj",
36
+ "up_proj",
37
+ "gate_proj",
38
+ "k_proj",
39
+ "down_proj"
40
+ ],
41
+ "target_parameters": null,
42
+ "task_type": "CAUSAL_LM",
43
+ "trainable_token_indices": null,
44
+ "use_bdlora": null,
45
+ "use_dora": false,
46
+ "use_qalora": false,
47
+ "use_rslora": false
48
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fdf349585aeedacb988d0a77c7af03a1c922c31e421ad13ac0706ec6822e7cf8
3
+ size 323014168
chat_template.jinja ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0]['role'] == 'system' %}
4
+ {{- messages[0]['content'] }}
5
+ {%- else %}
6
+ {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}
7
+ {%- endif %}
8
+ {{- "\n\n# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
9
+ {%- for tool in tools %}
10
+ {{- "\n" }}
11
+ {{- tool | tojson }}
12
+ {%- endfor %}
13
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
14
+ {%- else %}
15
+ {%- if messages[0]['role'] == 'system' %}
16
+ {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}
17
+ {%- else %}
18
+ {{- '<|im_start|>system\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\n' }}
19
+ {%- endif %}
20
+ {%- endif %}
21
+ {%- for message in messages %}
22
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}
23
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
24
+ {%- elif message.role == "assistant" %}
25
+ {{- '<|im_start|>' + message.role }}
26
+ {%- if message.content %}
27
+ {{- '\n' + message.content }}
28
+ {%- endif %}
29
+ {%- for tool_call in message.tool_calls %}
30
+ {%- if tool_call.function is defined %}
31
+ {%- set tool_call = tool_call.function %}
32
+ {%- endif %}
33
+ {{- '\n<tool_call>\n{"name": "' }}
34
+ {{- tool_call.name }}
35
+ {{- '", "arguments": ' }}
36
+ {{- tool_call.arguments | tojson }}
37
+ {{- '}\n</tool_call>' }}
38
+ {%- endfor %}
39
+ {{- '<|im_end|>\n' }}
40
+ {%- elif message.role == "tool" %}
41
+ {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}
42
+ {{- '<|im_start|>user' }}
43
+ {%- endif %}
44
+ {{- '\n<tool_response>\n' }}
45
+ {{- message.content }}
46
+ {{- '\n</tool_response>' }}
47
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
48
+ {{- '<|im_end|>\n' }}
49
+ {%- endif %}
50
+ {%- endif %}
51
+ {%- endfor %}
52
+ {%- if add_generation_prompt %}
53
+ {{- '<|im_start|>assistant\n' }}
54
+ {%- endif %}
experiment_metadata/config.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "base_model": "Qwen/Qwen2.5-Coder-7B-Instruct",
3
+ "start_adapter": "adapter_v8_combined_verified_direct",
4
+ "start_dataset": "data/v8_combined_verified_direct.jsonl",
5
+ "start_version": 9,
6
+ "max_iters": 10,
7
+ "min_improve": 1,
8
+ "min_new_unique": 1,
9
+ "repo": "/home/pablo/verilog-eval",
10
+ "workdir": "/home/pablo/verilog-llm",
11
+ "lr": "3e-7",
12
+ "epochs": "1",
13
+ "max_length": "1536",
14
+ "grad_accum": "8",
15
+ "repeat_new": 4,
16
+ "version": 10,
17
+ "adapter_in": "/home/pablo/verilog-llm/adapter_v9_auto_distilled_direct",
18
+ "dataset": "/home/pablo/verilog-llm/data/v10_auto_distilled_direct.jsonl",
19
+ "adapter_out": "adapter_v10_auto_distilled_direct",
20
+ "build": "/home/pablo/verilog-eval/build-v10-auto-direct-spec-n1"
21
+ }
experiment_metadata/report.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": 10,
3
+ "adapter": "adapter_v10_auto_distilled_direct",
4
+ "build": "/home/pablo/verilog-eval/build-v10-auto-direct-spec-n1",
5
+ "summary": {
6
+ "total": 156,
7
+ "compile": 136,
8
+ "passed": 66,
9
+ "compile_pct": 87.17948717948718,
10
+ "pass_pct": 42.30769230769231
11
+ },
12
+ "dataset_stats": {
13
+ "rows": 2774,
14
+ "added_unique": 8,
15
+ "added_weighted": 32
16
+ },
17
+ "next_dataset": "/home/pablo/verilog-llm/data/v11_auto_distilled_direct.jsonl"
18
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3931410bb94b6af8a8f501473b36c01ae62876bc79da5b6ebfafcb33d918bb49
3
+ size 11422169
tokenizer_config.json ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": null,
5
+ "clean_up_tokenization_spaces": false,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "extra_special_tokens": [
9
+ "<|im_start|>",
10
+ "<|im_end|>",
11
+ "<|object_ref_start|>",
12
+ "<|object_ref_end|>",
13
+ "<|box_start|>",
14
+ "<|box_end|>",
15
+ "<|quad_start|>",
16
+ "<|quad_end|>",
17
+ "<|vision_start|>",
18
+ "<|vision_end|>",
19
+ "<|vision_pad|>",
20
+ "<|image_pad|>",
21
+ "<|video_pad|>"
22
+ ],
23
+ "is_local": true,
24
+ "local_files_only": false,
25
+ "max_length": 1024,
26
+ "model_max_length": 32768,
27
+ "pad_to_multiple_of": null,
28
+ "pad_token": "<|im_end|>",
29
+ "pad_token_type_id": 0,
30
+ "padding_side": "right",
31
+ "split_special_tokens": false,
32
+ "stride": 0,
33
+ "tokenizer_class": "Qwen2Tokenizer",
34
+ "truncation_side": "right",
35
+ "truncation_strategy": "longest_first",
36
+ "unk_token": null
37
+ }