(code_data_path, args_opt, process_fn=None, scale=1)
| 199 | |
| 200 | |
| 201 | def get_code_data_eval(code_data_path, args_opt, process_fn=None, scale=1): |
| 202 | datasets = [] |
| 203 | paths = [] |
| 204 | |
| 205 | for dir in sorted(os.listdir(code_data_path)): |
| 206 | sub_dirs = os.listdir(os.path.join(code_data_path, dir)) |
| 207 | for sub_dir in sub_dirs: |
| 208 | if os.path.exists(os.path.join(code_data_path, dir, sub_dir, 'data.mdb')) and os.path.exists( |
| 209 | os.path.join(code_data_path, dir, sub_dir, 'lock.mdb')): |
| 210 | paths.append(os.path.join(code_data_path, dir, sub_dir)) |
| 211 | |
| 212 | for full_path in paths: |
| 213 | if os.path.isdir(full_path): |
| 214 | print(f"Loading code data {full_path}") |
| 215 | data = LMDBDataset( |
| 216 | full_path, |
| 217 | process_fn=process_fn, |
| 218 | ) |
| 219 | data = PadDataset( |
| 220 | data, |
| 221 | args_opt.seq_length, |
| 222 | args_opt.eod_id, |
| 223 | ) |
| 224 | data = SubsetDataset( |
| 225 | data, |
| 226 | 0, |
| 227 | len(data) // 10, |
| 228 | ) |
| 229 | datasets.append(data) |
| 230 | datasets = ConcatDataset(datasets) |
| 231 | print(f"==valid dataset has {len(datasets)} items") |
| 232 | return datasets |
no test coverage detected