urchade/GLiNER

Conversion to ONXX

Opened this issue · 4 comments

Using this snippet to save pre-trained model locally -

from gliner import GLiNER
model  = GLiNER.from_pretrained("urchade/gliner_medium")
model.save_pretrained("gliner_medium")

post this, running script for onxx conversion as per documentation -
python GLiNER/convert_to_onnx.py --model_path gliner_medium/ --save_path gliner_onnx/ --quantize True

getting error on -
OSError: gliner_medium does not appear to have a file named config.json. Checkout 'https://huggingface.co/gliner_medium/tree/None' for available files.

Tried with changing file name from 'gliner_config.json' to 'config.json'
getting new error of -
ValueError: Unrecognized model in gliner_medium. Should have a `model_type` key in its config.json

try the same onnx conversion in notebook version once, https://github.com/urchade/GLiNER/blob/main/examples/convert_to_onnx.ipynb

and try to use earlier gliner version, latest gliner version has some bugs in onnx conversion

thanks @hari-ag00
Also, can you suggest the version for this? Currently, i am using '0.2.2'

@jitesh0034 try using 0.2.3