-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
168 lines (144 loc) · 4.92 KB
/
Makefile
File metadata and controls
168 lines (144 loc) · 4.92 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# Makefile for math-eval dataset generator
.PHONY: help setup test clean install run-small run-medium run-large inference-setup inference-test inference-demo
# Default target
help:
@echo "Math-Eval Dataset Generator"
@echo "=========================="
@echo ""
@echo "Available targets:"
@echo " setup - Set up the environment and install dependencies"
@echo " test - Run the test suite"
@echo " install - Install Python dependencies only"
@echo " clean - Clean up generated files and outputs"
@echo " run-small - Generate small dataset (10 equations)"
@echo " run-medium - Generate medium dataset (100 equations)"
@echo " run-large - Generate large dataset (1000 equations)"
@echo " verify - Verify sample equation files"
@echo ""
@echo "Inference targets:"
@echo " inference-setup - Set up inference environment"
@echo " inference-test - Test inference setup"
@echo " inference-demo - Run demo inference on sample data"
@echo ""
@echo "Examples:"
@echo " make setup"
@echo " make test"
@echo " make run-small"
@echo " make inference-demo"
# Setup the environment
setup:
@echo "Setting up math-eval environment..."
python setup.py
# Install dependencies
install:
@echo "Installing dependencies..."
pip install -r requirements.txt
# Run comprehensive tests
test:
@echo "Running test suite..."
python test_suite.py
# Clean up generated files
clean:
@echo "Cleaning up..."
rm -rf outputs/
rm -rf __pycache__/
rm -rf *.pyc
rm -f test_*.txt
rm -f *.log
@echo "Cleanup complete"
# Generate small dataset (10 equations)
run-small:
@echo "Generating small dataset (10 equations)..."
python run_pipeline.py --num_equations 10 --num_vars 2 --task all --output_dir outputs/small
# Generate medium dataset (100 equations)
run-medium:
@echo "Generating medium dataset (100 equations)..."
python run_pipeline.py --num_equations 100 --num_vars 2 --task all --output_dir outputs/medium
# Generate large dataset (1000 equations)
run-large:
@echo "Generating large dataset (1000 equations)..."
python run_pipeline.py --num_equations 1000 --num_vars 2 --task all --output_dir outputs/large
# Verify sample files
verify:
@echo "Verifying sample equation files..."
@if [ -f "two-vars.txt" ]; then \
python verifier.py --file two-vars.txt; \
else \
echo "two-vars.txt not found"; \
fi
@if [ -f "three-vars.txt" ]; then \
python verifier.py --file three-vars.txt; \
else \
echo "three-vars.txt not found"; \
fi
# Generate equations only
equations:
@echo "Generating equations only..."
python run_pipeline.py --num_equations 100 --task equations
# Generate visual representations only
visual:
@echo "Generating visual representations..."
python run_pipeline.py --task visual
# Generate counting questions only
counting:
@echo "Generating counting questions..."
python run_pipeline.py --task counting
# Quick test with minimal data
quick-test:
@echo "Running quick functionality test..."
python equation_generator.py --output_file quick_test.txt --num 3 --vars 2
python verifier.py --file quick_test.txt
rm -f quick_test.txt
@echo "Quick test passed!"
# Check code quality (if you have linting tools)
lint:
@echo "Checking code quality..."
@if command -v flake8 >/dev/null 2>&1; then \
flake8 *.py; \
else \
echo "flake8 not installed, skipping linting"; \
fi
# Display system info
info:
@echo "System Information:"
@echo "==================="
@python -c "import sys; print(f'Python: {sys.version}')"
@python -c "import platform; print(f'Platform: {platform.system()} {platform.release()}')"
@echo "Required packages:"
@pip list | grep -E "(numpy|pillow|tqdm)" || echo "Some packages may be missing"
# Inference-related targets
# Setup inference environment
inference-setup:
@echo "Setting up inference environment..."
python setup_inference.py --model_type all
# Setup only API models
inference-setup-api:
@echo "Setting up API models only..."
python setup_inference.py --model_type api
# Setup only open-source models
inference-setup-opensource:
@echo "Setting up open-source models only..."
python setup_inference.py --model_type opensource
# Test inference setup
inference-test:
@echo "Testing inference setup..."
python setup_inference.py --validate_only --model_type all
# Run demo inference
inference-demo:
@echo "Running demo inference..."
@if [ ! -f "inference_config.json" ]; then \
echo "Creating sample config..."; \
cp inference_config.json inference_config_sample.json; \
echo "Please edit inference_config_sample.json with your API keys"; \
fi
@echo "Demo inference requires datasets to be generated first"
@echo "Run: make run-small && python run_inference.py --help"
# Clean inference results
clean-inference:
@echo "Cleaning inference results..."
rm -rf inference_results/
rm -f *_results.csv
@echo "Inference cleanup complete"
# Complete clean including inference
clean-all: clean clean-inference
@echo "Complete cleanup finished"