size mismatch error..
Hi!
I tried to test this model, but I got an error while loading the model..
'''
from gliner import GLiNER
labels = ["time", "location"]
model_path = "C:/Users/user/Downloads/GLiNER-MoE-MultiLingual"
model = GLiNER.from_pretrained(model_path)
entities = model.predict_entities(text, labels, threshold=0.2)
'''
I got this error :
'''
File "C:\Users\user\PycharmProjects\intent-analyzer\app\core\main.py", line 27, in
model = GLiNER.from_pretrained(model_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\PycharmProjects\intent-analyzer.venv\Lib\site-packages\huggingface_hub\utils_validators.py", line 114, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\PycharmProjects\intent-analyzer.venv\Lib\site-packages\huggingface_hub\hub_mixin.py", line 553, in from_pretrained
instance = cls._from_pretrained(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\PycharmProjects\intent-analyzer.venv\Lib\site-packages\gliner\model.py", line 817, in _from_pretrained
gliner.model.load_state_dict(state_dict, strict=strict)
File "C:\Users\user\PycharmProjects\intent-analyzer.venv\Lib\site-packages\torch\nn\modules\module.py", line 2581, in load_state_dict
raise RuntimeError(
RuntimeError: Error(s) in loading state_dict for SpanModel:
size mismatch for token_rep_layer.bert_layer.model.embeddings.word_embeddings.weight: copying a param with shape torch.Size([250048, 768]) from checkpoint, the shape in current model is torch.Size([128100, 1536]).
size mismatch for token_rep_layer.labels_encoder.model.embeddings.word_embeddings.weight: copying a param with shape torch.Size([250048, 768]) from checkpoint, the shape in current model is torch.Size([128100, 1536]).
'''
The embedding model was downloaded from here : https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe
And also I modified model path from config file.
pip list
Package Version
annotated-types 0.7.0
anyio 4.8.0
certifi 2025.1.31
charset-normalizer 3.4.1
click 8.1.8
colorama 0.4.6
coloredlogs 15.0.1
einops 0.8.1
fastapi 0.115.11
filelock 3.17.0
flatbuffers 25.2.10
fsspec 2025.2.0
gliner 0.2.16
h11 0.14.0
huggingface-hub 0.29.2
humanfriendly 10.0
idna 3.10
Jinja2 3.1.6
joblib 1.4.2
MarkupSafe 3.0.2
mpmath 1.3.0
networkx 3.4.2
numpy 2.2.3
onnxruntime 1.20.1
packaging 24.2
pillow 11.1.0
pip 25.0.1
protobuf 6.30.0
pydantic 2.10.6
pydantic_core 2.27.2
pyreadline3 3.5.4
python-mecab-ko 1.3.7
python-mecab-ko-dic 2.1.1.post2
PyYAML 6.0.2
regex 2024.11.6
requests 2.32.3
safetensors 0.5.3
scikit-learn 1.6.1
scipy 1.15.2
sentence-transformers 3.4.1
sentencepiece 0.2.0
setuptools 75.8.2
sniffio 1.3.1
starlette 0.46.0
sympy 1.13.1
threadpoolctl 3.5.0
tokenizers 0.21.0
torch 2.6.0
tqdm 4.67.1
transformers 4.49.0
typing_extensions 4.12.2
urllib3 2.3.0
uvicorn 0.34.0