langtest.modelhandler.transformers_modelhandler.PretrainedModelForDisinformation#

class PretrainedModelForDisinformation(model, **kwargs)#

Bases: PretrainedModelForQA, ModelAPI

A class representing a pretrained model for disinformation. Inherits:

PretrainedModelForQA: The base class for pretrained models.

__init__(model, **kwargs)#

Initialize the PretrainedModelForQA instance.

Parameters: - model (HuggingFacePipeline): An instance of the HuggingFacePipeline class for handling the pretrained model. - **kwargs: Additional keyword arguments.

Methods

__init__(model, **kwargs)

Initialize the PretrainedModelForQA instance.

load_model(path, **kwargs)

Load a pretrained model from a specified path or configuration.

predict(text, prompt, **kwargs)

Generate a prediction for the given text and prompt.

Attributes

model_registry

classmethod load_model(path: str, **kwargs)#

Load a pretrained model from a specified path or configuration.

Parameters: - path (str): The path or configuration for loading the pretrained model. - **kwargs: Additional keyword arguments.

Returns: - PretrainedModelForQA: An instance of the PretrainedModelForQA class.

predict(text: str | dict, prompt: dict, **kwargs) str#

Generate a prediction for the given text and prompt.

Parameters: - text (Union[str, dict]): The input text or dictionary containing relevant information. - prompt (dict): The prompt template for generating the question. - **kwargs: Additional keyword arguments.

Returns: - str: The generated prediction.