Hello @Bram Dekker , I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.
Issue: Model training failure
ModelBuildError: Could not build the model: Only 4 valid input document(s) were found. Please provide at least 5 input documents. Labels file 3.pdf is invalid for the following reason(s): 'Label names are incompatible with the content of fields.json and the label schema version.'
Solution: Generally, the error is caused by inconsistent fields definition (the fields are defined in fields.json) and label files (the labeling files named with suffix ".labels.json").
In the error message Labels file 3.pdf is invalid
, so the file number 3rd (third file) is invalid.
Even this issue can be resolved this by writing a little script that compared all fields from fields.json with the "filename.labels.json". Comparing Fieldkey with Labels.label to find the culprit. This was the most pragmatic approach since with just "file 3" it is impossible to figure out what file or label is the cause.
Regards,
Vasavi
Thank you again for your time and patience throughout this issue.
Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.