- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is it possible to convert your own custom BERT model trained on Pytorch? I can see an example for a pre-trained BERT-NER model but I want to convert a custom model based on bert-base-cased. I have converted my model to ONNX and have tried to run the mo.py but get this error:
[ ERROR ] Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.front.input_cut.InputCut'>): --input parameter was provided. Other inputs are needed for output computation. Provide more inputs or choose another place to cut the net.
Is what I am try to do even possible?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tye_Stephen,
Thanks for reaching out.
Could you please share your model with us for further investigation?
Regards,
Wan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can download it from this link:
https://onnx-134.s3.amazonaws.com/bert-base-cased.onnx
Regards,
Stephen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tye_Stephen,
Thanks for your information.
I’ve encountered the same error as you did when I convert your ONNX model.
Therefore, please share your source model with us.
Also, please share the command of conversion to ONNX with us.
Thanks and regards,
Wan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
below is a link to the source pytorch bert-base-cased model:
https://onnx-134.s3.amazonaws.com/bertbasecased.tar.gz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tye_Stephen,
Thanks for sharing your source model with us.
We are investigating this issue and will update you at the earliest.
Regards,
Wan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tye_Stephen,
I have successfully converted your custom PyTorch bert-base-cased model into an ONNX file, then into Intermediate Representation using OpenVINO™ 2021.4 on Windows 10. You may refer to the steps below:
1. Download the BERT_BASE model and copy the model_config.json file to your custom model directory.
2. Steps to convert PyTorch bert-base-cased model to ONNX model is available on the following page:
3. Steps to convert ONNX bert-base-cased model to IR is available on the following page:
For more information, please refer to the steps to convert PyTorch BERT-NER to the Intermediate Representation on the following page:
On another note, you may download the ONNX and IR files from this link.
Best regards,
Wan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks.
Can you provide a python sample on how to pass a string of text to the IR file to get a classification?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tye_Stephen,
BERT Named Entity Recognition Python Demo is a demo application that reads command line parameters and loads a network to the Inference Engine. It also fetches data from the user-provided URL to populate the "context" text. The text is then used to search named entities.
Supported models for this demo application is available on the following page:
Best regards,
Wan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have looked through all the BERT demos you have provided and with some work I could probably modify them to work with my BERT sentiment classification model. But I think it would be good if you had a sentiment classification demo on your site as this type of BERT model is very common. It would be good if you could add such a demo to your roadmap.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tye_Stephen,
Thank you for offering your valuable advice.
We will help to consolidate this as a feature request to bring for engineering review.
Regards,
Wan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tye_Stephen,
This thread will no longer be monitored since we have provided suggestions.
If you need any additional information from Intel, please submit a new question.
Regards,
Wan
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page