-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_biomind_inference.py
More file actions
33 lines (28 loc) · 1.25 KB
/
Copy pathtest_biomind_inference.py
File metadata and controls
33 lines (28 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import torch
from biomind_reasoning_pipeline import TrainedBIOMINDPipeline
# Load the trained model
pipeline = TrainedBIOMINDPipeline(model_path='biomind_phase2_complete_model.pth')
# Test with a simple question
test_question = 'What is 2 + 2?'
test_choices = ['2', '3', '4', '5']
test_subject = 'elementary_mathematics'
result = pipeline(test_question, test_choices, test_subject)
print('Question:', test_question)
print('Choices:', test_choices)
print('Predicted Answer:', result['predicted_answer'])
print('Predicted Index:', result['predicted_answer_idx'])
print('Correct Answer should be: C (4)')
print('Confidence:', result['confidence'])
print('Selected Specialist:', result['selected_specialist'])
# Test with another question
test_question2 = 'What is the capital of France?'
test_choices2 = ['London', 'Berlin', 'Paris', 'Madrid']
test_subject2 = 'miscellaneous'
result2 = pipeline(test_question2, test_choices2, test_subject2)
print('\nQuestion:', test_question2)
print('Choices:', test_choices2)
print('Predicted Answer:', result2['predicted_answer'])
print('Predicted Index:', result2['predicted_answer_idx'])
print('Correct Answer should be: C (Paris)')
print('Confidence:', result2['confidence'])
print('Selected Specialist:', result2['selected_specialist'])