ValueError: Model type ernie4_5_moe not supported.

#1
by Gavin-Wang - opened

main.py

from mlx_lm import load, generate

model, tokenizer = load("mlx-community/ERNIE-4.5-21B-A3B-PT-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
)

response = generate(model, tokenizer, prompt=prompt, verbose=True)

python3 main.py
Fetching 14 files: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 14/14 [00:00<00:00, 168252.88it/s]
ERROR:root:Model type ernie4_5_moe not supported.
Traceback (most recent call last):
File "/blablablablapath/lib/python3.13/site-packages/mlx_lm/utils.py", line 67, in _get_classes
arch = importlib.import_module(f"mlx_lm.models.{model_type}")
File "/opt/homebrew/Cellar/[email protected]/3.13.2/Frameworks/Python.framework/Versions/3.13/lib/python3.13/importlib/__init__.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'mlx_lm.models.ernie4_5_moe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/blablablablapath/main.py", line 4, in
model, tokenizer = load("mlx-community/ERNIE-4.5-21B-A3B-PT-4bit")
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/blablablablapath/env/lib/python3.13/site-packages/mlx_lm/utils.py", line 241, in load
model, config = load_model(model_path, lazy)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "/blablablablapath/env/lib/python3.13/site-packages/mlx_lm/utils.py", line 176, in load_model
model_class, model_args_class = get_model_classes(config=config)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/blablablablapath/env/lib/python3.13/site-packages/mlx_lm/utils.py", line 71, in _get_classes
raise ValueError(msg)
ValueError: Model type ernie4_5_moe not supported.

ps. already updated mlx-lm

ps. already updated mlx-lm

blablabla% pip show mlx-lm
Name: mlx-lm
Version: 0.25.3
Summary: LLMs on Apple silicon with MLX and the Hugging Face Hub
Home-page: https://github.com/ml-explore/mlx-lm
Author: MLX Contributors
Author-email: [email protected]
License: MIT

there seem to be no ernie structure's support in venv/lib/python3.13/site-packages/mlx_lm/models

Sign up or log in to comment