ValueError: Unrecognized model in huawei-noah/TinyBERT_4L_zh. Should have a `model_type` key in its config.json

#2
by JiminKung - opened

Hi authors,

I am currently working on implementing the TinyBERT_4L_zh model and have encountered an issue during the loading process. I was wondering if you could provide some guidance on how to correctly load this model (or alternatively, if there are any substitute models that could be utilized).

When attempting to run the official code as follows:

# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("huawei-noah/TinyBERT_4L_zh")

An error is raised:

  model = AutoModel.from_pretrained("huawei-noah/TinyBERT_4L_zh")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\combert\Lib\site-packages\transformers\models\auto\auto_factory.py", line 526, in from_pretrained
    config, kwargs = AutoConfig.from_pretrained(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ProgramData\anaconda3\envs\combert\Lib\site-packages\transformers\models\auto\configuration_auto.py", line 1038, in from_pretrained
    raise ValueError(
ValueError: Unrecognized model in huawei-noah/TinyBERT_4L_zh. Should have a `model_type` key in its config.json, or contain one of the following strings in its name: albert, align, altclip, 

I would greatly appreciate it if you could offer any insights or solutions to help resolve this problem. Thank you in advance for your time and assistance. I look forward to your prompt reply.

Best regards

Sign up or log in to comment