Spaces:
Sleeping

PERDYPTO commited on
Commit
aa74ac2
·
verified ·
1 Parent(s): d6fc0ed

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +6 -22
pipeline.py CHANGED
@@ -1,6 +1,6 @@
1
  #!/usr/bin/env python3
2
  # ============================================================
3
- # PIPELINE_API.PY — COORDINATOR‑WORKER PIPELINE (FIXED)
4
  # ============================================================
5
 
6
  import os
@@ -58,7 +58,7 @@ REMOTE_STATE = f"{REMOTE_ROOT}/state"
58
  REMOTE_FINAL = f"{REMOTE_ROOT}/final"
59
 
60
  # ----------------------------------------------------------------------
61
- # DATASETS
62
  # ----------------------------------------------------------------------
63
  DATASETS = [
64
  {
@@ -403,7 +403,7 @@ def get_interpreters():
403
  return interpreters
404
 
405
  # ----------------------------------------------------------------------
406
- # DATASET LOADER — FIXED: use select_columns instead of features
407
  # ----------------------------------------------------------------------
408
  def load_stream(cfg):
409
  kwargs = {"split": cfg["split"], "streaming": True, "token": HF_TOKEN}
@@ -414,25 +414,9 @@ def load_stream(cfg):
414
  if cfg.get("languages"):
415
  kwargs["languages"] = cfg["languages"]
416
 
417
- # Load the dataset
418
- ds = load_dataset(cfg["dataset"], **kwargs)
419
-
420
- # Only select columns we actually need (avoids the cast error)
421
- # The dataset has many columns; we only need these few
422
- needed_columns = ["text", "repo_name", "path", "license"]
423
-
424
- # Some datasets might use different column names, so check what exists
425
- existing_cols = [col for col in needed_columns if col in ds.column_names]
426
-
427
- if existing_cols:
428
- try:
429
- ds = ds.select_columns(existing_cols)
430
- print(f"[LOAD] {cfg['name']}: selected columns: {existing_cols}")
431
- except Exception as e:
432
- # If select_columns fails (e.g., in streaming mode), fall back to keeping all columns
433
- print(f"[LOAD] {cfg['name']}: select_columns failed ({e}), keeping all columns")
434
-
435
- return ds
436
 
437
  # ----------------------------------------------------------------------
438
  # WORKER FUNCTION
 
1
  #!/usr/bin/env python3
2
  # ============================================================
3
+ # PIPELINE_API.PY — COORDINATOR‑WORKER PIPELINE (FINAL)
4
  # ============================================================
5
 
6
  import os
 
58
  REMOTE_FINAL = f"{REMOTE_ROOT}/final"
59
 
60
  # ----------------------------------------------------------------------
61
+ # DATASETS (unchanged)
62
  # ----------------------------------------------------------------------
63
  DATASETS = [
64
  {
 
403
  return interpreters
404
 
405
  # ----------------------------------------------------------------------
406
+ # DATASET LOADER — NO COLUMN FILTERING
407
  # ----------------------------------------------------------------------
408
  def load_stream(cfg):
409
  kwargs = {"split": cfg["split"], "streaming": True, "token": HF_TOKEN}
 
414
  if cfg.get("languages"):
415
  kwargs["languages"] = cfg["languages"]
416
 
417
+ # Load the full dataset without column filtering.
418
+ # extract_record will pull only the fields we need from each row.
419
+ return load_dataset(cfg["dataset"], **kwargs)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
420
 
421
  # ----------------------------------------------------------------------
422
  # WORKER FUNCTION