Error trying to do demo on text_classification: 'label' is a required property, invalid task format

I’m trying to use the latest prodigy (1.5) and have now tried multiple envs and failed to get the demo here to work: https://prodi.gy/docs/workflow-text-classification

This line here is when it fails:


prodigy textcat.eval gh_issues_eval mymodel “docs” --api github --label DOCUMENTATION --exclude gh_issues
Using 1 labels: DOCUMENTATION

:sparkles: ERROR: Invalid task format for view ID ‘classification’
‘label’ is a required property

{‘text’: ‘Move SettingsAliases content to src/res/docs/’, ‘priority’: 40.288197, ‘meta’: {‘source’: ‘GitHub’, ‘url’: ‘https://github.com/kiwiirc/kiwiirc/issues/531’}, ‘_input_hash’: 644046882, ‘_task_hash’: -203850420}


I have had older versions of prodigy installed, but I’ve tried with new envs, and don’t think that’s the problem. OTOH, if it’s just me… (I’m on Mac, used prodigy-1.5.1-cp35.cp36-cp35m.cp36m-macosx_10_7_x86_64.whl and python 3.5 and 3.6 with same issue.)

Lynn

Thanks for the report, this is strange :thinking: It looks like for some reason, the label isn’t added to the outgoing examples correctly, which results in the task validation complaining that the incoming data doesn’t have the right format.

As a quick fix, you can either set "validate": false in your prodigy.json, or make the following edit in the textcat_eval function in recipes/textcat.py:

def add_label_to_stream(stream, label):
    for eg in stream:
        eg['label'] = label
        yield eg

stream = get_stream(source, api, loader)
stream = add_label_to_stream(stream, label)

thank you, I will do that :slight_smile: