Datasets:

Formats:
parquet
Languages:
English
ArXiv:
Tags:
code
DOI:
Libraries:
Datasets
pandas
License:
tiginamaria commited on
Commit
0d2aa65
1 Parent(s): e537f5b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +17 -8
README.md CHANGED
@@ -457,26 +457,35 @@ This is the data for **Bug Localization** benchmark as part of LCA.
457
  ```py
458
  from huggingface_hub import hf_hub_download
459
  from datasets import load_dataset
460
-
 
 
461
  # Load json with list of repos' .tar.gz file paths
462
  paths_json = load_dataset("JetBrains-Research/lca-bug-localization", data_files="paths.json")
463
 
464
  # Load each repo in .tar.gz format, unzip, delete archive
465
- repos = paths_json["repos"][0]
 
466
 
467
- for i, repo_tar_path in enumerate(repos):
468
-
469
- local_repo_tars = hf_hub_download(
 
 
470
  "JetBrains-Research/lca-bug-localization",
471
- filename=repo_tar_path,
472
  repo_type="dataset",
473
  local_dir="local/dir"
474
  )
475
 
476
- result = subprocess.run(["tar", "-xzf", local_repo_tars, "-C", os.path.join("local/dir", "repos")])
477
- os.remove(local_repo_tars)
 
 
478
  ```
479
 
 
 
480
  ## Dataset Structure
481
 
482
  TODO: some overall structure or repo
 
457
  ```py
458
  from huggingface_hub import hf_hub_download
459
  from datasets import load_dataset
460
+ import zipfile
461
+ import os
462
+
463
  # Load json with list of repos' .tar.gz file paths
464
  paths_json = load_dataset("JetBrains-Research/lca-bug-localization", data_files="paths.json")
465
 
466
  # Load each repo in .tar.gz format, unzip, delete archive
467
+ repos = paths_json[configuration][0]
468
+ repos_path = "path/to/repos"
469
 
470
+ for i, repo_zip_path in enumerate(repos):
471
+ repo_name = os.path.basename(repo_zip_path).split('.')[0]
472
+ repo_path = os.path.join(repos_path, repo_name)
473
+ # Load zip file
474
+ local_repo_zip_path = hf_hub_download(
475
  "JetBrains-Research/lca-bug-localization",
476
+ filename=repo_zip_path,
477
  repo_type="dataset",
478
  local_dir="local/dir"
479
  )
480
 
481
+ # Unzip file
482
+ with zipfile.ZipFile(local_repo_zip_path, 'r') as zip_ref:
483
+ zip_ref.extractall(repo_path)
484
+ os.remove(local_repo_zip_path)
485
  ```
486
 
487
+ Moreover, all process of data loading and streaming is implemented in [HFDataSource](https://github.com/JetBrains-Research/lca-baselines/blob/main/bug_localization/src/baselines/data_sources/hf_data_source.py) which utilize Hugging Face data usage in banchmark infastructure.
488
+
489
  ## Dataset Structure
490
 
491
  TODO: some overall structure or repo