| 147 | } |
| 148 | |
| 149 | int main(int argc, char ** argv) { |
| 150 | if (argc < 5) { |
| 151 | fprintf(stderr, "Usage: %s <ref_dir> <prephase_ref_dir> <model_path> <cases_tsv>\n", argv[0]); |
| 152 | return 1; |
| 153 | } |
| 154 | |
| 155 | const std::string ref_dir = argv[1]; |
| 156 | const std::string prephase_ref_dir = argv[2]; |
| 157 | const std::string model_path = argv[3]; |
| 158 | const std::string cases_path = argv[4]; |
| 159 | const std::string cpp_root = ref_dir + "/cpp_out_phase6"; |
| 160 | |
| 161 | auto cases = load_cases(cases_path); |
| 162 | if (cases.empty()) { |
| 163 | fprintf(stderr, "No phase 6 cases loaded from %s\n", cases_path.c_str()); |
| 164 | return 1; |
| 165 | } |
| 166 | |
| 167 | if (!ensure_dir(cpp_root)) { |
| 168 | fprintf(stderr, "Failed to create %s\n", cpp_root.c_str()); |
| 169 | return 1; |
| 170 | } |
| 171 | |
| 172 | sam3_params params; |
| 173 | params.model_path = model_path; |
| 174 | params.n_threads = 1; |
| 175 | params.use_gpu = false; |
| 176 | |
| 177 | auto model = sam3_load_model(params); |
| 178 | if (!model) { |
| 179 | fprintf(stderr, "Failed to load model from %s\n", model_path.c_str()); |
| 180 | return 1; |
| 181 | } |
| 182 | |
| 183 | const auto tensors = tensor_cases(); |
| 184 | bool overall_ok = true; |
| 185 | |
| 186 | struct row_print { |
| 187 | std::string case_id; |
| 188 | std::string label; |
| 189 | float max_diff = 0.0f; |
| 190 | float mean_diff = 0.0f; |
| 191 | float cosine = 0.0f; |
| 192 | float tol = 0.0f; |
| 193 | std::string status; |
| 194 | std::string note; |
| 195 | }; |
| 196 | std::vector<row_print> report; |
| 197 | |
| 198 | for (const auto & tc : cases) { |
| 199 | fprintf(stderr, "\n=== Phase 6 Case %s ===\n", tc.id.c_str()); |
| 200 | |
| 201 | const std::string case_ref_dir = ref_dir + "/" + tc.id; |
| 202 | const std::string case_cpp_dir = cpp_root + "/" + tc.id; |
| 203 | if (!ensure_dir(case_cpp_dir)) { |
| 204 | fprintf(stderr, "Failed to create %s\n", case_cpp_dir.c_str()); |
| 205 | overall_ok = false; |
| 206 | continue; |
nothing calls this directly
no test coverage detected