Commit ·
fd895a7
0
Parent(s):
Duplicate from FastFlowLM/Llama-3.1-8B-NPU2
Browse filesCo-authored-by: FastFlowLM <FastFlowLM@users.noreply.huggingface.co>
- .gitattributes +7 -0
- README.md +67 -0
- attn.xclbin +3 -0
- config.json +45 -0
- dequant.xclbin +3 -0
- layer.xclbin +3 -0
- lm_head.xclbin +3 -0
- mm.xclbin +3 -0
- model.q4nx +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +12 -0
.gitattributes
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model.q4nx filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
layer.xclbin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
lm_head.xclbin filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
attn.xclbin filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
dequant.xclbin filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
mm.xclbin filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: llama3
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- llama
|
| 7 |
+
- llama-3.1
|
| 8 |
+
- text-generation
|
| 9 |
+
- AMD
|
| 10 |
+
- Ryzen
|
| 11 |
+
- NPU
|
| 12 |
+
pipeline_tag: text-generation
|
| 13 |
+
base_model:
|
| 14 |
+
- meta-llama/Llama-3.1-8B-Instruct
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# 🦙 LLaMA 3.1 (8B) – Optimized for FastFlowLM on AMD Ryzen™ AI NPU (XDNA2 Only)
|
| 18 |
+
|
| 19 |
+
## Model Summary
|
| 20 |
+
This is a derivative of Meta AI’s LLaMA 3.1 base model. The model retains the core architecture and weights from Meta’s release and may include fine-tuning, quantization, or adaptation for specific applications.
|
| 21 |
+
|
| 22 |
+
> ⚠️ **This model is subject to Meta’s LLaMA 3 license. You must accept Meta’s terms to use or download it.**
|
| 23 |
+
|
| 24 |
+
## 📝 License & Usage Terms
|
| 25 |
+
|
| 26 |
+
### Meta LLaMA 3 License
|
| 27 |
+
- Base model is governed by Meta AI's license:
|
| 28 |
+
👉 https://ai.meta.com/llama/license/
|
| 29 |
+
|
| 30 |
+
- You must agree to their license terms to access and use the weights, which include:
|
| 31 |
+
- No commercial use without permission
|
| 32 |
+
- Redistribution only allowed under specific conditions
|
| 33 |
+
- Attribution required
|
| 34 |
+
|
| 35 |
+
### Redistribution Notice
|
| 36 |
+
- This repository does **not** include original Meta weights.
|
| 37 |
+
- You must obtain base weights directly from Meta:
|
| 38 |
+
👉 https://huggingface.co/meta-llama
|
| 39 |
+
|
| 40 |
+
### If Fine-tuned
|
| 41 |
+
If this model has been fine-tuned, the downstream weights are provided under the following conditions:
|
| 42 |
+
|
| 43 |
+
- **Base Model License**: Meta’s LLaMA 3 License
|
| 44 |
+
- **Derivative Weights License**: [e.g., CC-BY-NC-4.0, MIT, custom, etc.]
|
| 45 |
+
- **Training Dataset License(s)**:
|
| 46 |
+
- [Dataset A] – [license]
|
| 47 |
+
- [Dataset B] – [license]
|
| 48 |
+
|
| 49 |
+
Make sure you have rights to use and distribute any data used in fine-tuning.
|
| 50 |
+
|
| 51 |
+
## Intended Use
|
| 52 |
+
- **Use Cases**: Research, experimentation, academic NLP, code generation (if applicable)
|
| 53 |
+
- **Not Intended For**: Use in production systems without further evaluation, sensitive applications, or commercial deployments without Meta’s explicit permission
|
| 54 |
+
|
| 55 |
+
## Limitations & Risks
|
| 56 |
+
- May generate incorrect or harmful content
|
| 57 |
+
- Does not have knowledge past its training cutoff
|
| 58 |
+
- Biases in training data may persist
|
| 59 |
+
|
| 60 |
+
## Citation
|
| 61 |
+
```bibtex
|
| 62 |
+
@misc{touvron2024llama3,
|
| 63 |
+
title={LLaMA 3: Open Foundation and Instruction Models},
|
| 64 |
+
author={Touvron, Hugo and others},
|
| 65 |
+
year={2024},
|
| 66 |
+
url={https://ai.meta.com/llama/}
|
| 67 |
+
}
|
attn.xclbin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cb8e7bef68c19797d9f57c163ba8943fa3bd474af6c9e82c0c4a7554852afd4a
|
| 3 |
+
size 698331
|
config.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LlamaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 128000,
|
| 8 |
+
"eos_token_id": [
|
| 9 |
+
128001,
|
| 10 |
+
128008,
|
| 11 |
+
128009
|
| 12 |
+
],
|
| 13 |
+
"head_dim": 128,
|
| 14 |
+
"hidden_act": "silu",
|
| 15 |
+
"hidden_size": 4096,
|
| 16 |
+
"initializer_range": 0.02,
|
| 17 |
+
"intermediate_size": 14336,
|
| 18 |
+
"max_position_embeddings": 131072,
|
| 19 |
+
"mlp_bias": false,
|
| 20 |
+
"model_type": "llama",
|
| 21 |
+
"num_attention_heads": 32,
|
| 22 |
+
"num_hidden_layers": 32,
|
| 23 |
+
"num_key_value_heads": 8,
|
| 24 |
+
"pretraining_tp": 1,
|
| 25 |
+
"rms_norm_eps": 1e-05,
|
| 26 |
+
"rope_scaling": {
|
| 27 |
+
"factor": 8.0,
|
| 28 |
+
"high_freq_factor": 4.0,
|
| 29 |
+
"low_freq_factor": 1.0,
|
| 30 |
+
"original_max_position_embeddings": 8192,
|
| 31 |
+
"rope_type": "llama3"
|
| 32 |
+
},
|
| 33 |
+
"rope_theta": 500000.0,
|
| 34 |
+
"tie_word_embeddings": false,
|
| 35 |
+
"torch_dtype": "float32",
|
| 36 |
+
"transformers_version": "4.52.0.dev0",
|
| 37 |
+
"use_cache": true,
|
| 38 |
+
"vocab_size": 128256,
|
| 39 |
+
"addr_qk": 9216,
|
| 40 |
+
"addr_kv": 34816,
|
| 41 |
+
"addr_l_begin_mha": 54272,
|
| 42 |
+
"addr_l_end_mha": 25600,
|
| 43 |
+
"addr_kk": 45056,
|
| 44 |
+
"flm_version": "0.9.21"
|
| 45 |
+
}
|
dequant.xclbin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:171e48055c262c07e7232be872e1a7a4ae92a1158ab8a1d455bb4d61c2a7fd3c
|
| 3 |
+
size 115691
|
layer.xclbin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:da989ed295cbd49c07b185ba99ab867da07eff6cc44bc8f9f452b0b0ff0389bd
|
| 3 |
+
size 331659
|
lm_head.xclbin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6d2ebc16daf6a75e4bdefa499fccccc2bafd7c122bf4a1c3e73d66e8538f592d
|
| 3 |
+
size 152843
|
mm.xclbin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b1e88cd899e3fbef3b402ecaf2ab644f21cca2ee85dafe6e2521d89222c5a644
|
| 3 |
+
size 347675
|
model.q4nx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0c03021f1cd21e43376234817b34ad32ccf07dca94785ede7640833d15169d8a
|
| 3 |
+
size 5741650592
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:79e3e522635f3171300913bb421464a87de6222182a0570b9b2ccba2a964b2b4
|
| 3 |
+
size 9085657
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": "<|begin_of_text|>",
|
| 3 |
+
"eos_token": "<|eot_id|>",
|
| 4 |
+
"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 {%- set system_message = messages[0]['content']|trim %}\n {%- set messages = messages[1:] %}\n{%- else %}\n {%- if user_system_prompt is defined %}{%- set system_message = user_system_prompt %} {%- else %} {%- set system_message = \"\" %}\n{%- endif %}\n{%- endif %}\n\n{#- System message #}\n{{- \"<|start_header_id|>system<|end_header_id|>\\n\\n\" }}\n{%- if tools is not none %}\n {{- \"Environment: ipython\\n\" }}\n{%- endif %}\n{{- \"Cutting Knowledge Date: December 2023\\n\" }}\n{{- \"Today Date: \" + date_string + \"\\n\\n\" }}\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_id|>\" }}\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 {{- '<|start_header_id|>user<|end_header_id|>\\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_id|>\"}}\n{%- endif %}\n\n{%- for message in messages %}\n {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}\n {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\\n\\n'+ message['content'] | trim + '<|eot_id|>' }}\n {%- elif 'tool_calls' in message %}\n {%- if not message.tool_calls|length == 1 %}\n {{- raise_exception(\"This model only supports single tool-calls at once!\") }}\n {%- endif %}\n {%- set tool_call = message.tool_calls[0].function %}\n {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' -}}\n {{- '{\"name\": \"' + tool_call.name + '\", ' }}\n {{- '\"parameters\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- \"}\" }}\n {{- \"<|eot_id|>\" }}\n {%- elif message.role == \"tool\" or message.role == \"ipython\" %}\n {{- \"<|start_header_id|>ipython<|end_header_id|>\\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_id|>\" }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' }}\n{%- endif %}\n",
|
| 5 |
+
"model_max_length": 131072,
|
| 6 |
+
"bos_token_id": 128000,
|
| 7 |
+
"eos_token_id": [
|
| 8 |
+
128001,
|
| 9 |
+
128008,
|
| 10 |
+
128009
|
| 11 |
+
]
|
| 12 |
+
}
|