初始化项目,由ModelHub XC社区提供模型

Model: badtheorylabs/Macaw
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-09-08 16:46:16 +08:00
commit 1e783ec18e
9 changed files with 497 additions and 0 deletions

36
.gitattributes vendored Normal file
View File

@@ -0,0 +1,36 @@
*.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
tokenizer.json filter=lfs diff=lfs merge=lfs -text

71
LICENSE Normal file
View File

@@ -0,0 +1,71 @@
LFM Open License v1.0
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by this document.
"Licensor" shall mean Liquid AI, Inc.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work.
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
"Commercial Use" shall mean any use of the Work for direct or indirect commercial advantage or monetary compensation.
"Qualified Non-Profit Organization" shall mean a Legal Entity that is organized and operated exclusively for religious, charitable, scientific, testing for public safety, literary, or educational purposes, and which is exempt from federal income tax under Section 501(c)(3) of the United States Internal Revenue Code of 1986, as amended, or any equivalent non-profit or charitable organization in a foreign jurisdiction.
"Non-Commercial or Research Purposes" shall mean purposes that do not involve any use of the Work or a Derivative Work for Commercial Use.
"Threshold" shall mean annual revenue of 10 million United States dollars ($10,000,000) or more.
2. Grant of Copyright License. Subject to the terms and conditions of this License, including the Commercial Use limitation set forth in Section 5, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, including the Commercial Use limitation set forth in Section 5, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Commercial Use Limitation.
(a) The rights granted under this License for Commercial Use are conditioned upon You or Your Legal Entity not exceeding the Threshold.
(b) Any Commercial Use of the Work or a Derivative Work by a Legal Entity that exceeds the Threshold is not licensed under this Agreement.
(c) The Threshold shall not apply to a Qualified Non-Profit Organization's use of the Work or a Derivative Work for Non-Commercial or Research Purposes.
6. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
7. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except for the reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
8. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
9. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
10. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
11. Termination. This License will terminate automatically and immediately if You fail to comply with any of its terms and conditions. Upon termination, You must cease all use of the Work and any Derivative Works and delete all copies in Your possession.
END OF TERMS AND CONDITIONS

156
README.md Normal file
View File

@@ -0,0 +1,156 @@
---
language:
- en
license: other
library_name: transformers
license_name: lfm-open-license-v1.0
license_link: https://huggingface.co/LiquidAI/LFM2.5-2.6B/raw/main/LICENSE
tags:
- lfm2
- macos
- agent
- tool-calling
- on-device
pipeline_tag: text-generation
base_model: LiquidAI/LFM2.5-2.6B
---
# 🦜 Macaw
**The assistant your Mac should have shipped with.**
Ask for something in plain English and Macaw does it — sends the email, finds the
file, reads the PDF, tells you what's eating your battery. It runs entirely on
your Mac. Nothing is uploaded, nothing is logged, and there is no account to
make.
Available today. Not a waitlist.
👉 **[badtheorylabs.com/macaw](https://badtheorylabs.com/macaw)**
---
## What you can say to it
```
"email ada the q3 numbers and tell her i approved"
"why is my mac slow?"
"read ~/Documents/contract.pdf and summarise it in two sentences"
"take a screenshot, make a folder called Shots, and move it there"
"what's on my screen?"
"am i free tomorrow afternoon?"
"find my biggest files"
```
It chains steps on its own. *"Take a screenshot, make a folder, move it there"*
is three actions from one sentence, and it checks each one worked before moving
to the next.
---
## What it can reach
**97 tools**, each one hand-written and tested — not a scrape of every command
macOS exposes.
| | |
|---|---|
| ✉️ **Mail** | send, search, reply, unread counts, senders |
| 📅 **Calendar** | create events, today's schedule, free slots, next meeting's video link |
| 📁 **Files** | Spotlight search, open, move, folder sizes, biggest files, old downloads |
| 📝 **Notes & Reminders** | create, append, search, complete, overdue |
| 🎵 **Music** | play, pause, skip, by artist, by playlist, shuffle |
| 🌐 **Safari & Chrome** | current tab, all tabs, open, search |
| 🖥️ **System** | battery, disk, wifi, brightness, dark mode, volume, focus, lock, sleep |
| 👀 **Screen** | read what's on screen, record it, screenshot it |
| 📄 **Documents** | read and summarise PDFs, Word files, code, plain text |
| ⚡️ **Diagnostics** | what's using CPU, what's eating memory, battery health |
---
## Private by construction
Not a policy — an architecture. The model weighs 1.5 GB and lives on your
machine. There is no server to send anything to.
- No cloud, no API keys, no account
- No telemetry, no analytics, no crash reporting
- Works on a plane
- Your mail, files and calendar never leave the device
---
## Specs
| | |
|---|---|
| **Size** | 2.7B parameters · 1.5 GB on disk (4-bit) |
| **Memory** | ~2 GB while running |
| **Speed** | ~1.2 s per request on an M2 |
| **Context** | 128K tokens |
| **Requires** | Apple Silicon (M1 or later), macOS 14+ |
**Two builds:**
- **[`Macaw-4bit-MLX`](https://huggingface.co/badtheorylabs/Macaw-4bit-MLX)** —
1.5 GB, what the app runs. Start here.
- **`Macaw`** (this repo) — 5.4 GB BF16, for fine-tuning or serving on a GPU.
---
## Run it yourself
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
tok = AutoTokenizer.from_pretrained("badtheorylabs/Macaw")
model = AutoModelForCausalLM.from_pretrained("badtheorylabs/Macaw",
dtype=torch.bfloat16)
messages = [
{"role": "system", "content": "You are Macaw, an on-device assistant running on this Mac."},
{"role": "user", "content": "what's my battery at?"},
]
inputs = tok.apply_chat_template(messages, add_generation_prompt=True,
return_dict=True, return_tensors="pt")
out = model.generate(inputs["input_ids"], max_new_tokens=128)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
```
Pass your tools with `tools=[...]` and it replies with a call:
```
<|tool_call_start|>[battery_status()]<|tool_call_end|>
```
The app in [github.com/Badtheorylabs/Macaw](https://github.com/Badtheorylabs/Macaw)
handles the rest — parsing, running, and asking before anything destructive.
---
## Measured
On an Apple M2, 4-bit build:
| | |
|---|---|
| Tool-call accuracy | **10 / 10** on the capability suite |
| Request latency | **1.21 s** mean · 0.77 s best |
| Decode | ~40 tok/s |
Method and harness are in the [GitHub repo](https://github.com/Badtheorylabs/Macaw).
`model.safetensors` SHA-256
`966d206651b96446f6a4c415d118049f478a8df79be3fa45bfd04959a4d68be0`
---
## License
Weights derive from [LFM2.5-2.6B](https://huggingface.co/LiquidAI/LFM2.5-2.6B)
under the [LFM Open License v1.0](https://huggingface.co/LiquidAI/LFM2.5-2.6B/raw/main/LICENSE).
Redistribution keeps that license and Liquid AI's attribution. Commercial use is
free below $10M annual revenue. The app and tooling are MIT.
© 2026 Bad Theory Labs

125
chat_template.jinja Normal file
View File

@@ -0,0 +1,125 @@
{{- bos_token -}}
{%- set preserve_thinking = preserve_thinking | default(false) -%}
{%- macro format_arg_value(arg_value) -%}
{%- if arg_value is string -%}
{{- "'" + (arg_value | replace("\\", "\\\\") | replace("'", "\\'") | replace("\n", "\\n") | replace("\r", "\\r")) + "'" -}}
{%- elif arg_value is mapping or arg_value is iterable -%}
{{- arg_value | tojson -}}
{%- else -%}
{{- arg_value | string -}}
{%- endif -%}
{%- endmacro -%}
{%- macro parse_content(content) -%}
{%- if content is string -%}
{{- content -}}
{%- elif content is mapping -%}
{{- content | tojson -}}
{%- elif content is iterable -%}
{%- set _ns = namespace(result="") -%}
{%- for item in content -%}
{%- if item is string -%}
{%- set _ns.result = _ns.result + item -%}
{%- elif item is mapping and item.get("type") == "image" -%}
{%- set _ns.result = _ns.result + "<image>" -%}
{%- elif item is mapping and item.get("type") == "text" -%}
{%- set _ns.result = _ns.result + ((item.get("text") or "") | string) -%}
{%- else -%}
{%- set _ns.result = _ns.result + (item | tojson) -%}
{%- endif -%}
{%- endfor -%}
{{- _ns.result -}}
{%- endif -%}
{%- endmacro -%}
{%- macro render_tool_calls(tool_calls) -%}
{%- set tool_calls_ns = namespace(tool_calls=[]) -%}
{%- for tool_call in tool_calls -%}
{%- set func = tool_call["function"] if "function" in tool_call else tool_call -%}
{%- set func_name = func["name"] -%}
{%- set func_args = func.get("arguments") -%}
{%- set args_ns = namespace(arg_strings=[]) -%}
{%- if func_args is mapping -%}
{%- for arg_name, arg_value in func_args.items() -%}
{%- set args_ns.arg_strings = args_ns.arg_strings + [arg_name + "=" + format_arg_value(arg_value)] -%}
{%- endfor -%}
{%- elif func_args is string and (func_args | trim) not in ["", "{}", "null"] -%}
{{- raise_exception("Tool call arguments must be a mapping, got a JSON-encoded string: parse arguments with json.loads() before applying the chat template") -}}
{%- endif -%}
{%- set tool_calls_ns.tool_calls = tool_calls_ns.tool_calls + [func_name + "(" + (args_ns.arg_strings | join(", ")) + ")"] -%}
{%- endfor -%}
{{- "<|tool_call_start|>[" + (tool_calls_ns.tool_calls | join(", ")) + "]<|tool_call_end|>" -}}
{%- endmacro -%}
{%- set ns = namespace(system_prompt="", last_user_index=-1) -%}
{%- if messages and messages[0]["role"] == "system" -%}
{%- if messages[0].get("content") -%}
{%- set ns.system_prompt = parse_content(messages[0]["content"]) -%}
{%- endif -%}
{%- set messages = messages[1:] -%}
{%- endif -%}
{%- if tools -%}
{%- set ns.system_prompt = ns.system_prompt + ("\n" if ns.system_prompt else "") + "List of tools: [" -%}
{%- for tool in tools -%}
{%- if tool is not string -%}
{%- set tool = tool | tojson -%}
{%- endif -%}
{%- set ns.system_prompt = ns.system_prompt + tool -%}
{%- if not loop.last -%}
{%- set ns.system_prompt = ns.system_prompt + ", " -%}
{%- endif -%}
{%- endfor -%}
{%- set ns.system_prompt = ns.system_prompt + "]" -%}
{%- endif -%}
{%- if ns.system_prompt -%}
{{- "<|im_start|>system\n" + ns.system_prompt + "<|im_end|>\n" -}}
{%- endif -%}
{%- for message in messages -%}
{%- if message["role"] == "user" -%}
{%- set ns.last_user_index = loop.index0 -%}
{%- endif -%}
{%- endfor -%}
{%- for message in messages -%}
{{- "<|im_start|>" + message.role + "\n" -}}
{%- if message.role == "assistant" -%}
{%- generation -%}
{%- set keep_thinking = preserve_thinking or loop.index0 > ns.last_user_index -%}
{%- set thinking = message.thinking or message.reasoning or message.reasoning_content -%}
{%- set thinking = thinking if thinking is string else "" -%}
{%- if thinking and keep_thinking -%}
{{- "<think>" + thinking + "</think>" -}}
{%- endif -%}
{%- set _cfm_tag = "CONTINUE_FINAL_MESSAGE_TAG " -%}
{%- set _has_cfm = false -%}
{%- set content = "" -%}
{%- if message.get("content") -%}
{%- set content = parse_content(message.content) -%}
{%- endif -%}
{%- if not keep_thinking and "</think>" in content -%}
{%- set content = content.split("</think>")[-1] | trim -%}
{%- endif -%}
{%- if content.endswith(_cfm_tag) -%}
{%- set _has_cfm = true -%}
{%- set _trunc_len = (content | length) - (_cfm_tag | length) -%}
{%- set content = content[:_trunc_len] -%}
{%- endif -%}
{{- content -}}
{%- if message.tool_calls -%}
{{- render_tool_calls(message.tool_calls) -}}
{%- endif -%}
{%- if _has_cfm -%}
{{- _cfm_tag -}}
{%- endif -%}
{{- "<|im_end|>\n" -}}
{%- endgeneration -%}
{%- else %}
{%- if message.get("content") -%}
{{- parse_content(message["content"]) -}}
{%- endif -%}
{{- "<|im_end|>\n" -}}
{%- endif %}
{%- endfor -%}
{%- if add_generation_prompt -%}
{{- "<|im_start|>assistant\n<think>" -}}
{%- endif -%}

76
config.json Normal file
View File

@@ -0,0 +1,76 @@
{
"architectures": [
"Lfm2ForCausalLM"
],
"block_auto_adjust_ff_dim": false,
"block_dim": 2048,
"block_ffn_dim_multiplier": 1.0,
"block_mlp_init_scale": 1.0,
"block_multiple_of": 256,
"block_norm_eps": 1e-05,
"block_out_init_scale": 1.0,
"block_use_swiglu": true,
"block_use_xavier_init": true,
"bos_token_id": 124894,
"conv_L_cache": 3,
"conv_bias": false,
"conv_dim": 2048,
"conv_use_xavier_init": true,
"dtype": "bfloat16",
"eos_token_id": 124900,
"full_attn_idxs": null,
"hidden_size": 2048,
"initializer_range": 0.02,
"intermediate_size": 10752,
"layer_types": [
"conv",
"conv",
"full_attention",
"conv",
"conv",
"full_attention",
"conv",
"conv",
"conv",
"full_attention",
"conv",
"conv",
"conv",
"full_attention",
"conv",
"conv",
"conv",
"full_attention",
"conv",
"conv",
"conv",
"full_attention",
"conv",
"conv",
"full_attention",
"conv",
"conv",
"full_attention",
"conv",
"conv"
],
"max_position_embeddings": 128000,
"model_type": "lfm2",
"norm_eps": 1e-05,
"num_attention_heads": 32,
"num_heads": 32,
"num_hidden_layers": 30,
"num_key_value_heads": 8,
"pad_token_id": 124893,
"rope_parameters": {
"rope_theta": 10000000.0,
"rope_type": "default"
},
"tie_word_embeddings": true,
"transformers_version": "5.13.1",
"use_cache": true,
"use_pos_enc": true,
"vocab_size": 128000,
"block_ff_dim": 10752,
"rope_theta": 10000000.0
}

14
generation_config.json Normal file
View File

@@ -0,0 +1,14 @@
{
"_from_model_config": true,
"bos_token_id": 124894,
"do_sample": false,
"eos_token_id": [
124900
],
"output_attentions": false,
"output_hidden_states": false,
"pad_token_id": 124893,
"repetition_penalty": 1.1,
"transformers_version": "5.13.1",
"use_cache": true
}

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:966d206651b96446f6a4c415d118049f478a8df79be3fa45bfd04959a4d68be0
size 5394427448

3
tokenizer.json Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:695be7802a0e4b8a81048f0ff5ebb7fc811a0ba5a6be63dbb24deb5a81096f41
size 17905598

13
tokenizer_config.json Normal file
View File

@@ -0,0 +1,13 @@
{
"backend": "tokenizers",
"bos_token": "<|startoftext|>",
"clean_up_tokenization_spaces": false,
"eos_token": "<|im_end|>",
"is_local": false,
"legacy": false,
"local_files_only": false,
"model_max_length": 1000000000000000019884624838656,
"pad_token": "<|pad|>",
"tokenizer_class": "TokenizersBackend",
"use_default_system_prompt": false
}