pyabsa.tasks.CodeDefectDetection.prediction.code_defect_detector¶
Classes¶
Module Contents¶
- class pyabsa.tasks.CodeDefectDetection.prediction.code_defect_detector.CodeDefectDetector(checkpoint=None, cal_perplexity=False, **kwargs)¶
Bases:
pyabsa.framework.prediction_class.predictor_template.InferenceModel- task_code = 'CDD'¶
- _log_write_args()¶
- batch_infer(target_file=None, print_result=True, save_result=False, ignore_error=True, **kwargs)¶
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)¶
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)¶
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)¶
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)¶
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()¶
- class pyabsa.tasks.CodeDefectDetection.prediction.code_defect_detector.Predictor(checkpoint=None, cal_perplexity=False, **kwargs)¶
Bases:
CodeDefectDetector