Skip to content

Commit

Permalink
using chunked instead of ichunked #238
Browse files Browse the repository at this point in the history
  • Loading branch information
cmacdonald authored Nov 8, 2021
2 parents e6ba40c + 857e72e commit 2fcc017
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pyterrier/transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ class ComposedPipeline(NAryTransformerBase):
name = "Compose"

def index(self, iter : Iterable[dict], batch_size=100):
from more_itertools import ichunked
from more_itertools import chunked

if len(self.models) > 2:
#this compose could have > 2 models. we need a composite transform() on all but the last
Expand All @@ -834,7 +834,7 @@ def index(self, iter : Iterable[dict], batch_size=100):
last_transformer = self.models[-1]

def gen():
for batch in ichunked(iter, batch_size):
for batch in chunked(iter, batch_size):
batch_df = prev_transformer.transform_iter(batch)
for row in batch_df.itertuples(index=False):
yield row._asdict()
Expand Down

0 comments on commit 2fcc017

Please sign in to comment.