timoschick / pet

This repository contains the code for "Exploiting Cloze Questions for Few-Shot Text Classification and Natural Language Inference"
https://arxiv.org/abs/2001.07676
Apache License 2.0
1.62k stars 285 forks source link

Stuck at 'There are 0 Examples for Label [my_label]' During iPETs Example Selection for Next Generation #104

Open xruifan opened 11 months ago

xruifan commented 11 months ago

The program is stuck at "There are 0 examples for label [my_label]" while iPETs are choosing examples per label for the next generation. This is because there is no condition ex.label == label in this line:

https://github.com/timoschick/pet/blob/21d32de975a911bfa0261827c9bd23dc4f0e4aa2/pet/modeling.py#L743

causing the while loop len(examples) < examples_per_label[idx] to never break.

A possible solution is to use a conditional check to verify if there are any examples with the given label before attempting to extend the examples to break the loop.

Fan.