dslighting 1.7.8__py3-none-any.whl → 1.7.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
dslighting/__init__.py CHANGED
@@ -26,7 +26,7 @@ Advanced Usage:
26
26
  For more information, see: https://github.com/usail-hkust/dslighting
27
27
  """
28
28
 
29
- __version__ = "1.7.8"
29
+ __version__ = "1.7.16"
30
30
  __author__ = "DSLighting Team"
31
31
 
32
32
  # Core API classes
dslighting/core/agent.py CHANGED
@@ -377,8 +377,9 @@ class Agent:
377
377
  print(f"[DEBUG 9] Registry not available, skipping grading")
378
378
  else:
379
379
  print(f"[DEBUG 10] Registry available, proceeding with initialization")
380
- # Initialize benchmark with registry
381
- registry_kwargs = {"data_dir": data_dir_path, "registry_dir": str(registry_dir)}
380
+ # Initialize benchmark with registry (keep as Path objects)
381
+ registry_dir_path = Path(registry_dir) if not isinstance(registry_dir, Path) else registry_dir
382
+ registry_kwargs = {"data_dir": data_dir_path, "registry_dir": registry_dir_path}
382
383
 
383
384
  try:
384
385
  print(f"[DEBUG 11] Creating Registry with kwargs: {registry_kwargs}")
@@ -392,17 +393,113 @@ class Agent:
392
393
 
393
394
  # Create simple wrapper class
394
395
  class SimpleMLEBenchmark:
395
- def __init__(self, registry_instance):
396
+ def __init__(self, registry_instance, logger, registry_dir, data_dir, task_id):
396
397
  self.registry = registry_instance
397
398
  self.problems = [{"competition_id": task_id}]
399
+ self.logger = logger
400
+ self.registry_dir = registry_dir
401
+ self.data_dir = data_dir
402
+ self.task_id = task_id
398
403
 
399
404
  async def grade(self, submission_path):
400
405
  """Grade submission using custom registry."""
401
406
  try:
402
- competition = self.registry.get_competition(task_id)
407
+ # Read config directly from registry
408
+ import yaml
409
+ config_path = self.registry_dir / self.task_id / "config.yaml"
410
+
411
+ if not config_path.exists():
412
+ self.logger.warning(f" Config not found: {config_path}")
413
+ return 0.0
414
+
415
+ with open(config_path) as f:
416
+ config = yaml.safe_load(f)
417
+
418
+ # Resolve paths relative to data_dir (from config.yaml)
419
+ # self.data_dir is the parent directory (e.g., /path/to/competitions)
420
+ # config["dataset"]["answers"] is relative path like "bike-sharing-demand/prepared/private/test_answer.csv"
421
+ answers_rel_path = config.get("dataset", {}).get("answers", "")
422
+ answers_path = self.data_dir / answers_rel_path
423
+
424
+ if not answers_path.exists():
425
+ self.logger.warning(f" Answers file not found: {answers_path}")
426
+ self.logger.warning(f" Looking for: {answers_path}")
427
+ return 0.0
428
+
429
+ self.logger.info(f" Found answers file: {answers_path}")
430
+
431
+ # Import the actual Competition class from mlebench
432
+ from mlebench.registry import Competition
433
+ from mlebench.grade_helpers import Grader
434
+
435
+ # Load grader
436
+ grader_config = config.get("grader", {})
437
+ grader_name = grader_config.get("name", "rmsle")
438
+
439
+ # Import grade function if specified
440
+ grade_fn = None
441
+ if "grade_fn" in grader_config:
442
+ # Parse grade_fn format: mlebench.competitions.bike_sharing_demand.grade:grade
443
+ fn_str = grader_config["grade_fn"]
444
+ if ":" in fn_str:
445
+ module_path, fn_name = fn_str.rsplit(":", 1)
446
+ # Convert to file import if needed
447
+ if not module_path.startswith("file:"):
448
+ fn_file = self.registry_dir / self.task_id / "grade.py"
449
+ if fn_file.exists():
450
+ fn_str = f"file:{fn_file}:{fn_name}"
451
+ else:
452
+ # Try to import from mlebench
453
+ try:
454
+ import importlib
455
+ importlib.import_module(module_path)
456
+ except:
457
+ pass
458
+
459
+ # Create a simple grader
460
+ if grade_fn or fn_str:
461
+ grader = Grader(
462
+ name=grader_name,
463
+ grade_fn=fn_str if fn_str else grade_fn,
464
+ )
465
+ else:
466
+ # Default RMSLE grader
467
+ grader = Grader(name="rmsle", grade_fn=None)
468
+
469
+ # Resolve paths
470
+ competition_dir = self.data_dir / self.task_id
471
+ private_dir = competition_dir / "prepared" / "private"
472
+ public_dir = competition_dir / "prepared" / "public"
473
+ raw_dir = competition_dir / "raw"
474
+ checksums = competition_dir / "checksums.txt"
475
+ leaderboard = competition_dir / "leaderboard.csv"
476
+
477
+ # Create placeholder prepare_fn
478
+ def dummy_prepare_fn(a, b, c):
479
+ return private_dir
480
+
481
+ # Create actual Competition object with all required fields
482
+ simple_comp = Competition(
483
+ id=config["id"],
484
+ name=config["name"],
485
+ description=config.get("description", ""),
486
+ grader=grader,
487
+ answers=answers_path,
488
+ gold_submission=answers_path, # Use same as answers for grading
489
+ sample_submission=public_dir / "sampleSubmission.csv",
490
+ competition_type=config.get("competition_type", "standard"),
491
+ prepare_fn=dummy_prepare_fn,
492
+ raw_dir=raw_dir,
493
+ private_dir=private_dir,
494
+ public_dir=public_dir,
495
+ checksums=checksums,
496
+ leaderboard=leaderboard,
497
+ )
498
+
499
+ # Grade using mlebench's grade_csv
403
500
  report = grade_csv(
404
501
  submission_path,
405
- competition,
502
+ simple_comp,
406
503
  )
407
504
  # Return the score (float), not the entire report
408
505
  score = report.score if report.score is not None else 0.0
@@ -410,9 +507,11 @@ class Agent:
410
507
  return score
411
508
  except Exception as e:
412
509
  self.logger.warning(f" Grading failed: {e}")
510
+ import traceback
511
+ self.logger.warning(f" Traceback: {traceback.format_exc()}")
413
512
  return 0.0
414
513
 
415
- benchmark = SimpleMLEBenchmark(custom_registry)
514
+ benchmark = SimpleMLEBenchmark(custom_registry, self.logger, registry_dir_path, data_dir_path, task_id)
416
515
  runner = self.get_runner()
417
516
  runner.benchmark = benchmark
418
517
  print(f"[DEBUG 13] ✓ Benchmark set successfully for task: {task_id}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dslighting
3
- Version: 1.7.8
3
+ Version: 1.7.16
4
4
  Summary: Simplified API for Data Science Agent Automation
5
5
  Author: DSLighting Team
6
6
  License: AGPL-3.0
@@ -32,6 +32,10 @@ Requires-Dist: torch>=2.0.0
32
32
  Requires-Dist: scikit-learn>=1.0.0
33
33
  Requires-Dist: diskcache
34
34
  Requires-Dist: tenacity
35
+ Requires-Dist: appdirs
36
+ Requires-Dist: pyyaml
37
+ Requires-Dist: tqdm
38
+ Requires-Dist: py7zr
35
39
  Requires-Dist: nbformat
36
40
  Requires-Dist: nbclient
37
41
  Provides-Extra: full
@@ -66,9 +66,9 @@ dsat/workflows/search/aide_workflow.py,sha256=mxIGXcueZGXpv1RXsQJ0YPWtvzICaFQeJo
66
66
  dsat/workflows/search/automind_workflow.py,sha256=b2JzqUDnDOt_SQdtAvC0fBCJzgTadLylbpgmpaS63Ls,12573
67
67
  dsat/workflows/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
68
68
  dsat/workflows/templates/basic_kaggle_loop.py,sha256=e6YLEpCArgWfKViwoti7SdygHsHp43sqP6VyMqnOJaA,3128
69
- dslighting/__init__.py,sha256=Q-q-kEjPM7UmlYlViXZX4Q8re3_Pg5eUssl-8sMbR_E,5152
69
+ dslighting/__init__.py,sha256=EB2LmdQzrd-rZB6fEyW7QRG2q58I2X9QonTsMihkii4,5153
70
70
  dslighting/core/__init__.py,sha256=T4yYs0RQoz6DBarjOk12PeZq9YoPYrfl3Os0CPlzcB0,252
71
- dslighting/core/agent.py,sha256=nZEQcCqG4KTc3Iqz2yGdxYIJ_n6UPzyAK_Fmaa71wP8,31388
71
+ dslighting/core/agent.py,sha256=qiAqJwrhry3T_HBfEndkghtRCy02uGUiHod4hpLkm9w,38211
72
72
  dslighting/core/config_builder.py,sha256=JMDW0JFj6PRCeP70D1Td8FYXC1bIupe4H6m8J1caO7Y,10294
73
73
  dslighting/core/data_loader.py,sha256=HdcDN-10FYfViu8Z0RSYjA2ne6VXVbfKEOZO7EpxLIc,25003
74
74
  dslighting/core/task_detector.py,sha256=xOYAV9yiboC8lDeDIEtxvucaGi6fENfeycrowWs-kP0,16300
@@ -2446,8 +2446,8 @@ mlebench/competitions/vinbigdata-chest-xray-abnormalities-detection/prepare_val.
2446
2446
  mlebench/competitions/whale-categorization-playground/grade.py,sha256=Wl1fNvpapAmc_Cdy2Cp68nEqeHB2XKnN91U9t-YLlXQ,1562
2447
2447
  mlebench/competitions/whale-categorization-playground/prepare.py,sha256=huo8fDBcGR413JF8m8Js8l8gkFCZpWL1st7Yd57Rjg8,4199
2448
2448
  mlebench/competitions/whale-categorization-playground/prepare_val.py,sha256=XvdnOvEJyTxovXQsoKLMKA_J6EMdxkpOe_SIgEdoOx8,7486
2449
- dslighting-1.7.8.dist-info/METADATA,sha256=_aT7IWO_N5aRJYEj0RAIJVdiZSPA89UHKiiUEUzgh1M,18239
2450
- dslighting-1.7.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
2451
- dslighting-1.7.8.dist-info/entry_points.txt,sha256=1xqIWL9-EG9t7nkERVeNRtMoRyIQe-6CJZJN-rdCYFQ,91
2452
- dslighting-1.7.8.dist-info/top_level.txt,sha256=cmZU3ri0tz1IjiTKrz85Ih9614QlCrYqSqzlPMgaSM0,25
2453
- dslighting-1.7.8.dist-info/RECORD,,
2449
+ dslighting-1.7.16.dist-info/METADATA,sha256=CqHn1grvJF-lyY06Q3GB9-0VKnwpyQSK98MsZBEvPEk,18326
2450
+ dslighting-1.7.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
2451
+ dslighting-1.7.16.dist-info/entry_points.txt,sha256=1xqIWL9-EG9t7nkERVeNRtMoRyIQe-6CJZJN-rdCYFQ,91
2452
+ dslighting-1.7.16.dist-info/top_level.txt,sha256=cmZU3ri0tz1IjiTKrz85Ih9614QlCrYqSqzlPMgaSM0,25
2453
+ dslighting-1.7.16.dist-info/RECORD,,