-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshow_analysis.py
More file actions
53 lines (42 loc) · 1.38 KB
/
show_analysis.py
File metadata and controls
53 lines (42 loc) · 1.38 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
"""
Show complete reasoning analysis using the existing framework.
"""
import sys
from pathlib import Path
# Add src to path
sys.path.append(str(Path(__file__).parent / "src"))
from models.model_factory import ModelFactory
from adaptive.adaptive_cot import AdaptiveCoT
def main():
if len(sys.argv) < 3:
print("Usage: python show_analysis.py <problem> <model_path> [gpu_id]")
print("Example: python show_analysis.py 'What is 2+2?' '/path/to/model' 1")
sys.exit(1)
problem = sys.argv[1]
model_path = sys.argv[2]
gpu_id = int(sys.argv[3]) if len(sys.argv) > 3 else 1
print(f"🔬 Loading model: {model_path}")
# Load model using same type as working script
model = ModelFactory.create_model(
model_type="deepseek",
model_name=model_path,
config={"gpu_id": gpu_id}
)
model.load_model()
# Create Adaptive CoT
config = {
"adaptive_branching": True,
"min_branches": 3,
"max_branches": 5,
"default_branches": 5,
"num_fewshot": 8,
"entropy_threshold": 0.8,
"kl_threshold": 0.5,
"confidence_threshold": 0.7,
}
adaptive_cot = AdaptiveCoT(model, config)
# Show complete analysis with 5 branches
adaptive_cot.show_complete_analysis(problem, num_branches=5)
if __name__ == "__main__":
main()