---
title: llamafile-models
canonical_url: "https://www.modelscope.cn/models/bingal/llamafile-models"
md_url: "https://www.modelscope.cn/models/bingal/llamafile-models.md"
repository: bingal/llamafile-models
chinese_name: "llamafile 模型合集"
last_updated: 2024-08-29
license: "MIT License"
pipeline_tag: text-generation
tasks:
  - text-generation
library_name:
  - llamafile
  - pytorch
frameworks:
  - Pytorch
downloads: 7397
stars: 62
---

# llamafile-models

> llamafile-models - bingal 在 ModelScope 开源的模型。为了方便零基础快速体验开源大模型，提供一些可直接运行的模型（llamafile），如果想体验开源大模型，又被那些看起来有些复杂的 python 配置吓到，本模型集合适合你

bingal/llamafile-models 是 ModelScope 魔搭社区上的text-generation模型，采用 MIT License 许可。

- **Repository**: bingal/llamafile-models
- **License**: MIT License
- **Tasks**: text-generation
- **Downloads**: 7397
- **Stars**: 62
- **Last updated**: 2024-08-29

Source: https://www.modelscope.cn/models/bingal/llamafile-models

---

<img src="assets/llamafile-640x640.png" height="120">

## 更新记录
- 2024-04-22: 增加 `Meta-Llama-3-8B-Instruct-Q4_K_M.llamafile` ，目前中文支持还不理想，适合英文对话


## llamafile 模型集合（一个文件即可运行）
为了方便零基础快速体验开源大模型，本集合提供一些可直接运行的模型（llamafile），如果想体验开源大模型，又无奈没有显卡，或者被那些看起来复杂的 python 和 cuda 配置吓到，本模型集合适合你。


## 关于llamafile
llamafile 是一种AI大模型部署（或者说运行）的方案， 与其他方案相比，llamafile的独特之处在于它可以将模型和运行环境打包成一个独立的可执行文件，从而简化了部署流程。用户只需下载并执行该文件，无需安装运行环境或依赖库，这大大提高了使用大型语言模型的便捷性。这种创新方案有助于降低使用门槛，且一个文件能同时支持 macOS, Windows, Linux, FreeBSD, OpenBSD, 和 NetBSD系统，使更多人能够轻松部署和使用大型语言模型。

相关链接：<br/>
<a href="https://github.com/Mozilla-Ocho/llamafile" target="_blank">llamafile Github</a><br/>
<a href="https://www.bingal.com/posts/ai-llamafile-usage/" target="_blank">llamafile 中文使用指南</a><br/>
<a href="https://huggingface.co/jartine" target="_blank">huggingface 的 llamafile 模型</a>

## 本合集已包含下列模型（持续更新）

### 模型列表
| 模型 | 模型大小 | 下载地址 | 使用示例 | 说明 |
|------|--------|----------|----------|----------|
| Qwen-7B-Chat | 4.23GB | [Qwen-7B-Chat-q4_0.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=Qwen-7B-Chat%2FQwen-7B-Chat-q4_0.llamafile) | <a href="https://www.bingal.com/posts/qwen-7b-chat-llamafile-usage/" target="_blank">示例</a> | 中英文对话 |
| Qwen-14B-Chat | 7.65GB<br/>14.06GB | [Qwen-14B-Chat-q4_0.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=Qwen-14B-Chat%2FQwen-14B-Chat-q4_0.llamafile) <br/> [Qwen-14B-Chat-q8_0.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=Qwen-14B-Chat/Qwen-14B-Chat-q8_0.llamafile) | - | 中英文对话 |
| Qwen1.5-7B-Chat | 5.18GB | [qwen1_5-7b-chat-q5_k_m.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=Qwen1.5-7B-Chat%2Fqwen1_5-7b-chat-q5_k_m.llamafile) | - | 中英文对话 |
| Qwen1.5-14B-Chat | 9.84GB | [qwen1_5-14b-chat-q5_k_m.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=Qwen1.5-14B-Chat%2Fqwen1_5-14b-chat-q5_k_m.llamafile) | - | 中英文对话 |
| Qwen1.5-0.5B-Chat | 420.57MB | [qwen1_5-0_5b-chat-q4_k_m.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=Qwen1.5-0.5B-Chat%2Fqwen1_5-0_5b-chat-q4_k_m.llamafile) | - | 中英文对话 |
| Qwen1.5-14B-Chat | 1.17GB | [qwen1_5-1_8b-chat-q4_k_m.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=Qwen1.5-1.8B-Chat%2Fqwen1_5-1_8b-chat-q4_k_m.llamafile) | - | 中英文对话 |
| Baichuan-13B-Chat | 7.06GB | [Baichuan-13B-Chat-q4_0.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=Baichuan-13B-Chat%2FBaichuan-13B-Chat-q4_0.llamafile) | - | 中英文对话 |
| OrionStar-Yi-34B-Chat | 19.27GB | [OrionStar-Yi-34B-Chat-q4_0.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=OrionStar-Yi-34B-Chat%2FOrionStar-Yi-34B-Chat-q4_k_m.llamafile) | - | 中英文对话 |
| CodeLlama-7b-Instruct | 3.59GB | [CodeLlama-7b-Instruct-q4_0.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=CodeLlama-7b-Instruct%2FCodeLlama-7b-Instruct-q4_0.llamafile) | <a href="https://www.bingal.com/posts/codellama-7b-instruct-llamafile-usage/" target="_blank">示例</a> | 中英文对话、擅长写代码 |
| CodeFuse-QWen-14B | 7.65GB | [CodeFuse-QWen-14B-q4_0.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=CodeFuse-QWen-14B%2FCodeFuse-QWen-14B-q4_0.llamafile) | - | 中英文对话、擅长写代码 |
| Yi-6B-Chat | 3.45GB | [Yi-6B-Chat-q4.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=Yi-6B-Chat%2FYi-6B-Chat-q4_0.llamafile) | <a href="https://www.bingal.com/posts/yi-6b-chat-llamafile-usage/" target="_blank">示例</a> | 中英文对话 |
| LLaVA-1.5-7B | 3.99GB | [llava-v1.5-7b-q4.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=LLaVA-1.5-7B%2Fllava-v1.5-7b-q4.llamafile) | <a href="https://www.bingal.com/posts/llava-llamafile-usage/" target="_blank">示例</a> | 英文视觉多模态 |
| Yi-VL-6B | 3.61GB | [Yi-VL-6B-q4_0.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=Yi-VL-6B%2FYi-VL-6B-q4_0.llamafile) | - | 中英文视觉多模态 |
| Ph-2 | 2.78GB | [phi-2.Q8_0.llamafile.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=Phi-2%2Fphi-2.Q8_0.llamafile) | - | 英文对话、微软出品 |
| TinyLlama-1.1B-Chat-v1.0 | 1.12GB | [TinyLlama-1.1B-Chat-v1.0.Q8_0.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=TinyLlama-1.1B%2FTinyLlama-1.1B-Chat-v1.0.Q8_0.llamafile) | - | 英文对话 |
| Meta-Llama-3-8B-Instruct | 4.95GB | [Meta-Llama-3-8B-Instruct-Q4_K_M.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=Meta-Llama-3-8B-Instruct%2FMeta-Llama-3-8B-Instruct-Q4_K_M.llamafile) | - | 英文对话 |


**注意：Windows 系统不支持单个 exe 文件超过 4GB，所以大于 4GB 的模型，需要分别下载 llamafile 和 gguf 模型运行；此外，也可以使用 Windows 的 WSL 子系统（Linux）来运行，同样可以绕过 4GB 的限制**
## Windows 系统运行大于 4GB 模型的方法

## 使用方法（以 Yi-6B-Chat 模型为例）

### 1. 下载

**注意：Windows 系统不支持单个 exe 文件超过 4GB，所以需要分别下载 llamafile 和 gguf 模型运行。**
=======
* 下载 llamafile.exe 程序

    下载地址：<br/>
    [https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=llamafile-0.6.2.win.zip](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=llamafile-0.6.2.win.zip)

    下载后解压得到 `llamafile-0.6.2.exe` 文件。

* 下载 GGUF 模型（如：Qwen1.5-7B-Chat-GGUF）

    下载地址：<br/>
    [https://www.modelscope.cn/models/qwen/Qwen1.5-7B-Chat-GGUF/resolve/master/qwen1_5-7b-chat-q5_k_m.gguf](https://www.modelscope.cn/models/qwen/Qwen1.5-7B-Chat-GGUF/resolve/master/qwen1_5-7b-chat-q5_k_m.gguf) <br/>


* 打开 `cmd` 或者 `terminal`命令行窗口，进入模型所在目录

    ```bash
    .\llamafile-0.6.2.exe -m .\qwen1.5-7b-chat-q5_k_m.gguf -ngl 9999 --port 8080 --host 0.0.0.0
    ```
    
    浏览器打开 `http://127.0.0.1:8080` 即可开始聊天


## 其他情况使用方法（以 Yi-6B-Chat 模型为例）

### 1. 下载

下载地址：[Yi-6B-Chat/Yi-6B-Chat-q4.llamafile](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=Yi-6B-Chat/Yi-6B-Chat-q4_0.llamafile)

这个模型是 70 亿参数的 int4 量化版本，4.23GB。

### 2. 运行

#### Windows 系统（小于4GB的模型）

-   修改文件名，增加 `.exe` 后缀，如改成 `Yi-6B-Chat-q4.exe`
-   打开 `cmd` 或者 `terminal`命令行窗口，进入模型所在目录

```bash
.\Yi-6B-Chat-q4.exe
```

-   浏览器打开 `http://127.0.0.1:8080` 即可开始聊天

#### Windows 系统（大于4GB的模型）


* 1. 下载 llamafile.exe 程序

    下载地址：<br/>
    [https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=llamafile-0.6.2.win.zip](https://www.modelscope.cn/api/v1/models/bingal/llamafile-models/repo?Revision=master&FilePath=llamafile-0.6.2.win.zip)

    下载后解压得到 `llamafile-0.6.2.exe` 文件。

* 2. 下载 GGUF 模型（如：Qwen1.5-7B-Chat-GGUF）

    下载地址：<br/>
    [**Qwen1.5-7B-Chat-GGUF**: 70 亿参数的 q5_k_m 量化版本，5.15GB。](https://www.modelscope.cn/models/qwen/Qwen1.5-7B-Chat-GGUF/resolve/master/qwen1_5-7b-chat-q5_k_m.gguf) <br/>


* 3. 打开 `cmd` 或者 `terminal`命令行窗口，进入模型所在目录

    ```bash
    .\llamafile-0.6.2.exe -m .\qwen1.5-7b-chat-q5_k_m.gguf -ngl 9999 --port 8080 --host 0.0.0.0
    ```
    
    浏览器打开 `http://127.0.0.1:8080` 即可开始聊天


#### Linux、Mac 系统

-   终端运行（注意 Mac 系统可能需要授权，在【设置】→ 【隐私与安全】点击【仍然打开】进行授权）

```bash
# 授权
chmod +x ./Yi-6B-Chat-q4.llamafile.llamafile
# 运行
./Yi-6B-Chat-q4.llamafile.llamafile
```

-   浏览器打开 `http://127.0.0.1:8080` 即可开始聊天

*部分模型的默认参数可能跟自带界面的默认参数不匹配，建议用 ChatBox 或者 nextChat 等对话客户端使用*

### 3. 类 openai api 网址

接口网址：`http://127.0.0.1:8080/v1`

在 GPT 客户端（如ChatBox）设置好调用接口即可使用<br/>
<img src="assets/chatbox-setting.jpg" width="628">

### 4. 可选参数说明

-   `-ngl 9999` 表示模型的多少层放到 GPU 运行，其他在 CPU 运行，如果没有 GPU 则可设置为 `-ngl 0` ，默认是 9999，也就是全部在 GPU 运行（需要装好驱动和 CUDA 运行环境）。
-   `--host 0.0.0.0` web 服务的hostname，如果只需要本地访问可设置为 `--host 127.0.0.1` ，如果是`0.0.0.0` ，即网络内可通过 ip 访问。
-   `--port 8080` web服务端口，默认 `8080` ,可通过该参数修改。
-   `-t 16` 线程数，当 cpu 运行的时候，可根据 cpu 核数设定多少个内核并发运行。
-   其他参数可以通过 `--help` 查看。

## llamafile支持以下操作系统（最低标准安装说明）：

- **Linux**：内核版本2.6.18或更高版本（支持ARM64或AMD64架构），适用于任何如RHEL5或更新版本的分发版
- **macOS**：macOS 14 Sonoma（Darwin版本23.1.0）或更高版本（支持ARM64或AMD64架构，但仅ARM64架构支持GPU加速），Darwin内核版本15.6或更高版本理论上应该得到支持，但我们目前无法进行实际测试。
- **Windows**：windows 8或更高版本（仅支持AMD64架构）
- **FreeBSD**： FreeBSD 13或更高版本（支持AMD64或ARM64架构，理论上GPU应可工作）
- **NetBSD**：NetBSD 9.2或更高版本（仅支持AMD64架构，理论上GPU应可工作）
- **OpenBSD**：OpenBSD 7或更高版本（仅支持AMD64架构，不支持GPU加速）

## llamafile支持以下CPU类型：

* AMD64架构的微处理器必须支持SSSE3指令集。如果不支持，llamafile将显示错误信息并无法运行。这意味着，如果您使用的是Intel CPU，至少需要是Intel Core或更新系列（约2006年以后）；如果是AMD CPU，至少需要是Bulldozer或更新系列（约2011年以后）。如果您的CPU支持AVX或更高级的AVX2指令集，llamafile将利用这些特性以提升性能。目前AVX512及更高级指令集的运行时调度尚未得到支持。
* ARM64架构的微处理器必须支持ARMv8a+指令集。从Apple Silicon到64位Raspberry Pis的设备都应该兼容，只要您的权重数据能够适应内存容量。

## llamafile 对 GPU 的支持说明

* 在搭载 MacOS 的 Apple Silicon 系统上，只要安装了 Xcode 命令行工具，Metal GPU 就应该能够正常工作。
在 Windows 系统上，只要满足以下两个条件，GPU 就应该能够正常工作：（1）使用我们的发行版二进制文件；（2）传递 -ngl 9999 标志。如果您只安装了显卡驱动程序，那么 llamafile 将使用 tinyBLAS 作为其数学内核库，这对于批处理任务（例如摘要生成）来说会慢一些。为了获得最佳性能，NVIDIA GPU 用户需要安装 CUDA SDK 和 MSVC；而 AMD GPU 用户则需要安装 ROCm SDK。如果 llamafile 检测到 SDK 的存在，那么它将为您系统编译一个原生模块，该模块将使用 cuBLAS 或 hipBLAS 库。您还可以通过启用 WSL 上的 Nvidia CUDA 并在 WSL 中运行 llamafiles 来使用 CUDA。使用 WSL 的额外好处是，它允许您在 Windows 上运行大于 4GB 的 llamafiles。
* 在 Linux 系统上，如果满足以下条件，Nvidia cuBLAS GPU 支持将在运行时编译：（1）安装了 cc 编译器；（2）传递 -ngl 9999 标志以启用 GPU；（3）在您的机器上安装了 CUDA 开发工具包，并且 nvcc 编译器在您的路径中。
* 如果您的机器中同时有 AMD GPU 和 NVIDIA GPU，那么您可能需要通过传递 --gpu amd 或 --gpu nvidia 来指定要使用的 GPU。
* 如果由于任何原因无法在运行时编译和动态链接 GPU 支持，llamafile 将回退到 CPU 推理。

## 如果还有其他模型希望提供 llamafile 格式，可以在[这里](https://www.modelscope.cn/models/bingal/llamafile-models/feedback)反馈, 尽量提供支持

## 授权说明

不同的模型采用的授权协议可能有所不同，具体使用方式请参考模型官方授权说明。

##### Clone with HTTP
```bash
 git clone https://www.modelscope.cn/bingal/llamafile-models.git
```
