初始化项目,由ModelHub XC社区提供模型
Model: tiiuae/Falcon3-10B-Base-1.58bit-prequantized Source: Original Platform
This commit is contained in:
50
.gitattributes
vendored
Normal file
50
.gitattributes
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.db* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ark* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
**/*ckpt*data* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
**/*ckpt*.meta filter=lfs diff=lfs merge=lfs -text
|
||||||
|
**/*ckpt*.index filter=lfs diff=lfs merge=lfs -text
|
||||||
|
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gguf* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ggml filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.llamafile* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
|
||||||
|
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
||||||
|
model.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
135
README.md
Normal file
135
README.md
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
|
||||||
|
---
|
||||||
|
library_name: transformers
|
||||||
|
tags:
|
||||||
|
- bitnet
|
||||||
|
- falcon3
|
||||||
|
base_model: tiiuae/Falcon3-10B-Base
|
||||||
|
license: other
|
||||||
|
license_name: falcon-llm-license
|
||||||
|
license_link: https://falconllm.tii.ae/falcon-terms-and-conditions.html
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
# Table of Contents
|
||||||
|
|
||||||
|
0. [TL;DR](#TL;DR)
|
||||||
|
1. [Model Details](#model-details)
|
||||||
|
2. [Training Details](#training-details)
|
||||||
|
3. [Usage](#usage)
|
||||||
|
4. [Evaluation](#evaluation)
|
||||||
|
5. [Citation](#citation)
|
||||||
|
|
||||||
|
|
||||||
|
# TL;DR
|
||||||
|
|
||||||
|
# Model Details
|
||||||
|
|
||||||
|
This is a 'hacked' version of `tiiuae/Falcon3-10B-Base-1.58bit` where model weight scales have been injected into ternary model weights in order to make the model compatible with fine-tuning
|
||||||
|
|
||||||
|
## Model Description
|
||||||
|
|
||||||
|
- **Developed by:** [https://www.tii.ae](https://www.tii.ae)
|
||||||
|
- **Model type:** Causal decoder-only
|
||||||
|
- **Architecture:** Pure-transformer - 1.58bit version
|
||||||
|
- **Language(s) (NLP):** Mainly English
|
||||||
|
- **License:** TII Falcon License 2.0
|
||||||
|
|
||||||
|
# Training details
|
||||||
|
|
||||||
|
The model has been trained following the training strategies from the recent [1-bit LLM HF blogpost](https://huggingface.co/blog/1_58_llm_extreme_quantization) and [1-bit LLM paper](https://huggingface.co/papers/2402.17764).
|
||||||
|
For more details about the training protocol of this model, please refer to the Falcon-3 technical report, section *Compression*.
|
||||||
|
|
||||||
|
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
Currently to use this model you can either rely on Hugging Face transformers library or [BitNet](https://github.com/microsoft/BitNet) library. You can also play with the model using the [falcon-1.58bit playground](https://huggingface.co/spaces/tiiuae/falcon3-1.58bit-playground) (only for the 7B instruct version).
|
||||||
|
|
||||||
|
## 🤗 transformers
|
||||||
|
|
||||||
|
```python
|
||||||
|
import torch
|
||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
|
||||||
|
model_id = "tiiuae/Falcon3-10B-Base-1.58bit"
|
||||||
|
|
||||||
|
model = AutoModelForCausalLM.from_pretrained(
|
||||||
|
model_id,
|
||||||
|
torch_dtype=torch.bfloat16,
|
||||||
|
).to("cuda")
|
||||||
|
|
||||||
|
# Perform text generation
|
||||||
|
```
|
||||||
|
|
||||||
|
## BitNet
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/microsoft/BitNet && cd BitNet
|
||||||
|
pip install -r requirements.txt
|
||||||
|
python setup_env.py --hf-repo tiiuae/Falcon3-10B-Base-1.58bit -q i2_s
|
||||||
|
python run_inference.py -m models/Falcon3-10B-1.58bit/ggml-model-i2_s.gguf -p "You are a helpful assistant" -cnv
|
||||||
|
```
|
||||||
|
|
||||||
|
# Evaluation
|
||||||
|
We report in the following table our internal pipeline benchmarks:
|
||||||
|
|
||||||
|
**Note evaluation results are normalized score from v2 leaderboard tasks - reported results of original models in the blogpost are raw scores**
|
||||||
|
|
||||||
|
<table border="1" style="width: 100%; text-align: center; border-collapse: collapse;">
|
||||||
|
<colgroup>
|
||||||
|
<col style="width: 10%;">
|
||||||
|
<col style="width: 10%;">
|
||||||
|
<col style="background-color: rgba(80, 15, 213, 0.5); width: 7%;">
|
||||||
|
</colgroup>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Benchmark</th>
|
||||||
|
<th>Llama3-8B-1.58-100B-tokens</th>
|
||||||
|
<th>Falcon3-10B-Base-1.58bit</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>IFEval</td>
|
||||||
|
<td>17.91</td>
|
||||||
|
<td><b>24.89</b></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>MUSR</td>
|
||||||
|
<td><b>4.87</b></td>
|
||||||
|
<td>4.6</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>GPQA</td>
|
||||||
|
<td>1.83</td>
|
||||||
|
<td>1.83</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>BBH</td>
|
||||||
|
<td><b>5.36</b></td>
|
||||||
|
<td>4.44</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>MMLU-PRO</td>
|
||||||
|
<td><b>2.78</b></td>
|
||||||
|
<td>1.36</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>MATH</td>
|
||||||
|
<td>0.26</td>
|
||||||
|
<td><b>0.48</b></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Average</td>
|
||||||
|
<td>5.5</td>
|
||||||
|
<td><b>6.27</b></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
# Citation
|
||||||
|
|
||||||
|
Coming soon ..
|
||||||
90
chat_template.jinja
Normal file
90
chat_template.jinja
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
{# ================= SYSTEM PROMPT ================= #}
|
||||||
|
{%- if messages and messages[0]['role'] == 'system' %}
|
||||||
|
{%- set system_msg = messages[0]['content'] %}
|
||||||
|
{%- set remaining_messages = messages[1:] %}
|
||||||
|
{%- elif messages and messages[0]['role'] == 'developer' %}
|
||||||
|
{%- set system_msg = messages[0]['content'] %}
|
||||||
|
{%- set remaining_messages = messages[1:] %}
|
||||||
|
{%- else %}
|
||||||
|
{%- set system_msg = "You are Falcon, a helpful AI assistant created by Technology Innovation Institute (TII)." %}
|
||||||
|
{%- set remaining_messages = messages %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- if tools %}
|
||||||
|
<|im_start|>system
|
||||||
|
{{ system_msg }}
|
||||||
|
# Tools
|
||||||
|
You may call one or more functions to assist with the user query.
|
||||||
|
<tools>
|
||||||
|
{%- for tool in tools %}
|
||||||
|
{{ tool | tojson }}
|
||||||
|
{%- endfor %}
|
||||||
|
</tools>
|
||||||
|
<|im_end|>
|
||||||
|
{%- else %}
|
||||||
|
<|im_start|>system
|
||||||
|
{{ system_msg }}
|
||||||
|
<|im_end|>
|
||||||
|
{%- endif %}
|
||||||
|
{# ================= FIND LAST USER QUERY ================= #}
|
||||||
|
{%- set ns = namespace(multi_step_tool=true, last_query_index=remaining_messages|length - 1) %}
|
||||||
|
{%- for message in remaining_messages %}
|
||||||
|
{%- if message.role == "user" %}
|
||||||
|
{%- set ns.last_query_index = loop.index0 %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{# ================= RENDER MESSAGES ================= #}
|
||||||
|
{%- for message in remaining_messages %}
|
||||||
|
{# ---- Normalize content to string ---- #}
|
||||||
|
{%- set content = message.get('content', '') %}
|
||||||
|
{%- set reasoning_content = message.get('reasoning_content', none) %}
|
||||||
|
{%- if content is string %}
|
||||||
|
{%- set content_str = content %}
|
||||||
|
{%- elif content is not none %}
|
||||||
|
{%- set ns_content = namespace(text='') %}
|
||||||
|
{%- for item in content if item.type == 'text' %}
|
||||||
|
{%- set ns_content.text = ns_content.text ~ item.text %}
|
||||||
|
{%- endfor %}
|
||||||
|
{%- set content_str = ns_content.text %}
|
||||||
|
{%- endif %}
|
||||||
|
{# ================= USER ================= #}
|
||||||
|
{%- if message.role in ['user', 'human'] %}
|
||||||
|
|
||||||
|
<|im_start|>user
|
||||||
|
{{ content_str }}<|im_end|>
|
||||||
|
{%- elif message.role in ['assistant', 'gpt', 'function_call'] %}
|
||||||
|
|
||||||
|
<|im_start|>assistant
|
||||||
|
{%- if reasoning_content is string %}
|
||||||
|
{{ "\n<think>" ~ reasoning_content ~ "</think>" }}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{{ content_str }}
|
||||||
|
{%- if message.tool_calls %}
|
||||||
|
{%- for tool_call in message.tool_calls %}
|
||||||
|
{%- if tool_call.function is defined %}
|
||||||
|
{%- set tool_call = tool_call.function %}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
<tool_call>
|
||||||
|
{"name": "{{ tool_call.name }}", "arguments": {{ tool_call.arguments if tool_call.arguments is string else (tool_call.arguments | tojson) }}}
|
||||||
|
</tool_call>
|
||||||
|
{%- endfor %}
|
||||||
|
{%- endif %}
|
||||||
|
<|im_end|>
|
||||||
|
{%- elif message.role == 'tool' %}
|
||||||
|
|
||||||
|
<|im_start|>user
|
||||||
|
<tool_response>
|
||||||
|
{{ content_str }}
|
||||||
|
</tool_response><|im_end|>
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{# ================= GENERATION PROMPT ================= #}
|
||||||
|
{%- if add_generation_prompt %}
|
||||||
|
|
||||||
|
<|im_start|>assistant
|
||||||
|
{%- if enable_thinking is defined and enable_thinking is false %}
|
||||||
|
{{- "\n<think></think>" }}
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
|
{%- endif %}
|
||||||
33
config.json
Normal file
33
config.json
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"architectures": [
|
||||||
|
"LlamaForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_bias": false,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"dtype": "bfloat16",
|
||||||
|
"eos_token_id": 11,
|
||||||
|
"head_dim": 256,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 3072,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 23040,
|
||||||
|
"is_bitnet_config": true,
|
||||||
|
"max_position_embeddings": 32768,
|
||||||
|
"mlp_bias": false,
|
||||||
|
"model_type": "llama",
|
||||||
|
"num_attention_heads": 12,
|
||||||
|
"num_hidden_layers": 40,
|
||||||
|
"num_key_value_heads": 4,
|
||||||
|
"pad_token_id": null,
|
||||||
|
"pretraining_tp": 1,
|
||||||
|
"rms_norm_eps": 1e-06,
|
||||||
|
"rope_parameters": {
|
||||||
|
"rope_theta": 1000042,
|
||||||
|
"rope_type": "default"
|
||||||
|
},
|
||||||
|
"tie_word_embeddings": false,
|
||||||
|
"transformers_version": "5.5.0",
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 131072
|
||||||
|
}
|
||||||
1
configuration.json
Normal file
1
configuration.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"framework": "pytorch", "task": "text-generation", "allow_remote": true}
|
||||||
9
generation_config.json
Normal file
9
generation_config.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"_from_model_config": true,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"eos_token_id": 11,
|
||||||
|
"output_attentions": false,
|
||||||
|
"output_hidden_states": false,
|
||||||
|
"transformers_version": "5.5.0",
|
||||||
|
"use_cache": true
|
||||||
|
}
|
||||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:bdc5e0d178f149b5e4ee0209eb2f627af1f93f2ea8cddb087729371f548cdc89
|
||||||
|
size 20611350200
|
||||||
3
tokenizer.json
Normal file
3
tokenizer.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:3aba27c4298f23f82157a1ab646db95bec23f6aebcb4056ee323229064fc5591
|
||||||
|
size 9781129
|
||||||
14
tokenizer_config.json
Normal file
14
tokenizer_config.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"add_prefix_space": false,
|
||||||
|
"backend": "tokenizers",
|
||||||
|
"clean_up_tokenization_spaces": true,
|
||||||
|
"eos_token": "<|endoftext|>",
|
||||||
|
"is_local": true,
|
||||||
|
"model_input_names": [
|
||||||
|
"input_ids",
|
||||||
|
"attention_mask"
|
||||||
|
],
|
||||||
|
"model_max_length": 131072,
|
||||||
|
"pad_token": "<|endoftext|>",
|
||||||
|
"tokenizer_class": "TokenizersBackend"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user