transformers model for NER

Hello,

I' m currently training a NER model with bert as base mode.I already done the manual annotation part using the bert-vocab and transformers_tokenizers files.I then trained the model using these annotations and a spacy procedure with config file.
Now i would like to use ner.correct and ner.teach model using my trained model.
I could start the correct method that way : prodigy ner.correct ner_logs ./model/output/model-best ./data.jsonl --label INTRACTABLE_STR,OS,URL -F transformers_tokenizers.py
the problem is i cant provide the method with a correct tokenization,how could i do that?
thanks

hi @Cgrdj!

Thanks for your question and welcome to the Prodigy community :wave:

The problem is the transformers_tokenizers.py recipe only has the manual recipe; it doesn't include a correct or teach recipe, so you'll need to write a custom recipe that combines that with how the built-in correct or teach recipes are.

To view examples of how the ner.correct and ner.teach recipes are structured, you can use the existing prodigy-recipes repo examples like ner.correct to learn how to do this.

For example, use the manual recipe but add a model in the loop with the make_tasks like in ner.correct but you'll need to modify the tokenization like in bert.ner.manual to modify for BertWordPieceTokenizer tokenizer.

Also - it's important to know that the prodigy-recipes are similar but not identical to the actual built-in recipes. If you want to view those, you can instead run prodigy stats, find the Location, then look for the recipes/ner.py script. There you can find the actual built-in ner.correct recipe.

Hope this helps!

Hello,

Yeah I finally figured out i had to create my own recipes. I' m currently working on it ,would be nice to provide support for transformers in prodigy directly.

Thank you for your explanation!

Hi there!

As luck would have it, I'm currently working on a Prodigy plugin that can train Huggingface models directly on top of your Prodigy annotations. You can see the preview here:

It may not cover every use-case out there, but if nothing else it may be a source of inspiration for some more custom recipes that you might write yourself.

1 Like

Very interesting work indeed!

1 Like

your answer is really interesting, do you know where i can find the code for bert.ner.manual?