File size: 1,173 Bytes
bc79e86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
language: en
library_name: mlx
pipeline_tag: text-generation
tags:
- mlx
- hunyuan
- hy4
- moe
- text-generation
license: apache-2.0
base_model: tencent/Hy4-preview
---

# mlx-community/Hy4-preview-4bit

This model [mlx-community/Hy4-preview-4bit](https://huggingface.co/mlx-community/Hy4-preview-4bit) was
converted to MLX format from [tencent/Hy4-preview](https://huggingface.co/tencent/Hy4-preview)
using mlx-lm version **0.32.0**.

## Use with mlx

This model requires Hy4-preview support from the
[add-hy4-preview](https://github.com/kernelpool/mlx-lm/tree/add-hy4-preview) branch,
which is not yet included in an mlx-lm release. Until it is, install mlx-lm from
the branch:

```bash
pip install git+https://github.com/kernelpool/mlx-lm.git@add-hy4-preview
```

```python
from mlx_lm import load, generate

model, tokenizer = load("mlx-community/Hy4-preview-4bit")

prompt = "hello"

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)
```