This model mlx-community/Hy4-preview-4bit was converted to MLX format from tencent/Hy4-preview using mlx-lm version 0.32.0.
This model requires Hy4-preview support from the add-hy4-preview branch, which is not yet included in an mlx-lm release. Until it is, install mlx-lm from the branch:
pip install git+https://github.com/kernelpool/mlx-lm.git@add-hy4-previewfrom 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)