I believe the difference is in https://github.com/huggingface/transformers/blob/master/examples/token-classification/utils_ner.py 2 starting at line 139 where it has different logic for tensorflow but not sure what the specific cause it.