Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix for un-aligned types (int v.s. float) caused by two OPs #147

Merged
merged 3 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions data_juicer/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,14 @@ def init_setup_from_cfg(cfg):
"""

cfg.export_path = os.path.abspath(cfg.export_path)
export_path = cfg.export_path
cfg.work_dir = os.path.dirname(export_path)
cfg.work_dir = os.path.dirname(cfg.export_path)
export_rel_path = os.path.relpath(cfg.export_path, start=cfg.work_dir)
log_dir = os.path.join(cfg.work_dir, 'log')
if not os.path.exists(log_dir):
os.makedirs(log_dir, exist_ok=True)
timestamp = time.strftime('%Y%m%d%H%M%S', time.localtime(time.time()))
cfg.timestamp = timestamp
logfile_name = timestamp + '.txt'
logfile_name = f'export_{export_rel_path}_time_{timestamp}.txt'
setup_logger(save_dir=log_dir,
filename=logfile_name,
redirect=cfg.executor_type == 'default')
Expand Down
2 changes: 1 addition & 1 deletion data_juicer/ops/filter/average_line_length_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def compute_stats(self, sample, context=False):
sample[Fields.context][context_key] = lines
sample[Fields.stats][StatsKeys.avg_line_length] = \
len(sample[self.text_key]) / len(lines) \
if len(lines) != 0 else 0.0
if len(lines) != 0 else 0
HYLcool marked this conversation as resolved.
Show resolved Hide resolved
return sample

def process(self, sample):
Expand Down
2 changes: 1 addition & 1 deletion data_juicer/ops/filter/maximum_line_length_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def compute_stats(self, sample, context=False):
sample[Fields.context][context_key] = lines
line_lengths = list(map(len, lines))
sample[Fields.stats][StatsKeys.max_line_length] = max(
line_lengths) if line_lengths else 0.0
line_lengths) if line_lengths else 0
return sample

def process(self, sample):
Expand Down