Skip to content

Commit

Permalink
Fix score call indentation
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Wolf <[email protected]>
  • Loading branch information
ryantwolf committed Mar 27, 2024
1 parent 2e96a9c commit 34f2d7f
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions nemo_curator/modules/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ def __init__(self, score_fn, score_field, text_field="text", score_type=None):
self.text_field = text_field
self.score_type = score_type

def __call__(self, dataset):
# Set the metadata for the function calls if provided
if self.score_type:
meta = (None, self.score_type)
else:
meta = no_default

if is_batched(self.score_fn):
dataset.df[self.score_field] = dataset.df[
self.text_field
].map_partitions(self.score_fn, meta=meta)
else:
dataset.df[self.score_field] = dataset.df[self.text_field].apply(
self.score_fn, meta=meta
)

return dataset
def __call__(self, dataset):
# Set the metadata for the function calls if provided
if self.score_type:
meta = (None, self.score_type)
else:
meta = no_default

if is_batched(self.score_fn):
dataset.df[self.score_field] = dataset.df[self.text_field].map_partitions(
self.score_fn, meta=meta
)
else:
dataset.df[self.score_field] = dataset.df[self.text_field].apply(
self.score_fn, meta=meta
)

return dataset


class Filter:
Expand Down

0 comments on commit 34f2d7f

Please sign in to comment.