Onnx conversion for bert models with classification layers
Hi,
  I am trying to convert a NER model trained with BertForTokenClassification to Onnx format. Am able to convert it using the convert_graph_to_onnx.py script using the following params

convert(framework="pt", model="bert_small_ner", output="bert_small_onnx/bert_small_ner.onnx", opset=11)

There are no errors thrown either. However, when i run the inference, I see only the Bert layer outputs but not the output of the Linear classification layer as it is in BertForTokenClassification. 

Am I missing something? Or this is a know issue with some work around? Kindly let me know

Thanks in advance
Might be of interest to @mfuntowicz <|||||>I think the issue could be due to pipeline which extracts the model
# Allocate tokenizer and model
return pipeline("feature-extraction", model=model, tokenizer=tokenizer, framework=framework)

Seems like default is 'feature-extraction'
I could get this to work by changing it to 'ner'. Also passed in a config option
return pipeline("ner", model=model, config=config, tokenizer=tokenizer, framework=framework)

Not sure if this is the correct solution but it seems to work for me<|||||>This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
