Skip to content

Commit

Permalink
removed walrus (unsupported by python 3.7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Natooz committed Aug 7, 2023
1 parent e322609 commit df96c76
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion miditok/pytorch_data/collators.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ def _add_bos_eos_tokens_to_batch(
if bos_tok_id is None and eos_tok_id is None:
return

(sos_shape := list(batch[0].shape))[0] = 1 # (1) or (1,Z)
sos_shape = list(batch[0].shape)
sos_shape[0] = 1 # (1) or (1,Z)
for i in range(len(batch)):
if bos_tok_id is not None and eos_tok_id is not None:
batch[i] = torch.cat(
Expand Down

0 comments on commit df96c76

Please sign in to comment.