More straightforward custom_collate_function (chapter 7) #683
behzadshomali
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I personally found the introduced
custom_collate_funciton
in the book a bit confusing. To be more specific, the way we added and ignored thepad_token_id
was not really straightforward for me (the idea behind it was clear, but in order to understand the code I had to read it multiple times), therefore I modified it slightly and here I'm going to share it (I validated it by comparing its output against the output of the original collate function introduced in the book for several inpouts and got the same output):Was there any specific reason that the padding was done in that way in the book?
Beta Was this translation helpful? Give feedback.
All reactions