Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-3474: add random seed parameter to dataset splitting and downsampl… #3475

Merged

Conversation

MattGPT-ai
Copy link
Contributor

#3474

Adds random seed parameters to dataset splitting and downsampling functions

@MattGPT-ai MattGPT-ai marked this pull request as ready for review June 25, 2024 20:19
Copy link
Collaborator

@helpmefindaname helpmefindaname left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MattGPT-ai
thank you for your contribution.
The changes look good to me, I just requests a small change. Besides that, I think this is ready to merge

flair/data.py Outdated Show resolved Hide resolved
flair/data.py Outdated Show resolved Hide resolved
@MattGPT-ai
Copy link
Contributor Author

Thanks for your review! Pushed the changes you requested

@MattGPT-ai
Copy link
Contributor Author

Thanks for the approval! How can we trigger the checks to run so that it can be merged?

flair/data.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@alanakbik alanakbik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Looks good, but there is a small mypy error (I added a suggestion to fix).

Co-authored-by: Alan Akbik <alan.akbik@gmail.com>
@MattGPT-ai
Copy link
Contributor Author

Applied the change. I had a question, I saw that step is necessary because Dataset doesn't have __len__ implemented. Is there a way to implement __len__, even if it just calls _len_dataset? Does constructing the DatasetLoader class take any non-negligible time? I actually see the same warning for return len(loader) in my PyCharm that it "Expected type Sized, got DataLoader instead", and a similar warning for _iter_dataset

@alanakbik
Copy link
Collaborator

Thanks! I agree that it would be better to implement __len__ rather than having to call _len_dataset.

The problem is that Dataset is a PyTorch class that does not have __len__ or __iter__ implemented, so we can't add them here. Alternatively, we might change the code that instead of Dataset, everything is based on either PyTorch's IterDataset or our own FlairDataset.

@MattGPT-ai MattGPT-ai requested a review from alanakbik July 2, 2024 06:53
@alanakbik
Copy link
Collaborator

@MattGPT-ai thanks a lot for adding this!

@alanakbik alanakbik merged commit a2e0ba5 into flairNLP:master Jul 2, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants