# Moshi: 開源版 GPT-4 級語音 AI 問世 - ALM

在 2024年9月

[@kyutai\_labs](https://x.com/kyutai_labs) 在 Huggingface 以及 GitHub 上釋出了即時語音對話模型，該模型是個 7B 模型，如果你有張 RTX 3090 24GB 或者與之大小相符的顯卡就可以跑這顆 Model 了，再來就可能要選擇量化模型了。

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1727230477705/73756cb6-6a79-4789-9dbe-a8d054db0f87.png align="center")

---

相信大家可能或多或少都有看到這篇在 Ｘ 上的貼文，這是一個來自法國的初創團隊 Kyutai，在七月初發佈對標 GPT-4o 的神奇模型。經歷兩個多月的時間，他們也對兌現自己的承諾，不僅把模型開源，甚至程式碼也開源了！

**論文:** [https://kyutai.org/Moshi.pdf](https://kyutai.org/Moshi.pdf)  
**開源程式碼:** [https://github.com/kyutai-labs/moshi](https://github.com/kyutai-labs/moshi)  
**開源模型:** [https://huggingface.co/collections/kyutai/moshi-…](https://huggingface.co/collections/kyutai/moshi-v01-release-66eaeaf3302bef6bd9ad7acd)  
**線上體驗:** [moshi.chat](http://moshi.chat)

大家可以去官網體驗看看 ([moshi.chat](http://moshi.chat))，能夠在落地的環境採用這些像人一般的模型，還是很奇妙的。

甚至我心目中的 AI 英雄 Andrej Karpathy 也在 X 上給出了讚賞

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1727231925969/a66edd00-454c-4362-84f7-a61d7ac1a0d4.png align="center")

## 技術細節

* 模型參數量: 7.69B
    
* 支援平台: PyTorch、Candle、MLX
    
* 語音輸入處理: Mimi; a neural audio codec (paper:3)
    
* ALM 架構: 結合 Helium 和較小的 Transformer 模型
    

模型的參數量約為 7.96B，模型支援以下三種平台 PyTorch、MLX(An array framework for Apple silicon) 以及 Candle (Minimalist ML framework for Rust)，如果你想執行 Quantized 的模型，則 Candle 提供了 8bit 的版本，MLX 則還有 4bit 的可以使用。

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1727231364811/3886104a-ba4c-427a-9243-b61da0496cbd.png align="center")

## Python (MLX) for local inference on macOS

### Installation

假如你想在自己電腦上執行 moshi，以下是 Mac 的快速安裝。

你至少需要 Python 3.10，建議使用 3.12。有關具體需求，請查看個別狀況而定。  
你可以使用下列方式安裝 PyTorch 和 MLX 用戶端：

```bash
pip install moshi      # moshi PyTorch, from PyPI
pip install moshi_mlx  # moshi MLX, from PyPI, best with Python 3.12.
# Or the bleeding edge versions for Moshi and Moshi-MLX.
pip install -e "git+https://git@github.com/kyutai-labs/moshi.git#egg=moshi&subdirectory=moshi"
pip install -e "git+https://git@github.com/kyutai-labs/moshi.git#egg=moshi_mlx&subdirectory=moshi_mlx"

pip install rustymimi  # mimi, rust implementation with Python bindings from PyPI
```

### local inference

```bash
python -m moshi_mlx.local -q 4   # 執行 4bit 模型;weights quantized to 4 bits
python -m moshi_mlx.local -q 8   # 執行 8bit 模型;weights quantized to 8 bits
# 使用其他不同的預訓練模型:
python -m moshi_mlx.local -q 4 --hf-repo kyutai/moshika-mlx-q4
python -m moshi_mlx.local -q 8 --hf-repo kyutai/moshika-mlx-q8
# 請注意要配合使用 "-q" 以及 "--hf-repo"
```

如果想了解 Moshi 更細緻的技術細節，可以透過下方訂閱我的 News letter 即時追蹤 AI 產業的最新趨勢。
