Commit 3f4fe8c7 authored by Мазур Грета Евгеньевна's avatar Мазур Грета Евгеньевна
Browse files

proverka obuchenya

parent 17d77dde
No related merge requests found
Showing with 8 additions and 4 deletions
+8 -4
...@@ -183,9 +183,11 @@ def classify_prompt(prompt, tokenizer, model): ...@@ -183,9 +183,11 @@ def classify_prompt(prompt, tokenizer, model):
"safety": safety_label, "safety": safety_label,
"attack_type": attack_label, "attack_type": attack_label,
"safety_confidence": round(probs_safety[0, pred_safety].item(), 4), "safety_confidence": round(probs_safety[0, pred_safety].item(), 4),
"attack_confidence": round(probs_attack[0, pred_attack].item(), 4) if safety_label == "unsafe" else 0.0 "attack_confidence": round(probs_attack[0, pred_attack].item(), 4) if safety_label == "unsafe" else 0.0,
"safety_probs": probs_safety.tolist(),
"attack_probs": probs_attack.tolist()
} }
def main(): def main():
MODEL_PATH = "./fine-tuned-bert-lora-multi-task" MODEL_PATH = "./fine-tuned-bert-lora-multi-task"
......
...@@ -183,9 +183,11 @@ def classify_prompt(prompt, tokenizer, model): ...@@ -183,9 +183,11 @@ def classify_prompt(prompt, tokenizer, model):
"safety": safety_label, "safety": safety_label,
"attack_type": attack_label, "attack_type": attack_label,
"safety_confidence": round(probs_safety[0, pred_safety].item(), 4), "safety_confidence": round(probs_safety[0, pred_safety].item(), 4),
"attack_confidence": round(probs_attack[0, pred_attack].item(), 4) if safety_label == "unsafe" else 0.0 "attack_confidence": round(probs_attack[0, pred_attack].item(), 4) if safety_label == "unsafe" else 0.0,
"safety_probs": probs_safety.tolist(),
"attack_probs": probs_attack.tolist()
} }
def main(): def main():
MODEL_PATH = "./fine-tuned-bert-lora-multi-task" MODEL_PATH = "./fine-tuned-bert-lora-multi-task"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment