初始化项目,由ModelHub XC社区提供模型
Model: axolotl-ai-co/Falcon-E-1.2-3B-Exp-prequantized Source: Original Platform
This commit is contained in:
35
.gitattributes
vendored
Normal file
35
.gitattributes
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt 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
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz 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
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl 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
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* 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
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
68
README.md
Normal file
68
README.md
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
---
|
||||||
|
library_name: transformers
|
||||||
|
tags:
|
||||||
|
- axolotl
|
||||||
|
- edge
|
||||||
|
- bitnet
|
||||||
|
license: apache-2.0
|
||||||
|
---
|
||||||
|
|
||||||
|
# Falcon-E-1.2-3B-Exp-prequantized
|
||||||
|
|
||||||
|
This is the model card of `Falcon-E-1.2-3B-Exp`, a ternary (1.58bits) language model trained on SFT agentic, and STEM data using [`axolotl`](https://github.com/axolotl-ai-cloud/axolotl) framework combined with [`onebitllm`](https://github.com/tiiuae/onebitllms) library.
|
||||||
|
|
||||||
|
The model has been trained starting from [`tiiuae/Falcon-E-3B-Base-prequantized`](https://huggingface.co/tiiuae/Falcon-E-3B-Base-prequantized) checkpoint using full-finetuning for 3 epochs. Below are the hyper-parameters used for fine-tuning:
|
||||||
|
|
||||||
|
This model is the prequantized version of [`axolotl-ai-co/Falcon-E-1.2-3B-Exp`](https://huggingface.co/axolotl-ai-co/Falcon-E-1.2-3B-Exp) that can be used for further fine-tuning.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
micro_batch_size: 1
|
||||||
|
num_epochs: 3
|
||||||
|
optimizer: adamw_torch
|
||||||
|
lr_scheduler: cosine
|
||||||
|
learning_rate: 8.0e-4
|
||||||
|
# adamw hyperparams
|
||||||
|
adam_beta1: 0.9
|
||||||
|
adam_beta2: 0.95
|
||||||
|
warmup_steps: 128
|
||||||
|
```
|
||||||
|
|
||||||
|
And we used a context parallel size of `8`.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
The model uses `think` mode by default, this can be disabled and switched to non-thiking mode. You can use the model with different frameworks such as HF `transformers`, `llama.cpp` or `mlx-lm`
|
||||||
|
|
||||||
|
### transformers
|
||||||
|
|
||||||
|
```bash
|
||||||
|
transformers chat axolotl-ai-co/Falcon-E-1.2-3B-Exp
|
||||||
|
```
|
||||||
|
|
||||||
|
### llama.cpp
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# thinking mode
|
||||||
|
llama-cli -m axolotl-ai-co/Falcon-E-1.2-3B-Exp-GGUF:TQ2_0 --reasoning-format auto --temp 0.2 -cnv
|
||||||
|
|
||||||
|
# non thinking mode
|
||||||
|
llama-cli -m axolotl-ai-co/Falcon-E-1.2-3B-Exp-GGUF:TQ2_0 --reasoning-format auto --temp 0.2 -cnv --reasoning-budget 0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
### mlx-lm
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mlx_lm.chat axolotl-ai-co/Falcon-E-1.2-3B-Exp --temperature 0.2
|
||||||
|
```
|
||||||
|
|
||||||
|
## Further fine-tuning the model
|
||||||
|
|
||||||
|
You can further fine-tune this model, or the base model using their prequantized version. Refer to the [`axolotl` config](https://github.com/axolotl-ai-cloud/axolotl-ai-co/tree/main/examples/falcon-e/falcon-e-3b-ft.yaml) to get started on fine-tuning these models:
|
||||||
|
|
||||||
|
- [Base prequantized model](https://huggingface.co/tiiuae/Falcon-E-3B-Base-prequantized)
|
||||||
|
- [`Falcon-E-1.2-3B-Exp` base model](https://huggingface.co/axolotl-ai/Falcon-E-1.2-3B-Exp-prequantized)
|
||||||
|
- [`DPO fine-tuning config`](https://github.com/axolotl-ai-cloud/axolotl-ai-co/tree/main/examples/falcon-e/falcon-e-3b-dpo.yaml)
|
||||||
|
|
||||||
|
## Aknowledgement
|
||||||
|
|
||||||
|
Falcon-E-3B-Chat-Exp models are built using Falcon LLM technology from the [Technology Innovation Institute](https://huggingface.co/tiiuae).
|
||||||
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 %}
|
||||||
32
config.json
Normal file
32
config.json
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"architectures": [
|
||||||
|
"LlamaForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_bias": false,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": null,
|
||||||
|
"dtype": "bfloat16",
|
||||||
|
"eos_token_id": 11,
|
||||||
|
"head_dim": 128,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 2048,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 13312,
|
||||||
|
"max_position_embeddings": 32768,
|
||||||
|
"mlp_bias": false,
|
||||||
|
"model_type": "llama",
|
||||||
|
"num_attention_heads": 16,
|
||||||
|
"num_hidden_layers": 32,
|
||||||
|
"num_key_value_heads": 2,
|
||||||
|
"pad_token_id": 11,
|
||||||
|
"pretraining_tp": 1,
|
||||||
|
"rms_norm_eps": 1e-05,
|
||||||
|
"rope_parameters": {
|
||||||
|
"rope_theta": 1000000,
|
||||||
|
"rope_type": "default"
|
||||||
|
},
|
||||||
|
"tie_word_embeddings": false,
|
||||||
|
"transformers_version": "5.5.0",
|
||||||
|
"use_cache": false,
|
||||||
|
"vocab_size": 32768
|
||||||
|
}
|
||||||
9
generation_config.json
Normal file
9
generation_config.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"_from_model_config": true,
|
||||||
|
"do_sample": true,
|
||||||
|
"eos_token_id": [
|
||||||
|
11
|
||||||
|
],
|
||||||
|
"pad_token_id": 11,
|
||||||
|
"transformers_version": "5.5.0"
|
||||||
|
}
|
||||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:134cd1320c7cb80e355715f5baf7fb3c6e2172b1936e7654fc6f3b5d4a336c7e
|
||||||
|
size 6107206592
|
||||||
165573
tokenizer.json
Normal file
165573
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
9
tokenizer_config.json
Normal file
9
tokenizer_config.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"backend": "tokenizers",
|
||||||
|
"clean_up_tokenization_spaces": true,
|
||||||
|
"eos_token": "<|end_of_text|>",
|
||||||
|
"is_local": true,
|
||||||
|
"model_max_length": 1000000000000000019884624838656,
|
||||||
|
"pad_token": "<|end_of_text|>",
|
||||||
|
"tokenizer_class": "TokenizersBackend"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user