tonyzhao123 commited on
Commit
286fbeb
·
1 Parent(s): cc3dd91

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,8 +1,9 @@
1
  ---
2
  license: apache-2.0
3
- base_model:
4
- - meta-llama/Llama-4-Scout-17B-16E-Instruct
5
  tags:
 
 
6
  - llama
7
  language:
8
  - en
@@ -11,8 +12,13 @@ pipeline_tag: text-generation
11
 
12
  # tonyzhao123/dummy_llama4
13
 
14
- Small size Llama4, random weight for EP debug
15
 
 
 
 
 
 
16
 
17
  ## Usage
18
 
@@ -83,4 +89,4 @@ This model has been fine-tuned using knowledge distillation techniques to mainta
83
  publisher={Hugging Face},
84
  url={https://huggingface.co/tonyzhao123/dummy_llama4}
85
  }
86
- ```
 
1
  ---
2
  license: apache-2.0
3
+ base_model: meta-llama/Llama-3.2-1B
 
4
  tags:
5
+ - fine-tuned
6
+ - knowledge-distillation
7
  - llama
8
  language:
9
  - en
 
12
 
13
  # tonyzhao123/dummy_llama4
14
 
15
+ Llama 4 for small size EP debug and dist
16
 
17
+ ## Model Details
18
+
19
+ - **Base Model**: meta-llama/Llama-3.2-1B
20
+ - **Training Method**: Knowledge Distillation + Supervised Fine-tuning
21
+ - **Dataset**: Custom KD Dataset (1000 samples)
22
 
23
  ## Usage
24
 
 
89
  publisher={Hugging Face},
90
  url={https://huggingface.co/tonyzhao123/dummy_llama4}
91
  }
92
+ ```
chat_template.jinja ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- bos_token }}
2
+ {%- if custom_tools is defined %}
3
+ {%- set tools = custom_tools %}
4
+ {%- endif %}
5
+ {%- if not tools_in_user_message is defined %}
6
+ {%- set tools_in_user_message = true %}
7
+ {%- endif %}
8
+ {%- if not date_string is defined %}
9
+ {%- if strftime_now is defined %}
10
+ {%- set date_string = strftime_now("%d %b %Y") %}
11
+ {%- else %}
12
+ {%- set date_string = "26 Jul 2024" %}
13
+ {%- endif %}
14
+ {%- endif %}
15
+ {%- if not tools is defined %}
16
+ {%- set tools = none %}
17
+ {%- endif %}
18
+
19
+ {#- This block extracts the system message, so we can slot it into the right place. #}
20
+ {%- if messages[0]['role'] == 'system' %}
21
+ {%- if messages[0]['content'] is string %}
22
+ {%- set system_message = messages[0]['content']|trim %}
23
+ {%- else %}
24
+ {#- FIXME: The processor requires an array, always. #}
25
+ {%- set system_message = messages[0]['content'][0]['text']|trim %}
26
+ {%- endif %}
27
+ {%- set messages = messages[1:] %}
28
+ {%- set user_supplied_system_message = true %}
29
+ {%- else %}
30
+ {%- set system_message = "" %}
31
+ {%- set user_supplied_system_message = false %}
32
+ {%- endif %}
33
+
34
+ {#- System message if the user supplied one #}
35
+ {%- if user_supplied_system_message %}
36
+ {{- "<|header_start|>system<|header_end|>
37
+
38
+ " }}
39
+ {%- if tools is not none %}
40
+ {{- "Environment: ipython
41
+ " }}
42
+ {%- endif %}
43
+ {%- if tools is not none and not tools_in_user_message %}
44
+ {{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }}
45
+ {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
46
+ {{- "Do not use variables.
47
+
48
+ " }}
49
+ {%- for t in tools %}
50
+ {{- t | tojson(indent=4) }}
51
+ {{- "
52
+
53
+ " }}
54
+ {%- endfor %}
55
+ {%- endif %}
56
+ {{- system_message }}
57
+ {{- "<|eot|>" }}
58
+ {%- endif %}
59
+
60
+ {#- Custom tools are passed in a user message with some extra guidance #}
61
+ {%- if tools_in_user_message and not tools is none %}
62
+ {#- Extract the first user message so we can plug it in here #}
63
+ {%- if messages | length != 0 %}
64
+ {%- set first_user_message = messages[0]['content']|trim %}
65
+ {%- set messages = messages[1:] %}
66
+ {%- else %}
67
+ {{- raise_exception("Cannot put tools in the first user message when there's no first user message!") }}
68
+ {%- endif %}
69
+ {{- '<|header_start|>user<|header_end|>
70
+
71
+ ' -}}
72
+ {{- "Given the following functions, please respond with a JSON for a function call " }}
73
+ {{- "with its proper arguments that best answers the given prompt.
74
+
75
+ " }}
76
+ {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }}
77
+ {{- "Do not use variables.
78
+
79
+ " }}
80
+ {%- for t in tools %}
81
+ {{- t | tojson(indent=4) }}
82
+ {{- "
83
+
84
+ " }}
85
+ {%- endfor %}
86
+ {{- first_user_message + "<|eot|>"}}
87
+ {%- endif %}
88
+
89
+ {%- for message in messages %}
90
+ {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}
91
+ {{- '<|header_start|>' + message['role'] + '<|header_end|>
92
+
93
+ ' }}
94
+ {%- if message['content'] is string %}
95
+ {{- message['content'] }}
96
+ {%- else %}
97
+ {%- for content in message['content'] %}
98
+ {%- if content['type'] == 'image' %}
99
+ {{- '<|image|>' }}
100
+ {%- elif content['type'] == 'text' %}
101
+ {{- content['text'] }}
102
+ {%- endif %}
103
+ {%- endfor %}
104
+ {%- endif %}
105
+ {{- "<|eot|>" }}
106
+ {%- elif 'tool_calls' in message and message.tool_calls|length > 0 %}
107
+ {{- '<|header_start|>assistant<|header_end|>
108
+
109
+ ' -}}
110
+ {{- '<|python_start|>' }}
111
+ {%- if message['content'] is string %}
112
+ {{- message['content'] }}
113
+ {%- else %}
114
+ {%- for content in message['content'] %}
115
+ {%- if content['type'] == 'image' %}
116
+ {{- '<|image|>' }}
117
+ {%- elif content['type'] == 'text' %}
118
+ {{- content['text'] }}
119
+ {%- endif %}
120
+ {%- endfor %}
121
+ {%- endif %}
122
+ {{- '<|python_end|>' }}
123
+ {%- for tool_call in message.tool_calls %}
124
+ {{- '{"name": "' + tool_call.function.name + '", ' }}
125
+ {{- '"parameters": ' }}
126
+ {{- tool_call.function.arguments | tojson }}
127
+ {{- "}" }}
128
+ {%- endfor %}
129
+ {{- "<|eot|>" }}
130
+ {%- elif message.role == "tool" or message.role == "ipython" %}
131
+ {{- "<|header_start|>ipython<|header_end|>
132
+
133
+ " }}
134
+ {%- if message.content is mapping or message.content is iterable %}
135
+ {{- message.content | tojson }}
136
+ {%- else %}
137
+ {{- message.content }}
138
+ {%- endif %}
139
+ {{- "<|eot|>" }}
140
+ {%- endif %}
141
+ {%- endfor %}
142
+ {%- if add_generation_prompt %}
143
+ {{- '<|header_start|>assistant<|header_end|>
144
+
145
+ ' }}
146
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Llama4ForConditionalGeneration"
4
+ ],
5
+ "boi_token_index": 200080,
6
+ "eoi_token_index": 200081,
7
+ "image_token_index": 200092,
8
+ "model_type": "llama4",
9
+ "text_config": {
10
+ "attention_bias": false,
11
+ "attention_chunk_size": 8192,
12
+ "attention_dropout": 0.0,
13
+ "attn_scale": 0.1,
14
+ "attn_temperature_tuning": true,
15
+ "bos_token_id": 200000,
16
+ "eos_token_id": [
17
+ 200001,
18
+ 200007,
19
+ 200008
20
+ ],
21
+ "floor_scale": 8192,
22
+ "for_llm_compressor": false,
23
+ "head_dim": 128,
24
+ "hidden_act": "silu",
25
+ "hidden_size": 768,
26
+ "initializer_range": 0.02,
27
+ "interleave_moe_layer_step": 1,
28
+ "intermediate_size": 3072,
29
+ "intermediate_size_mlp": 16384,
30
+ "layer_types": [
31
+ "chunked_attention",
32
+ "chunked_attention",
33
+ "chunked_attention",
34
+ "full_attention",
35
+ "chunked_attention",
36
+ "chunked_attention",
37
+ "chunked_attention",
38
+ "full_attention"
39
+ ],
40
+ "max_position_embeddings": 8192,
41
+ "model_type": "llama4_text",
42
+ "moe_layers": [
43
+ 0,
44
+ 1,
45
+ 2,
46
+ 3,
47
+ 4,
48
+ 5,
49
+ 6,
50
+ 7
51
+ ],
52
+ "no_rope_layers": [
53
+ 1,
54
+ 1,
55
+ 1,
56
+ 0,
57
+ 1,
58
+ 1,
59
+ 1,
60
+ 0
61
+ ],
62
+ "num_attention_heads": 8,
63
+ "num_experts_per_tok": 1,
64
+ "num_hidden_layers": 8,
65
+ "num_key_value_heads": 2,
66
+ "num_local_experts": 4,
67
+ "output_router_logits": false,
68
+ "pad_token_id": 200018,
69
+ "rms_norm_eps": 1e-05,
70
+ "rope_scaling": {
71
+ "factor": 16.0,
72
+ "high_freq_factor": 1.0,
73
+ "low_freq_factor": 1.0,
74
+ "original_max_position_embeddings": 8192,
75
+ "rope_type": "llama3"
76
+ },
77
+ "rope_theta": 500000.0,
78
+ "router_aux_loss_coef": 0.001,
79
+ "router_jitter_noise": 0.0,
80
+ "torch_dtype": "bfloat16",
81
+ "use_cache": true,
82
+ "use_qk_norm": true,
83
+ "vocab_size": 202048
84
+ },
85
+ "tie_word_embeddings": false,
86
+ "torch_dtype": "float32",
87
+ "transformers_version": "4.55.2",
88
+ "vision_config": {
89
+ "attention_dropout": 0.0,
90
+ "hidden_act": "gelu",
91
+ "hidden_size": 1408,
92
+ "image_size": 336,
93
+ "initializer_range": 0.02,
94
+ "intermediate_size": 5632,
95
+ "model_type": "llama4_vision_model",
96
+ "multi_modal_projector_bias": false,
97
+ "norm_eps": 1e-05,
98
+ "num_attention_heads": 8,
99
+ "num_channels": 3,
100
+ "num_hidden_layers": 8,
101
+ "patch_size": 14,
102
+ "pixel_shuffle_ratio": 0.5,
103
+ "projector_dropout": 0.0,
104
+ "projector_input_dim": 768,
105
+ "projector_output_dim": 768,
106
+ "rope_theta": 10000,
107
+ "vision_feature_layer": -1,
108
+ "vision_feature_select_strategy": "default",
109
+ "vision_output_dim": 768
110
+ }
111
+ }
generation_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 200000,
4
+ "eos_token_id": [
5
+ 200001,
6
+ 200007,
7
+ 200008
8
+ ],
9
+ "pad_token_id": 200018,
10
+ "transformers_version": "4.55.2"
11
+ }
preprocessor_config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crop_size": null,
3
+ "data_format": "channels_first",
4
+ "default_to_square": true,
5
+ "device": null,
6
+ "disable_grouping": null,
7
+ "do_center_crop": null,
8
+ "do_convert_rgb": true,
9
+ "do_normalize": true,
10
+ "do_rescale": true,
11
+ "do_resize": true,
12
+ "image_mean": [
13
+ 0.5,
14
+ 0.5,
15
+ 0.5
16
+ ],
17
+ "image_processor_type": "Llama4ImageProcessorFast",
18
+ "image_std": [
19
+ 0.5,
20
+ 0.5,
21
+ 0.5
22
+ ],
23
+ "input_data_format": null,
24
+ "max_patches": 16,
25
+ "processor_class": "Llama4Processor",
26
+ "resample": 2,
27
+ "rescale_factor": 0.00392156862745098,
28
+ "resize_to_max_canvas": false,
29
+ "return_tensors": null,
30
+ "size": {
31
+ "height": 336,
32
+ "width": 336
33
+ }
34
+ }
processor_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "fake_image_token": "<|image|>",
3
+ "image_token": "<|image|>",
4
+ "patch_size": 14,
5
+ "processor_class": "Llama4Processor"
6
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<|begin_of_text|>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "<|eot|>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<|finetune_right_pad|>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ }
23
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:172c9eb4beafc72601690da3ccfcede5c2e6806a8d5ec1fca33e22acea8023a4
3
+ size 27948578
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff