primeqa.qg.models.qg_model.QGModel#
- class primeqa.qg.models.qg_model.QGModel(model_path, modality='table', lang='en')#
Bases:
object
Methods
generate_questions
Our approach to pruning hallucinated questions uses an entity lookup to check that a generated entity or a part of it is present in the hybrid context.
Attributes
Propery of TableQG model.
Property of TableQG model.
- property model#
Propery of TableQG model.
- Returns
Sequence to sequence model object (based on model name)
- prune_hallucinations(qdicts, num_instances=5, hallucination_prop=0.25)#
Our approach to pruning hallucinated questions uses an entity lookup to check that a generated entity or a part of it is present in the hybrid context. If the entity is not present, the question and the entity are considered to be hallucinated.
- Parameters
qdicts (list) – A list of dicts, each dict contains, an answer, context and (num_instances) generated questions.
- Returns
Updated qdicts without any hallucinated questions. Each dict will have only one question now.
- property tokenizer#
Property of TableQG model.
- Returns
Tokenizer class object based on the model name/ path