Update README.md
Browse files
README.md
CHANGED
|
@@ -57,6 +57,57 @@ The model was evaluated on the test split of the `LLMTrace Detection dataset`. T
|
|
| 57 |
| mAP @ IoU=0.5 | 0.8976 |
|
| 58 |
| mAP @ IoU=0.5:0.95 | 0.7921 |
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
## Citation
|
| 62 |
|
|
|
|
| 57 |
| mAP @ IoU=0.5 | 0.8976 |
|
| 58 |
| mAP @ IoU=0.5:0.95 | 0.7921 |
|
| 59 |
|
| 60 |
+
## Quick start
|
| 61 |
+
|
| 62 |
+
Requirements:
|
| 63 |
+
- python3.11
|
| 64 |
+
- [gigacheck](https://github.com/ai-forever/gigacheck)
|
| 65 |
+
|
| 66 |
+
```bash
|
| 67 |
+
pip install git+https://github.com/ai-forever/gigacheck
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
### Inference with transformers (with trust_remote_code=True)
|
| 71 |
+
|
| 72 |
+
```python
|
| 73 |
+
from transformers import AutoModel
|
| 74 |
+
import torch
|
| 75 |
+
|
| 76 |
+
model_name = "iitolstykh/GigaCheck-Detector-Multi"
|
| 77 |
+
gigacheck_model = AutoModel.from_pretrained(
|
| 78 |
+
model_name, trust_remote_code=True, device_map="cuda:0", torch_dtype=torch.float32
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
text = "The critic's review of the recent publication was scathing. The book failed miserably in portraying the harmful subjective discourses associated with the hegemony of the political system."
|
| 82 |
+
|
| 83 |
+
output = gigacheck_model([text], conf_interval_thresh=0.5)
|
| 84 |
+
|
| 85 |
+
# [(start_char, end_char, score)]
|
| 86 |
+
print(output.ai_intervals)
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
### Inference with gigacheck
|
| 90 |
+
|
| 91 |
+
```python
|
| 92 |
+
from transformers import AutoConfig
|
| 93 |
+
from gigacheck.inference.src.mistral_detector import MistralDetector
|
| 94 |
+
import torch
|
| 95 |
+
|
| 96 |
+
model_name = "iitolstykh/GigaCheck-Detector-Multi"
|
| 97 |
+
|
| 98 |
+
config = AutoConfig.from_pretrained(model_name)
|
| 99 |
+
model = MistralDetector(
|
| 100 |
+
max_seq_len=config.max_length,
|
| 101 |
+
with_detr=config.with_detr,
|
| 102 |
+
id2label=config.id2label,
|
| 103 |
+
device="cpu" if not torch.cuda.is_available() else "cuda:0",
|
| 104 |
+
conf_interval_thresh=0.5,
|
| 105 |
+
).from_pretrained(model_name)
|
| 106 |
+
|
| 107 |
+
text = "The critic's review of the recent publication was scathing. The book failed miserably in portraying the harmful subjective discourses associated with the hegemony of the political system."
|
| 108 |
+
output = model.predict(text)
|
| 109 |
+
print(output)
|
| 110 |
+
```
|
| 111 |
|
| 112 |
## Citation
|
| 113 |
|