Upload processor
Browse files- README.md +106 -56
- chat_template.json +3 -0
- preprocessor_config.json +33 -0
- processor_config.json +6 -0
README.md
CHANGED
@@ -21,56 +21,101 @@ tags:
|
|
21 |
- pytorch
|
22 |
- llama
|
23 |
- llama-4
|
24 |
-
extra_gated_prompt:
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
extra_gated_fields:
|
75 |
First Name: text
|
76 |
Last Name: text
|
@@ -87,13 +132,18 @@ extra_gated_fields:
|
|
87 |
- Reporter
|
88 |
- Other
|
89 |
geo: ip_location
|
90 |
-
By clicking Submit below I accept the terms of the license and acknowledge that
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
|
|
95 |
extra_gated_button_content: Submit
|
96 |
-
extra_gated_heading:
|
|
|
|
|
|
|
|
|
97 |
license: other
|
98 |
license_name: llama4
|
99 |
---
|
|
|
21 |
- pytorch
|
22 |
- llama
|
23 |
- llama-4
|
24 |
+
extra_gated_prompt: "**LLAMA 4 COMMUNITY LICENSE AGREEMENT**\nLlama 4 Version Effective\
|
25 |
+
\ Date: April 5, 2025\n\"**Agreement**\" means the terms and conditions for use,\
|
26 |
+
\ reproduction, distribution and modification of the Llama Materials set forth herein.\n\
|
27 |
+
\"**Documentation**\" means the specifications, manuals and documentation accompanying\
|
28 |
+
\ Llama 4 distributed by Meta at [https://www.llama.com/docs/overview](https://llama.com/docs/overview).\n\
|
29 |
+
\"**Licensee**\" or \"**you**\" means you, or your employer or any other person\
|
30 |
+
\ or entity (if you are entering into this Agreement on such person or entity’s\
|
31 |
+
\ behalf), of the age required under applicable laws, rules or regulations to provide\
|
32 |
+
\ legal consent and that has legal authority to bind your employer or such other\
|
33 |
+
\ person or entity if you are entering in this Agreement on their behalf.\n\"**Llama\
|
34 |
+
\ 4**\" means the foundational large language models and software and algorithms,\
|
35 |
+
\ including machine-learning model code, trained model weights, inference-enabling\
|
36 |
+
\ code, training-enabling code, fine-tuning enabling code and other elements of\
|
37 |
+
\ the foregoing distributed by Meta at [https://www.llama.com/llama-downloads](https://www.llama.com/llama-downloads).\n\
|
38 |
+
\"**Llama Materials**\" means, collectively, Meta’s proprietary Llama 4 and Documentation\
|
39 |
+
\ (and any portion thereof) made available under this Agreement.\n\"**Meta**\" or\
|
40 |
+
\ \"**we**\" means Meta Platforms Ireland Limited (if you are located in or, if\
|
41 |
+
\ you are an entity, your principal place of business is in the EEA or Switzerland)\
|
42 |
+
\ and Meta Platforms, Inc. (if you are located outside of the EEA or Switzerland).\
|
43 |
+
\ \nBy clicking \"I Accept\" below or by using or distributing any portion or element\
|
44 |
+
\ of the Llama Materials, you agree to be bound by this Agreement.\n1\\. **License\
|
45 |
+
\ Rights and Redistribution**.\na. Grant of Rights. You are granted a non-exclusive,\
|
46 |
+
\ worldwide, non-transferable and royalty-free limited license under Meta’s intellectual\
|
47 |
+
\ property or other rights owned by Meta embodied in the Llama Materials to use,\
|
48 |
+
\ reproduce, distribute, copy, create derivative works of, and make modifications\
|
49 |
+
\ to the Llama Materials. \nb. Redistribution and Use. \ni. If you distribute\
|
50 |
+
\ or make available the Llama Materials (or any derivative works thereof), or a\
|
51 |
+
\ product or service (including another AI model) that contains any of them, you\
|
52 |
+
\ shall (A) provide a copy of this Agreement with any such Llama Materials; and\
|
53 |
+
\ (B) prominently display \"Built with Llama\" on a related website, user interface,\
|
54 |
+
\ blogpost, about page, or product documentation. If you use the Llama Materials\
|
55 |
+
\ or any outputs or results of the Llama Materials to create, train, fine tune,\
|
56 |
+
\ or otherwise improve an AI model, which is distributed or made available, you\
|
57 |
+
\ shall also include \"Llama\" at the beginning of any such AI model name.\nii.\
|
58 |
+
\ If you receive Llama Materials, or any derivative works thereof, from a Licensee\
|
59 |
+
\ as part of an integrated end user product, then Section 2 of this Agreement will\
|
60 |
+
\ not apply to you. \niii. You must retain in all copies of the Llama Materials\
|
61 |
+
\ that you distribute the following attribution notice within a \"Notice\" text\
|
62 |
+
\ file distributed as a part of such copies: \"Llama 4 is licensed under the Llama\
|
63 |
+
\ 4 Community License, Copyright © Meta Platforms, Inc. All Rights Reserved.\"\n\
|
64 |
+
iv. Your use of the Llama Materials must comply with applicable laws and regulations\
|
65 |
+
\ (including trade compliance laws and regulations) and adhere to the Acceptable\
|
66 |
+
\ Use Policy for the Llama Materials (available at [https://www.llama.com/llama4/use-policy](https://www.llama.com/llama4/use-policy)),\
|
67 |
+
\ which is hereby incorporated by reference into this Agreement. \n \n2\\. **Additional\
|
68 |
+
\ Commercial Terms**. If, on the Llama 4 version release date, the monthly active\
|
69 |
+
\ users of the products or services made available by or for Licensee, or Licensee’s\
|
70 |
+
\ affiliates, is greater than 700 million monthly active users in the preceding\
|
71 |
+
\ calendar month, you must request a license from Meta, which Meta may grant to\
|
72 |
+
\ you in its sole discretion, and you are not authorized to exercise any of the\
|
73 |
+
\ rights under this Agreement unless or until Meta otherwise expressly grants you\
|
74 |
+
\ such rights.\n3**. Disclaimer of Warranty**. UNLESS REQUIRED BY APPLICABLE LAW,\
|
75 |
+
\ THE LLAMA MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN \"\
|
76 |
+
AS IS\" BASIS, WITHOUT WARRANTIES OF ANY KIND, AND META DISCLAIMS ALL WARRANTIES\
|
77 |
+
\ OF ANY KIND, BOTH EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES\
|
78 |
+
\ OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.\
|
79 |
+
\ YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING\
|
80 |
+
\ THE LLAMA MATERIALS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE LLAMA\
|
81 |
+
\ MATERIALS AND ANY OUTPUT AND RESULTS.\n4\\. **Limitation of Liability**. IN NO\
|
82 |
+
\ EVENT WILL META OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER\
|
83 |
+
\ IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF\
|
84 |
+
\ THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL,\
|
85 |
+
\ INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF META OR ITS AFFILIATES HAVE\
|
86 |
+
\ BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.\n5\\. **Intellectual\
|
87 |
+
\ Property**.\na. No trademark licenses are granted under this Agreement, and in\
|
88 |
+
\ connection with the Llama Materials, neither Meta nor Licensee may use any name\
|
89 |
+
\ or mark owned by or associated with the other or any of its affiliates, except\
|
90 |
+
\ as required for reasonable and customary use in describing and redistributing\
|
91 |
+
\ the Llama Materials or as set forth in this Section 5(a). Meta hereby grants you\
|
92 |
+
\ a license to use \"Llama\" (the \"Mark\") solely as required to comply with the\
|
93 |
+
\ last sentence of Section 1.b.i. You will comply with Meta’s brand guidelines (currently\
|
94 |
+
\ accessible at [https://about.meta.com/brand/resources/meta/company-brand/](https://about.meta.com/brand/resources/meta/company-brand/)[)](https://en.facebookbrand.com/).\
|
95 |
+
\ All goodwill arising out of your use of the Mark will inure to the benefit of\
|
96 |
+
\ Meta.\nb. Subject to Meta’s ownership of Llama Materials and derivatives made\
|
97 |
+
\ by or for Meta, with respect to any derivative works and modifications of the\
|
98 |
+
\ Llama Materials that are made by you, as between you and Meta, you are and will\
|
99 |
+
\ be the owner of such derivative works and modifications.\nc. If you institute\
|
100 |
+
\ litigation or other proceedings against Meta or any entity (including a cross-claim\
|
101 |
+
\ or counterclaim in a lawsuit) alleging that the Llama Materials or Llama 4 outputs\
|
102 |
+
\ or results, or any portion of any of the foregoing, constitutes infringement of\
|
103 |
+
\ intellectual property or other rights owned or licensable by you, then any licenses\
|
104 |
+
\ granted to you under this Agreement shall terminate as of the date such litigation\
|
105 |
+
\ or claim is filed or instituted. You will indemnify and hold harmless Meta from\
|
106 |
+
\ and against any claim by any third party arising out of or related to your use\
|
107 |
+
\ or distribution of the Llama Materials.\n6\\. **Term and Termination**. The term\
|
108 |
+
\ of this Agreement will commence upon your acceptance of this Agreement or access\
|
109 |
+
\ to the Llama Materials and will continue in full force and effect until terminated\
|
110 |
+
\ in accordance with the terms and conditions herein. Meta may terminate this Agreement\
|
111 |
+
\ if you are in breach of any term or condition of this Agreement. Upon termination\
|
112 |
+
\ of this Agreement, you shall delete and cease use of the Llama Materials. Sections\
|
113 |
+
\ 3, 4 and 7 shall survive the termination of this Agreement. \n7\\. **Governing\
|
114 |
+
\ Law and Jurisdiction**. This Agreement will be governed and construed under the\
|
115 |
+
\ laws of the State of California without regard to choice of law principles, and\
|
116 |
+
\ the UN Convention on Contracts for the International Sale of Goods does not apply\
|
117 |
+
\ to this Agreement. The courts of California shall have exclusive jurisdiction\
|
118 |
+
\ of any dispute arising out of this Agreement."
|
119 |
extra_gated_fields:
|
120 |
First Name: text
|
121 |
Last Name: text
|
|
|
132 |
- Reporter
|
133 |
- Other
|
134 |
geo: ip_location
|
135 |
+
? By clicking Submit below I accept the terms of the license and acknowledge that
|
136 |
+
the information I provide will be collected stored processed and shared in accordance
|
137 |
+
with the Meta Privacy Policy
|
138 |
+
: checkbox
|
139 |
+
extra_gated_description: The information you provide will be collected, stored, processed
|
140 |
+
and shared in accordance with the [Meta Privacy Policy](https://www.facebook.com/privacy/policy/).
|
141 |
extra_gated_button_content: Submit
|
142 |
+
extra_gated_heading: Please be sure to provide your full legal name, date of birth,
|
143 |
+
and full organization name with all corporate identifiers. Avoid the use of acronyms
|
144 |
+
and special characters. Failure to follow these instructions may prevent you from
|
145 |
+
accessing this model and others on Hugging Face. You will not have the ability to
|
146 |
+
edit this form after submission, so please ensure all information is accurate.
|
147 |
license: other
|
148 |
license_name: llama4
|
149 |
---
|
chat_template.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"chat_template": "{{- bos_token }}\n{%- if custom_tools is defined %}\n {%- set tools = custom_tools %}\n{%- endif %}\n{%- if not tools_in_user_message is defined %}\n {%- set tools_in_user_message = true %}\n{%- endif %}\n{%- if not date_string is defined %}\n {%- if strftime_now is defined %}\n {%- set date_string = strftime_now(\"%d %b %Y\") %}\n {%- else %}\n {%- set date_string = \"26 Jul 2024\" %}\n {%- endif %}\n{%- endif %}\n{%- if not tools is defined %}\n {%- set tools = none %}\n{%- endif %}\n\n{#- This block extracts the system message, so we can slot it into the right place. #}\n{%- if messages[0]['role'] == 'system' %} \n {%- if messages[0]['content'] is string %}\n {%- set system_message = messages[0]['content']|trim %}\n {%- else %}\n {#- FIXME: The processor requires an array, always. #}\n {%- set system_message = messages[0]['content'][0]['text']|trim %}\n {%- endif %}\n {%- set messages = messages[1:] %}\n {%- set user_supplied_system_message = true %}\n{%- else %}\n {%- set system_message = \"\" %}\n {%- set user_supplied_system_message = false %}\n{%- endif %}\n\n{#- System message if the user supplied one #}\n{%- if user_supplied_system_message %}\n {{- \"<|header_start|>system<|header_end|>\\n\\n\" }}\n {%- if tools is not none %}\n {{- \"Environment: ipython\\n\" }}\n {%- endif %}\n {%- if tools is not none and not tools_in_user_message %}\n {{- \"You have access to the following functions. To call a function, please respond with JSON for a function call.\" }}\n {{- 'Respond in the format {\"name\": function name, \"parameters\": dictionary of argument name and its value}.' }}\n {{- \"Do not use variables.\\n\\n\" }}\n {%- for t in tools %}\n {{- t | tojson(indent=4) }}\n {{- \"\\n\\n\" }}\n {%- endfor %}\n {%- endif %}\n {{- system_message }}\n {{- \"<|eot|>\" }}\n{%- endif %}\n\n{#- Custom tools are passed in a user message with some extra guidance #}\n{%- if tools_in_user_message and not tools is none %}\n {#- Extract the first user message so we can plug it in here #}\n {%- if messages | length != 0 %}\n {%- set first_user_message = messages[0]['content']|trim %}\n {%- set messages = messages[1:] %}\n {%- else %}\n {{- raise_exception(\"Cannot put tools in the first user message when there's no first user message!\") }}\n{%- endif %}\n {{- '<|header_start|>user<|header_end|>\\n\\n' -}}\n {{- \"Given the following functions, please respond with a JSON for a function call \" }}\n {{- \"with its proper arguments that best answers the given prompt.\\n\\n\" }}\n {{- 'Respond in the format {\"name\": function name, \"parameters\": dictionary of argument name and its value}.' }}\n {{- \"Do not use variables.\\n\\n\" }}\n {%- for t in tools %}\n {{- t | tojson(indent=4) }}\n {{- \"\\n\\n\" }}\n {%- endfor %}\n {{- first_user_message + \"<|eot|>\"}}\n{%- endif %}\n\n{%- for message in messages %}\n {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}\n {{- '<|header_start|>' + message['role'] + '<|header_end|>\\n\\n' }}\n {%- if message['content'] is string %}\n {{- message['content'] }}\n {%- else %}\n {%- for content in message['content'] %}\n {%- if content['type'] == 'image' %}\n {{- '<|image|>' }}\n {%- elif content['type'] == 'text' %}\n {{- content['text'] }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- \"<|eot|>\" }}\n {%- elif 'tool_calls' in message and message.tool_calls|length > 0 %}\n {{- '<|header_start|>assistant<|header_end|>\\n\\n' -}}\n {{- '<|python_start|>' }}\n {%- if message['content'] is string %}\n {{- message['content'] }}\n {%- else %}\n {%- for content in message['content'] %}\n {%- if content['type'] == 'image' %}\n {{- '<|image|>' }}\n {%- elif content['type'] == 'text' %}\n {{- content['text'] }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|python_end|>' }}\n {%- for tool_call in message.tool_calls %}\n {{- '{\"name\": \"' + tool_call.function.name + '\", ' }}\n {{- '\"parameters\": ' }}\n {{- tool_call.function.arguments | tojson }}\n {{- \"}\" }}\n {%- endfor %}\n {{- \"<|eot|>\" }}\n {%- elif message.role == \"tool\" or message.role == \"ipython\" %}\n {{- \"<|header_start|>ipython<|header_end|>\\n\\n\" }}\n {%- if message.content is mapping or message.content is iterable %}\n {{- message.content | tojson }}\n {%- else %}\n {{- message.content }}\n {%- endif %}\n {{- \"<|eot|>\" }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|header_start|>assistant<|header_end|>\\n\\n' }}\n{%- endif %}\n"
|
3 |
+
}
|
preprocessor_config.json
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"crop_size": null,
|
3 |
+
"data_format": "channels_first",
|
4 |
+
"default_to_square": true,
|
5 |
+
"device": null,
|
6 |
+
"do_center_crop": null,
|
7 |
+
"do_convert_rgb": true,
|
8 |
+
"do_normalize": true,
|
9 |
+
"do_rescale": true,
|
10 |
+
"do_resize": true,
|
11 |
+
"image_mean": [
|
12 |
+
0.5,
|
13 |
+
0.5,
|
14 |
+
0.5
|
15 |
+
],
|
16 |
+
"image_processor_type": "Llama4ImageProcessorFast",
|
17 |
+
"image_std": [
|
18 |
+
0.5,
|
19 |
+
0.5,
|
20 |
+
0.5
|
21 |
+
],
|
22 |
+
"input_data_format": null,
|
23 |
+
"max_patches": 16,
|
24 |
+
"processor_class": "Llama4Processor",
|
25 |
+
"resample": 2,
|
26 |
+
"rescale_factor": 0.00392156862745098,
|
27 |
+
"resize_to_max_canvas": false,
|
28 |
+
"return_tensors": null,
|
29 |
+
"size": {
|
30 |
+
"height": 336,
|
31 |
+
"width": 336
|
32 |
+
}
|
33 |
+
}
|
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 |
+
}
|