detector_benchmark.detector.bert_detector¶

Classes¶

Module Contents¶

class detector_benchmark.detector.bert_detector.BertDetector(model: torch.nn.Module, tokenizer: transformers.PreTrainedTokenizerBase, device: str)¶

Bases: detector_benchmark.detector.detector.Detector

model¶
tokenizer¶
device¶
detect(texts: list[str], batch_size: int, detection_threshold: float = 0.0) tuple[list[int], list[float], list[int]]¶

Detect the if the texts given as input are AI-generated (label 1) or human-written (label 0). Returns the predicted lables with argmax, the logits of the positive class and the predicted labels with the given detection threshold instead of the argmax.

Parameters:¶

texts: list[str]

The texts to detect

batch_size: int

The batch size to use for detection

detection_threshold: float

The threshold to use for detection. Default is 0.0.

Returns:¶

tuple[list[int], list[float], list[int]]

The predicted labels with argmax, the logits of the positive class and the predicted labels with the given detection threshold instead of the argmax.