yhavinga commited on
Commit
212c8e5
·
verified ·
1 Parent(s): e205d1b

Upload Phi-4-mini N2 schema retrieval adapter model

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,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model: unsloth/Phi-4-mini-instruct-bnb-4bit
3
+ library_name: peft
4
+ model_name: n2_schema_retrieval_model
5
+ tags:
6
+ - base_model:adapter:unsloth/Phi-4-mini-instruct-bnb-4bit
7
+ - lora
8
+ - sft
9
+ - transformers
10
+ - trl
11
+ - unsloth
12
+ licence: license
13
+ pipeline_tag: text-generation
14
+ ---
15
+
16
+ # Model Card for n2_schema_retrieval_model
17
+
18
+ This model is a fine-tuned version of [unsloth/Phi-4-mini-instruct-bnb-4bit](https://huggingface.co/unsloth/Phi-4-mini-instruct-bnb-4bit).
19
+ It has been trained using [TRL](https://github.com/huggingface/trl).
20
+
21
+ ## Quick start
22
+
23
+ ```python
24
+ from transformers import pipeline
25
+
26
+ question = "If you had a time machine, but could only go to the past or the future once and never return, which would you choose and why?"
27
+ generator = pipeline("text-generation", model="None", device="cuda")
28
+ output = generator([{"role": "user", "content": question}], max_new_tokens=128, return_full_text=False)[0]
29
+ print(output["generated_text"])
30
+ ```
31
+
32
+ ## Training procedure
33
+
34
+ [<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="150" height="24"/>](https://wandb.ai/yepster/n2-schema-retrieval-unsloth/runs/5pwqqkrw)
35
+
36
+
37
+ This model was trained with SFT.
38
+
39
+ ### Framework versions
40
+
41
+ - PEFT 0.16.0
42
+ - TRL: 0.19.1
43
+ - Transformers: 4.53.1
44
+ - Pytorch: 2.7.1
45
+ - Datasets: 4.0.0
46
+ - Tokenizers: 0.21.2
47
+
48
+ ## Citations
49
+
50
+
51
+
52
+ Cite TRL as:
53
+
54
+ ```bibtex
55
+ @misc{vonwerra2022trl,
56
+ title = {{TRL: Transformer Reinforcement Learning}},
57
+ author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin Gallou{\'e}dec},
58
+ year = 2020,
59
+ journal = {GitHub repository},
60
+ publisher = {GitHub},
61
+ howpublished = {\url{https://github.com/huggingface/trl}}
62
+ }
63
+ ```
adapter_config.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alpha_pattern": {},
3
+ "auto_mapping": null,
4
+ "base_model_name_or_path": "unsloth/Phi-4-mini-instruct-bnb-4bit",
5
+ "bias": "none",
6
+ "corda_config": null,
7
+ "eva_config": null,
8
+ "exclude_modules": null,
9
+ "fan_in_fan_out": false,
10
+ "inference_mode": true,
11
+ "init_lora_weights": true,
12
+ "layer_replication": null,
13
+ "layers_pattern": null,
14
+ "layers_to_transform": null,
15
+ "loftq_config": {},
16
+ "lora_alpha": 1024,
17
+ "lora_bias": false,
18
+ "lora_dropout": 0.05,
19
+ "megatron_config": null,
20
+ "megatron_core": "megatron.core",
21
+ "modules_to_save": null,
22
+ "peft_type": "LORA",
23
+ "qalora_group_size": 16,
24
+ "r": 512,
25
+ "rank_pattern": {},
26
+ "revision": null,
27
+ "target_modules": [
28
+ "v_proj",
29
+ "o_proj",
30
+ "q_proj",
31
+ "k_proj"
32
+ ],
33
+ "task_type": "CAUSAL_LM",
34
+ "trainable_token_indices": null,
35
+ "use_dora": false,
36
+ "use_qalora": false,
37
+ "use_rslora": false
38
+ }
adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:51db3afe4bf926a12de3a30609209f673fa74d6d0b32fa9d5d814c8c3071b0f3
3
+ size 402662000
added_tokens.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "<|/tool_call|>": 200026,
3
+ "<|/tool|>": 200024,
4
+ "<|assistant|>": 200019,
5
+ "<|end|>": 200020,
6
+ "<|system|>": 200022,
7
+ "<|tag|>": 200028,
8
+ "<|tool_call|>": 200025,
9
+ "<|tool_response|>": 200027,
10
+ "<|tool|>": 200023,
11
+ "<|user|>": 200021,
12
+ "<|PAD▁TOKEN|>": 200029
13
+ }
chat_template.jinja ADDED
@@ -0,0 +1 @@
 
 
1
+ {% for message in messages %}{% if message['role'] == 'system' and 'tools' in message and message['tools'] is not none %}{{ '<|' + message['role'] + '|>' + message['content'] + '<|tool|>' + message['tools'] + '<|/tool|>' + '<|end|>' }}{% else %}{{ '<|' + message['role'] + '|>' + message['content'] + '<|end|>' }}{% endif %}{% endfor %}{% if add_generation_prompt %}{{ '<|assistant|>' }}{% endif %}
config.json ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Phi3ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "auto_map": {
8
+ "AutoConfig": "configuration_phi3.Phi3Config",
9
+ "AutoModelForCausalLM": "modeling_phi3.Phi3ForCausalLM",
10
+ "AutoTokenizer": "Xenova/gpt-4o"
11
+ },
12
+ "bos_token_id": 199999,
13
+ "embd_pdrop": 0.0,
14
+ "eos_token_id": 200020,
15
+ "full_attn_mod": 1,
16
+ "hidden_act": "silu",
17
+ "hidden_size": 3072,
18
+ "initializer_range": 0.02,
19
+ "intermediate_size": 8192,
20
+ "interpolate_factor": 1,
21
+ "lm_head_bias": false,
22
+ "max_position_embeddings": 131072,
23
+ "mlp_bias": false,
24
+ "model_type": "phi3",
25
+ "num_attention_heads": 24,
26
+ "num_hidden_layers": 32,
27
+ "num_key_value_heads": 8,
28
+ "original_max_position_embeddings": 4096,
29
+ "pad_token_id": 200029,
30
+ "partial_rotary_factor": 0.75,
31
+ "resid_pdrop": 0.0,
32
+ "rms_norm_eps": 1e-05,
33
+ "rope_scaling": {
34
+ "long_factor": [
35
+ 1,
36
+ 1.118320672,
37
+ 1.250641126,
38
+ 1.398617824,
39
+ 1.564103225,
40
+ 1.74916897,
41
+ 1.956131817,
42
+ 2.187582649,
43
+ 2.446418898,
44
+ 2.735880826,
45
+ 3.059592084,
46
+ 3.421605075,
47
+ 3.826451687,
48
+ 4.279200023,
49
+ 4.785517845,
50
+ 5.351743533,
51
+ 5.984965424,
52
+ 6.693110555,
53
+ 7.485043894,
54
+ 8.370679318,
55
+ 9.36110372,
56
+ 10.4687158,
57
+ 11.70738129,
58
+ 13.09260651,
59
+ 14.64173252,
60
+ 16.37415215,
61
+ 18.31155283,
62
+ 20.47818807,
63
+ 22.90118105,
64
+ 25.61086418,
65
+ 28.64115884,
66
+ 32.03,
67
+ 32.1,
68
+ 32.13,
69
+ 32.23,
70
+ 32.6,
71
+ 32.61,
72
+ 32.64,
73
+ 32.66,
74
+ 32.7,
75
+ 32.71,
76
+ 32.93,
77
+ 32.97,
78
+ 33.28,
79
+ 33.49,
80
+ 33.5,
81
+ 44.16,
82
+ 47.77
83
+ ],
84
+ "short_factor": [
85
+ 1.0,
86
+ 1.0,
87
+ 1.0,
88
+ 1.0,
89
+ 1.0,
90
+ 1.0,
91
+ 1.0,
92
+ 1.0,
93
+ 1.0,
94
+ 1.0,
95
+ 1.0,
96
+ 1.0,
97
+ 1.0,
98
+ 1.0,
99
+ 1.0,
100
+ 1.0,
101
+ 1.0,
102
+ 1.0,
103
+ 1.0,
104
+ 1.0,
105
+ 1.0,
106
+ 1.0,
107
+ 1.0,
108
+ 1.0,
109
+ 1.0,
110
+ 1.0,
111
+ 1.0,
112
+ 1.0,
113
+ 1.0,
114
+ 1.0,
115
+ 1.0,
116
+ 1.0,
117
+ 1.0,
118
+ 1.0,
119
+ 1.0,
120
+ 1.0,
121
+ 1.0,
122
+ 1.0,
123
+ 1.0,
124
+ 1.0,
125
+ 1.0,
126
+ 1.0,
127
+ 1.0,
128
+ 1.0,
129
+ 1.0,
130
+ 1.0,
131
+ 1.0,
132
+ 1.0
133
+ ],
134
+ "type": "longrope"
135
+ },
136
+ "rope_theta": 10000.0,
137
+ "sliding_window": 262144,
138
+ "tie_word_embeddings": true,
139
+ "torch_dtype": "bfloat16",
140
+ "transformers_version": "4.53.1",
141
+ "unsloth_fixed": true,
142
+ "unsloth_version": "2025.7.2",
143
+ "use_cache": true,
144
+ "vocab_size": 200064
145
+ }
generation_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 199999,
4
+ "eos_token_id": 200020,
5
+ "max_length": 131072,
6
+ "pad_token_id": 200029,
7
+ "transformers_version": "4.53.1"
8
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1865c38a88cffd468a9b2fad5d08b720af7ca2c921a6697df9de69223810870c
3
+ size 2891584764
special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|endoftext|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|end|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": true,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<|PAD▁TOKEN|>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "�",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:37b10016a39382ff2d24acc20a291ed83243a26c4549ab01f6240e72c6291d56
3
+ size 15524472
tokenizer_config.json ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_eos_token": false,
4
+ "add_prefix_space": false,
5
+ "added_tokens_decoder": {
6
+ "3251": {
7
+ "content": "�",
8
+ "lstrip": false,
9
+ "normalized": false,
10
+ "rstrip": false,
11
+ "single_word": false,
12
+ "special": true
13
+ },
14
+ "199999": {
15
+ "content": "<|endoftext|>",
16
+ "lstrip": false,
17
+ "normalized": false,
18
+ "rstrip": false,
19
+ "single_word": false,
20
+ "special": true
21
+ },
22
+ "200018": {
23
+ "content": "<|endofprompt|>",
24
+ "lstrip": false,
25
+ "normalized": false,
26
+ "rstrip": false,
27
+ "single_word": false,
28
+ "special": true
29
+ },
30
+ "200019": {
31
+ "content": "<|assistant|>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": true,
35
+ "single_word": false,
36
+ "special": true
37
+ },
38
+ "200020": {
39
+ "content": "<|end|>",
40
+ "lstrip": false,
41
+ "normalized": false,
42
+ "rstrip": true,
43
+ "single_word": false,
44
+ "special": true
45
+ },
46
+ "200021": {
47
+ "content": "<|user|>",
48
+ "lstrip": false,
49
+ "normalized": false,
50
+ "rstrip": true,
51
+ "single_word": false,
52
+ "special": true
53
+ },
54
+ "200022": {
55
+ "content": "<|system|>",
56
+ "lstrip": false,
57
+ "normalized": false,
58
+ "rstrip": true,
59
+ "single_word": false,
60
+ "special": true
61
+ },
62
+ "200023": {
63
+ "content": "<|tool|>",
64
+ "lstrip": false,
65
+ "normalized": false,
66
+ "rstrip": true,
67
+ "single_word": false,
68
+ "special": false
69
+ },
70
+ "200024": {
71
+ "content": "<|/tool|>",
72
+ "lstrip": false,
73
+ "normalized": false,
74
+ "rstrip": true,
75
+ "single_word": false,
76
+ "special": false
77
+ },
78
+ "200025": {
79
+ "content": "<|tool_call|>",
80
+ "lstrip": false,
81
+ "normalized": false,
82
+ "rstrip": true,
83
+ "single_word": false,
84
+ "special": false
85
+ },
86
+ "200026": {
87
+ "content": "<|/tool_call|>",
88
+ "lstrip": false,
89
+ "normalized": false,
90
+ "rstrip": true,
91
+ "single_word": false,
92
+ "special": false
93
+ },
94
+ "200027": {
95
+ "content": "<|tool_response|>",
96
+ "lstrip": false,
97
+ "normalized": false,
98
+ "rstrip": true,
99
+ "single_word": false,
100
+ "special": false
101
+ },
102
+ "200028": {
103
+ "content": "<|tag|>",
104
+ "lstrip": false,
105
+ "normalized": false,
106
+ "rstrip": true,
107
+ "single_word": false,
108
+ "special": true
109
+ },
110
+ "200029": {
111
+ "content": "<|PAD▁TOKEN|>",
112
+ "lstrip": false,
113
+ "normalized": false,
114
+ "rstrip": false,
115
+ "single_word": false,
116
+ "special": true
117
+ }
118
+ },
119
+ "bos_token": "<|endoftext|>",
120
+ "clean_up_tokenization_spaces": false,
121
+ "eos_token": "<|end|>",
122
+ "extra_special_tokens": {},
123
+ "model_max_length": 131072,
124
+ "pad_token": "<|PAD▁TOKEN|>",
125
+ "padding_side": "right",
126
+ "tokenizer_class": "GPT2Tokenizer",
127
+ "unk_token": "�"
128
+ }
training_args.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "model": "phi4-mini",
3
+ "use_unsloth_model": true,
4
+ "dataset": "UWV/wim-instruct-wiki-to-jsonld-agent-steps",
5
+ "max_samples": null,
6
+ "filter_n2_only": true,
7
+ "max_seq_length": 8192,
8
+ "batch_size": 32,
9
+ "gradient_accumulation_steps": 1,
10
+ "max_steps": 5000,
11
+ "learning_rate": 2e-05,
12
+ "warmup_steps": 100,
13
+ "max_grad_norm": 1.0,
14
+ "lora_r": 512,
15
+ "lora_alpha": 1024,
16
+ "lora_dropout": 0.05,
17
+ "target_modules": [
18
+ "q_proj",
19
+ "k_proj",
20
+ "v_proj",
21
+ "o_proj"
22
+ ],
23
+ "load_in_4bit": true,
24
+ "use_gradient_checkpointing": false,
25
+ "rope_scaling": null,
26
+ "output_dir": "/data/model_outputs/n2_schema_retrieval_model",
27
+ "assistant_only_loss": true,
28
+ "no_eval": false,
29
+ "num_workers": 8,
30
+ "full_finetune": false,
31
+ "wandb": true,
32
+ "seed": 42,
33
+ "push_to_hub": false,
34
+ "hub_model_id": null
35
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff