predictors

class transfer_nlp.plugins.predictors.PredictorABC(vectorizer: transfer_nlp.loaders.vectorizers.Vectorizer, model: torch.nn.Module)[source]
decode(*args, **kwargs) → List[Dict][source]

Return an output dictionary for every example in the batch :param args: :param kwargs: :return:

forward(batch: Dict[str, Any]) → torch.tensor[source]

Do the forward pass :param batch: :return:

json_to_data(input_json: Dict) → Dict[source]

Transform a json entry into a data example, which is the same that what the __getitem__ method in the data loader, except that this does not output any expected label as in supervised setting :param input_json: :return:

json_to_json(input_json: Dict) → Dict[str, Any][source]

Full prediction: input_json –> data example –> predictions –> json output :param input_json: :return:

output_to_json(*args, **kwargs) → Dict[str, Any][source]

Convert the result into a proper json :param args: :param kwargs: :return:

predict(batch: Dict[str, Any]) → List[Dict][source]

Decode the output of the forward pass :param batch: :return: