Skip to content

Commit b55ba2c

Browse files
committed
fix torchrun
1 parent 4086a54 commit b55ba2c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/twinkle/processor/base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ def to_tensor(_input):
9797
# so tensor ops like labels != ignore_index or .to(device) would fail without this.
9898
if isinstance(value, np.ndarray):
9999
value = torch.from_numpy(value)
100-
elif isinstance(value, list) and isinstance(value[0], (int, float, np.number)):
100+
elif (isinstance(value, list) and isinstance(value[0],
101+
(int, float, np.number))) or key == 'position_ids':
101102
value = torch.tensor(value)
102103
elif key in self.VLM_CONCAT_FIELDS:
103104
if not isinstance(value[0], torch.Tensor):

0 commit comments

Comments
 (0)