Skip to content

fake

allennlp_models.mc.dataset_readers.fake

[SOURCE]


FakeReader#

@DatasetReader.register("fake")
class FakeReader(DatasetReader):
 | def __init__(
 |     self,
 |     transformer_model_name: str = "roberta-large",
 |     length_limit: int = 512,
 |     **kwargs
 | ) -> None

Creates fake multiple-choice input. If your model doesn't get 99% on this data, it is broken.

Instances have two fields: * alternatives, a ListField of TextField * correct_alternative, IndexField with the correct answer among alternatives

Parameterstransformer_model_name : `str`, optional (default=`roberta-large`)

This reader chooses tokenizer and token indexer according to this setting.

length_limit : int, optional (default=512) We will make sure that the length of the alternatives never exceeds this many word pieces.

text_to_instance#

class FakeReader(DatasetReader):
 | ...
 | def text_to_instance(
 |     self,
 |     alternatives: List[str],
 |     correct_alternative: int
 | ) -> Instance

tokenize