Apply custom randomization on __getitem__ during training. #5139
-
Hi, I have an extremely simple use case which I cannot understand how to do with your library. With (example: getitem normally returns a text and let's say I want to shuffle the words) I really cannot understand how to do it and I've been searching for more than 2 hours. Please help! Thanks, |
Beta Was this translation helpful? Give feedback.
Answered by
mariosasko
Oct 19, 2022
Replies: 1 comment 1 reply
-
Hi! You can use def transform(batch):
batch["text"] = [shuffle_words(text) for text in batch["text"]]
return batch
dset.set_transform(transform) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ysig
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! You can use
set_transform
for that: