Text Generation
MLX
Safetensors
English
mistral
codestral
code
apple-silicon
FIM
Fill-in-the-Middle
code-generation
4bit
conversational
Eval Results (legacy)
4-bit precision
Instructions to use CyberYui/Codestral-22B-Yui-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use CyberYui/Codestral-22B-Yui-MLX with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("CyberYui/Codestral-22B-Yui-MLX") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use CyberYui/Codestral-22B-Yui-MLX with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "CyberYui/Codestral-22B-Yui-MLX"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "CyberYui/Codestral-22B-Yui-MLX" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "CyberYui/Codestral-22B-Yui-MLX", "messages": [ {"role": "user", "content": "Hello"} ] }' - Atomic Chat
File size: 4,464 Bytes
fb9d372 769b6c6 fb9d372 769b6c6 3721899 fb9d372 2bb72a4 259932f 2bb72a4 598d51e 2bb72a4 598d51e 2bb72a4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | ---
license: apache-2.0
base_model: mistralai/Codestral-22B-v0.1
library_name: mlx
pipeline_tag: text-generation
language:
- en
tags:
- codestral
- mlx
- code
- mistral
- apple-silicon
- FIM
- Fill-in-the-Middle
- code-generation
- 4bit
model-index:
- name: Codestral-22B-Yui-MLX
results:
- task:
type: text-generation
name: Text Generation
dataset:
type: code
name: Code
metrics:
- type: vram
value: 12.5 GB
---
# 🇬🇧 English | 🇨🇳 中文
> 👇 Scroll down for **Chinese version** / 向下滚动查看**中文版本**
---
## 🇬🇧 English
# Codestral-22B-Yui-MLX
This model is **CyberYui's custom-converted MLX format port** of Mistral AI's official [`mistralai/Codestral-22B-v0.1`](https://huggingface.co/mistralai/Codestral-22B-v0.1) model. No modifications, alterations, or fine-tuning of any kind were applied to the original model's weights, architecture, or parameters; this is strictly a format conversion for MLX, optimized exclusively for Apple Silicon (M1/M2/M3/M4) chips.
### 📌 Model Details
- **Base Model**: [`mistralai/Codestral-22B-v0.1`](https://huggingface.co/mistralai/Codestral-22B-v0.1)
- **Conversion Tool**: `mlx-lm 0.29.1`
- **Quantization**: 4-bit (≈12.5GB total size)
- **Framework**: MLX (native Apple GPU acceleration)
- **Use Cases**: Code completion, code generation, programming assistance, FIM (Fill-In-the-Middle)
### 🚀 How to Use
#### 1. Command Line (mlx-lm)
First, install the required package:
```bash
pip install mlx-lm
```
Then run the model directly:
```bash
mlx_lm.generate --model CyberYui/Codestral-22B-Yui-MLX --prompt "def quicksort(arr):"
```
#### 2. Python Code
```python
from mlx_lm import load, generate
# Load this model
model, tokenizer = load("CyberYui/Codestral-22B-Yui-MLX")
# Define your prompt
prompt = "Write a Python function for quicksort with comments"
# Apply chat template if available
if tokenizer.chat_template is not None:
messages = [{"role": "user", "content": prompt}]
prompt = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_dict=False
)
# Generate response
response = generate(model, tokenizer, prompt=prompt, verbose=True)
```
#### 3. LM Studio
1. Open LM Studio and log in to your Hugging Face account
2. Go to the **Publish** tab
3. Search for this model`CyberYui/Codestral-22B-Yui-MLX`
4. Download and load the model to enjoy native MLX acceleration!
### 📄 License
This model is distributed under the **Apache License 2.0**, strictly following the original model's open-source license.
---
## 🇨🇳 中文
# Codestral-22B-Yui-MLX
本模型名为 **Codestral-22B** ,是基于 **Mistral AI 官方 [`mistralai/Codestral-22B-v0.1`](https://huggingface.co/mistralai/Codestral-22B-v0.1) 模型,无任何修改并由**CyberYui**个人转换的 MLX 格式专属版本模型**,专为 **Apple Silicon(M1/M2/M3/M4)** 系列芯片深度适配。
### 📌 模型详情
- **基础模型**:[`mistralai/Codestral-22B-v0.1`](https://huggingface.co/mistralai/Codestral-22B-v0.1)
- **转换工具**:`mlx-lm 0.29.1`
- **量化精度**:4-bit(总大小约 12.5GB)
- **运行框架**:MLX(原生苹果 GPU 加速)
- **适用场景**:代码补全、代码生成、编程辅助、FIM(中间填充)
### 🚀 使用方法
#### 1. 命令行(mlx-lm)
首先安装依赖包:
```bash
pip install mlx-lm
```
然后直接运行模型:
```bash
mlx_lm.generate --model CyberYui/Codestral-22B-Yui-MLX --prompt "def quicksort(arr):"
```
#### 2. Python 代码
```python
from mlx_lm import load, generate
# 加载本模型
model, tokenizer = load("CyberYui/Codestral-22B-Yui-MLX")
# 定义你的提示词
prompt = "写一个带注释的Python快速排序函数"
# 应用对话模板
if tokenizer.chat_template is not None:
messages = [{"role": "user", "content": prompt}]
prompt = tokenizer.apply_chat_template(
messages, add_generation_prompt=True, return_dict=False
)
# 模型会生成回复
response = generate(model, tokenizer, prompt=prompt, verbose=True)
```
#### 3. LM Studio 使用
1. 打开 LM Studio,登录你的 Hugging Face 账号
2. 进入 **Publish** 标签页
3. 搜索 `CyberYui/Codestral-22B-Yui-MLX`
4. 下载并加载模型,即可享受原生 MLX 版本的 Codestral 模型了!
### 📄 开源协议
本模型遵循 **Apache License 2.0** 协议分发,严格遵守原模型的开源要求。
``` |