Skip to content

Commit

Permalink
Set drop_last to always True (pytorch#1761)
Browse files Browse the repository at this point in the history
  • Loading branch information
RdoubleA authored and mori360 committed Oct 14, 2024
1 parent 951294f commit a20dd56
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion recipes/full_finetune_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def _setup_data(
batch_size=batch_size,
sampler=sampler,
# dropping last avoids shape issues with compile + flex attention
drop_last=cfg_dataset.get("drop_last", True),
drop_last=True,
collate_fn=partial(
collate_fn,
padding_idx=self._tokenizer.pad_id,
Expand Down
2 changes: 1 addition & 1 deletion recipes/full_finetune_single_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def _setup_data(
batch_size=batch_size,
sampler=sampler,
# dropping last avoids shape issues with compile + flex attention
drop_last=cfg_dataset.get("drop_last", True),
drop_last=True,
collate_fn=partial(
collate_fn,
padding_idx=self._tokenizer.pad_id,
Expand Down
2 changes: 1 addition & 1 deletion recipes/knowledge_distillation_single_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ def _setup_data(
sampler=sampler,
batch_size=batch_size,
# dropping last avoids shape issues with compile + flex attention
drop_last=cfg_dataset.get("drop_last", True),
drop_last=True,
collate_fn=(
partial(
padded_collate_sft,
Expand Down
2 changes: 1 addition & 1 deletion recipes/lora_dpo_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def _setup_data(
batch_size=batch_size,
sampler=sampler,
# dropping last avoids shape issues with compile + flex attention
drop_last=cfg_dataset.get("drop_last", True),
drop_last=True,
collate_fn=partial(
padded_collate_dpo,
padding_idx=self._tokenizer.pad_id,
Expand Down
2 changes: 1 addition & 1 deletion recipes/lora_dpo_single_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def _setup_data(
sampler=sampler,
batch_size=batch_size,
# dropping last avoids shape issues with compile + flex attention
drop_last=cfg_dataset.get("drop_last", True),
drop_last=True,
collate_fn=partial(
padded_collate_dpo,
padding_idx=self._tokenizer.pad_id,
Expand Down
2 changes: 1 addition & 1 deletion recipes/lora_finetune_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ def _setup_data(
batch_size=batch_size,
sampler=sampler,
# dropping last avoids shape issues with compile + flex attention
drop_last=cfg_dataset.get("drop_last", True),
drop_last=True,
collate_fn=partial(
collate_fn,
padding_idx=self._tokenizer.pad_id,
Expand Down
2 changes: 1 addition & 1 deletion recipes/lora_finetune_single_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def _setup_data(
sampler=sampler,
batch_size=batch_size,
# dropping last avoids shape issues with compile + flex attention
drop_last=cfg_dataset.get("drop_last", True),
drop_last=True,
collate_fn=(
partial(
collate_fn,
Expand Down
2 changes: 1 addition & 1 deletion recipes/ppo_full_finetune_single_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ def _setup_data(
sampler=sampler,
batch_size=batch_size,
# dropping last avoids shape issues with compile + flex attention
drop_last=cfg_dataset.get("drop_last", True),
drop_last=True,
collate_fn=partial(
padded_collate,
pad_direction="left",
Expand Down
2 changes: 1 addition & 1 deletion recipes/qat_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ def _setup_data(
batch_size=batch_size,
sampler=sampler,
# dropping last avoids shape issues with compile + flex attention
drop_last=cfg_dataset.get("drop_last", True),
drop_last=True,
collate_fn=partial(
padded_collate_sft,
padding_idx=self._tokenizer.pad_id,
Expand Down

0 comments on commit a20dd56

Please sign in to comment.