Execute the full web task pipeline: 1. Search datasets from HuggingFace 2. Probe each dataset with 1 sample to validate quality 3. Calculate sample distribution across valid datasets 4. Extract and format samples from valid datasets
(self, reporter=None)
| 254 | return formatted_samples |
| 255 | |
| 256 | def execute(self, reporter=None) -> Dataset: |
| 257 | """ |
| 258 | Execute the full web task pipeline: |
| 259 | 1. Search datasets from HuggingFace |
| 260 | 2. Probe each dataset with 1 sample to validate quality |
| 261 | 3. Calculate sample distribution across valid datasets |
| 262 | 4. Extract and format samples from valid datasets |
| 263 | """ |
| 264 | logger.info("=== Step: Starting Web Task Pipeline ===") |
| 265 | |
| 266 | # Search datasets |
| 267 | if reporter: |
| 268 | reporter.start_step("searching", "Searching Datasets", "Searching HuggingFace for relevant datasets...") |
| 269 | |
| 270 | datasets = self.search_datasets() |
| 271 | |
| 272 | if not datasets: |
| 273 | error_msg = ( |
| 274 | "No datasets found for the given keywords. " |
| 275 | "Please adjust your task_instruction or domain to match available HuggingFace datasets." |
| 276 | ) |
| 277 | logger.error(error_msg) |
| 278 | raise ValueError(error_msg) |
| 279 | |
| 280 | if reporter: |
| 281 | reporter.complete_step({ |
| 282 | "message": f"Found {len(datasets)} datasets", |
| 283 | "datasets_found": len(datasets), |
| 284 | "datasets": [{"id": d["id"], "keyword": d["keyword"]} for d in datasets] |
| 285 | }) |
| 286 | |
| 287 | # Probe and validate datasets |
| 288 | if reporter: |
| 289 | reporter.start_step( |
| 290 | "validating", "Validating Datasets", |
| 291 | message="Probing datasets and scoring quality...", |
| 292 | total=len(datasets), |
| 293 | unit="datasets" |
| 294 | ) |
| 295 | |
| 296 | scored_datasets = self.validate_datasets(datasets) |
| 297 | |
| 298 | if not scored_datasets: |
| 299 | error_msg = ( |
| 300 | "No valid datasets found after probing. " |
| 301 | "All datasets failed validation (missing input/output fields or empty values)." |
| 302 | ) |
| 303 | logger.error(error_msg) |
| 304 | raise ValueError(error_msg) |
| 305 | |
| 306 | # Calculate distribution using sequential score-based approach |
| 307 | datasets_to_use = self.calculate_distribution(scored_datasets, self.config.num_samples) |
| 308 | |
| 309 | if reporter: |
| 310 | reporter.complete_step({ |
| 311 | "message": f"Validated {len(scored_datasets)} datasets, using top {len(datasets_to_use)}", |
| 312 | "total_datasets": len(scored_datasets), |
| 313 | "datasets_to_use": [{"id": d["id"], "score": d["overall_score"], "samples_to_extract": d["samples_to_extract"]} for d in datasets_to_use] |
nothing calls this directly
no test coverage detected