error while loading pre-annotated jsonl file

I am trying to load a pre-annotated .jsonl file (label is already present in the data I am loading) using the following command:

prodigy textcat.manual dataset_name /path_to_file/filename.jsonl --label /path_to_labels/labels.txt

My file looks like this:

{"0":"1234","1":"xxxx","2":"2021-08-24","3":"random text","4":"label-name","5":"0.5"}

I am getting the following error:

✘ Error while validating stream: no first example
This likely means that your stream is empty.This can also mean all the examples
in your stream have been annotated in datasets included in your --exclude recipe

Any thoughts as to why I cannot load this dataset?


Hi! The problem is that the data you're loading in doesn't really follow the expected format or includes a "text", so Prodigy can't know which information it should display and what text you want to annotate. (In your case, that seems to be "3"? Or is it "1"? I'm not 100% sure I can tell what the text is and what the labels are).

You can find an example of the expected format for the multiple choice interface here:

To pre-select labels, you can add them to the list of "accept": [], e.g. "accept": ["label1", "label2"].

1 Like

Ok! I edited the file, and that seemed to work:

{"id":"1234","deployment":"xxxx","date":"2021-08-24","text":"random text","label":"label-name","score":"0.5"}

One more question:
I am using a checklist for all of the labels, and I see the pre-annotated label shows up above the text. Will this be logged in the db if someone changes the label?

Glad it worked!

Based on your example, wouldn't you want the label-name to be added as a selected option? Or is this entirely separate from the choice options? If you want to pre-select a choice option, you can pre-populate the "accept": [], e.g. "accept": ["test-label1"] will pre-select the first option.

And yes, if you change the label in the UI, the "accept": [] list will be updated with the currently selected labels. If you want to preserve the original answers (e.g. to later compare how often the pre-annotated data was changed), you could just add it to the JSON under an arbitrary key that's then preserved in the data. For example, "orig_accept": ["label1", "label2"]. If the user then edits the labels, the data saved in the database would then have both.

1 Like

Can I refer to a labels file, or does each label need to be written out in a list for "accept": [] and "orig_accept": []? I have a long list of labels. I would like the label to be pre-selected, and the annotator can choose to unselect it and choose another, or keep it selected. So in my .jsonl file, my "label" (the pre-annotated portion) would become "orig_accept"? I tested out a few .jsonl formats, and found that having the pre-annotated label as both "accept": [] and "orig_accept": [] in the .jsonl file (replacing "label":"label1") resulted in the pre-annotated label being pre-checked in the UI.

{"id":"1234","deployment":"xxxx","date":"2021-08-24","text":"random text","orig_accept":["label1"],"score":"0.5","accept":["label1"]}

And I see you can also have both (the pre-annotated label as a banner on top in the UI, and pre-selected (checkbox is marked) in the list:

{"id":"1234","deployment":"xxxx","date":"2021-08-24","text":"random text","orig_accept":["label1"],"score":"0.5","accept":["label1"],"label":"label1"}

The labels here should be a list of the actual label values that should be pre-selected in the UI. (Pointing to a file here wouldn't really make sense because you do want the labels to be present explicitly in the data so you can export the data later on and know the exact label values.)