Skip to content

Commit

Permalink
* opt: convert relative paths only when it's necessary (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
HYLcool committed Nov 17, 2023
1 parent afe06dc commit 9497ce5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions data_juicer/format/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,16 @@ def non_empty_text(sample, target_keys):

# 3. convert relative paths to absolute paths
if global_cfg:
ds_dir = global_cfg.dataset_dir
image_key = global_cfg.image_key

if image_key not in dataset.features:
# no image path list in dataset, no need to convert
return dataset

logger.info('Converting relative paths in the dataset to their '
'absolute version. (Based on the directory of input '
'dataset file)')
ds_dir = global_cfg.dataset_dir
image_key = global_cfg.image_key

# function to convert relative paths to absolute paths
def rel2abs(sample, path_keys, dataset_dir):
Expand Down

0 comments on commit 9497ce5

Please sign in to comment.