pyabsa.tasks.CodeDefectDetection.prediction.code_defect_detector

Module Contents

Classes

CodeDefectDetector

Predictor

class pyabsa.tasks.CodeDefectDetection.prediction.code_defect_detector.CodeDefectDetector(checkpoint=None, cal_perplexity=False, **kwargs)[source]

Bases: pyabsa.framework.prediction_class.predictor_template.InferenceModel

task_code[source]
_log_write_args()[source]
batch_infer(target_file=None, print_result=True, save_result=False, ignore_error=True, **kwargs)[source]

Perform batch inference on a given target file.

Args: - target_file: A file containing text inputs to perform inference on - print_result: Whether to print the result of each prediction - save_result: Whether to save the result of each prediction - ignore_error: Whether to ignore errors encountered during inference - **kwargs: Additional keyword arguments to be passed to batch_predict method

Returns: - A list of prediction results

infer(text: str | list = None, print_result=True, ignore_error=True, **kwargs)[source]

Perform inference on a given text input.

Args: - text: The text inputs to perform inference on - print_result: Whether to print the result of each prediction - ignore_error: Whether to ignore errors encountered during inference - **kwargs: Additional keyword arguments to be passed to predict method

Returns: - A list of prediction results

batch_predict(target_file=None, print_result=True, save_result=False, ignore_error=True, **kwargs)[source]

Predict from a file of labelences. param: target_file: the file path of the labelences to be predicted. param: print_result: whether to print the result. param: save_result: whether to save the result. param: ignore_error: whether to ignore the error when predicting. param: kwargs: other parameters.

predict(text: str | list = None, print_result=True, ignore_error=True, **kwargs)[source]

Predict from a labelence or a list of labelences. param: text: the labelence or a list of labelence to be predicted. param: print_result: whether to print the result. param: ignore_error: whether to ignore the error when predicting. param: kwargs: other parameters.

_run_prediction(save_path=None, print_result=True)[source]

This method should be implemented in the subclass for running predictions using the trained model.

Parameters:

kwargs – additional keyword arguments

Returns:

predicted labels or other prediction outputs

clear_input_samples()[source]
class pyabsa.tasks.CodeDefectDetection.prediction.code_defect_detector.Predictor(checkpoint=None, cal_perplexity=False, **kwargs)[source]

Bases: CodeDefectDetector