Skip to content

Commit

Permalink
Pad chunks to make batchable
Browse files Browse the repository at this point in the history
  • Loading branch information
daviswer committed Feb 6, 2025
1 parent 0acdf05 commit d146017
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/ibm_rescaling/rescaling_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@

# Build dataloader
data = ScalableReader(datapath, rank, world_size, ArrowHandler, -1, seed=args.seed, max_chunksize=30, n_logical_shards=args.logical_shards)
# Pad entries to make them batch-able
data = PreprocessDataset(data, lambda x: x + [-1]*(30-len))
# Statelessly convert all outputs to tensors
data = PreprocessDataset(data, torch.tensor)
# Wrap in StatefulDataLoader
Expand Down

0 comments on commit d146017

Please sign in to comment.