You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "create_tf_record_from_joint_dataset.py", line 109, in main
allow_sample_reuse)
File "create_tf_record_from_joint_dataset.py", line 141, in attempt_to_find_sample_that_is_not_yet_in_dataset
return random.choice(all_items_in_category)
File "/opt/python/3.7.15/lib/python3.7/random.py", line 261, in choice
raise IndexError('Cannot choose from an empty sequence') from None
IndexError: Cannot choose from an empty sequence
When list of documents in given engraving is empty, the random.choice crashes. The code assumes that there will be some documents, even though in documentation it is said, that engraving specifications can be left out.
How to replicate
create dataset with no information about engravings
run create_tf_record_from_joint_dataset.py with the dataset created above
Possible fix
# create_tf_record_from_joint_dataset.py, line 97withtqdm(desc="Serializing annotations", total=target_size) asprogress_bar:
whilesamples_written<target_size:
current_engraving, number_of_staves=sampling_categories[index%len(sampling_categories)]
all_items_in_category=dataset[current_engraving][number_of_staves]
# fix, check if there are any documentsiflen(all_items_in_category) ==0:
index+=1continue# end fixencoding_succeeded=Falsetf_example=None
The text was updated successfully, but these errors were encountered:
The error
When list of documents in given engraving is empty, the
random.choice
crashes. The code assumes that there will be some documents, even though in documentation it is said, that engraving specifications can be left out.How to replicate
create_tf_record_from_joint_dataset.py
with the dataset created abovePossible fix
The text was updated successfully, but these errors were encountered: