Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Can we convert collate_fn in Dataloader to a custom class(or function) ? #5218

Closed
wlhgtc opened this issue May 21, 2021 · 5 comments
Closed

Comments

@wlhgtc
Copy link
Contributor

wlhgtc commented May 21, 2021

For some task(such as masking ), we want to mask different pos in different epoch for the same record.
Like the code in Transformers, we could pass a class to the collate_fn.
But now we only have a simple allennlp_collate.
The old version of our Dataloader is a subclass of Pytorch Dataloder, seems we write our own one in the latest version ?

@wlhgtc
Copy link
Contributor Author

wlhgtc commented May 21, 2021

@epwalsh

@wlhgtc
Copy link
Contributor Author

wlhgtc commented May 24, 2021

Maybe just like what we have done in optimizer, import Collator class from Transformers and use a custom base class to cover ?

@epwalsh
Copy link
Member

epwalsh commented May 24, 2021

This would be a good feature to have, and easy to add without breaking backwards compat.

Would you like to make a PR?

@wlhgtc
Copy link
Contributor Author

wlhgtc commented May 25, 2021

This would be a good feature to have, and easy to add without breaking backwards compat.

Would you like to make a PR?

Well, I'll try it soon.

@dirkgr
Copy link
Member

dirkgr commented May 27, 2021

Done! Thank you!

@dirkgr dirkgr closed this as completed May 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants