mlx-examples/llms/qwen
Awni Hannun 27c0a8c002
Add llms subdir + update README (#145)
* add llms subdir + update README

* nits

* use same pre-commit as mlx

* update readmes a bit

* format
2023-12-20 10:22:25 -08:00
..
.gitignore Add Qwen example (#134) 2023-12-19 13:06:19 -08:00
convert.py Add llms subdir + update README (#145) 2023-12-20 10:22:25 -08:00
qwen.py Add llms subdir + update README (#145) 2023-12-20 10:22:25 -08:00
README.md Add Qwen example (#134) 2023-12-19 13:06:19 -08:00
requirements.txt Add Qwen example (#134) 2023-12-19 13:06:19 -08:00

Qwen

Qwen (通义千问) are a family of language models developed by Alibaba Cloud.1 The architecture of the Qwen models is similar to Llama except for the bias in the attention layers.

Setup

First download and convert the model with:

python convert.py

The script downloads the model from Hugging Face. The default model is Qwen/Qwen-1_8B. Check out the Hugging Face page to see a list of available models.

The conversion script will make the weights.npz and config.json files in the working directory.

Generate

To generate text with the default prompt:

python qwen.py

If you change the model, make sure to pass the corresponding tokenizer. E.g., for Qwen 7B use:

python qwen.py --tokenizer  Qwen/Qwen-7B

To see a list of options, run:

python qwen.py --help

  1. For more details on the model see the official repo of Qwen and the Hugging Face. ↩︎