Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How to convert to ONNX a fine-tuned model #274

Open
mrddter opened this issue Sep 1, 2023 · 2 comments
Open

[Question] How to convert to ONNX a fine-tuned model #274

mrddter opened this issue Sep 1, 2023 · 2 comments
Labels
question Further information is requested

Comments

@mrddter
Copy link

mrddter commented Sep 1, 2023

Hi, we're playing with this library to see if it can be useful for our project. I find it very easy and well done (congratulations).

The idea is not to use it directly as a frontend library but via node.js.
We've tried scripting a model directly from HF (google/flan-t5-small) and it worked but we're having trouble using a fine-tuned model.

Here what we tried. We fine-tuned a model (again google/flan-t5-small) and then converted it using the onnx script (in README.md).

The script generated the following files:

onnx/decoder_model_quantized.onnx
onnx/decoder_model.onnx
onnx/encoder_model_quantized.onnx
onnx/encoder_model.onnx
config.json
generation_config.json
quantize_config.json
special_tokens_map.json
spice.model
tokenizer_config.json
tokenizer.json

But when we tried to use it it gave us this error:

local_files_only=true or env.allowRemoteModels=false and file was not found locally at ./models/google/flan-t5-small-2/onnx/decoder_model_merged_quantized.onnx

Some advice or useful doc/link?
Thanks

@mrddter mrddter added the question Further information is requested label Sep 1, 2023
@mrddter mrddter changed the title How to convert to ONNX a fine-tuned model [Question] How to convert to ONNX a fine-tuned model Sep 1, 2023
@xenova
Copy link
Collaborator

xenova commented Sep 1, 2023

You should be able to use our already-converted version: Xenova/flan-t5-small. The error you are seeing is because the original repo doesn't have the merged version of the onnx file, which is an optimization that reduced model size by a factor of ~2x.

@mrddter
Copy link
Author

mrddter commented Sep 1, 2023

thanks for the answer, I'll try starting from your model and let you know here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants