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-457: PyTorch DataLoader #735

Merged
merged 25 commits into from
May 20, 2019
Merged

GH-457: PyTorch DataLoader #735

merged 25 commits into from
May 20, 2019

Conversation

alanakbik
Copy link
Collaborator

This PR refactors the way datasets are loaded in Flair. Instead of loading all data sets into memory as a List of Sentence, we now utilize PyTorch's Dataset and DataLoader methods and allow the user to choose whether or not to load a data set into memory. This allows us to scale training to very large datasets that do not fit into memory.

This PR also changes the syntax of how to load datasets.

Old way:

from flair.data_fetcher import NLPTaskDataFetcher, NLPTask
corpus = NLPTaskDataFetcher.load_corpus(NLPTask.UD_ENGLISH)

New way:

import flair.datasets
corpus = flair.datasets.UD_ENGLISH()

To use streaming loading, i.e. to not load into memory, you can pass the in_memory parameter:

import flair.datasets
corpus = flair.datasets.UD_ENGLISH(in_memory=False)

closes #458 and #457 #426

@alanakbik alanakbik merged commit b2230ec into master May 20, 2019
@alanakbik alanakbik deleted the GH-457-data-loader branch May 20, 2019 09:44
@kashif
Copy link
Contributor

kashif commented May 20, 2019

👍

alanakbik pushed a commit that referenced this pull request May 23, 2019
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.

Iterating data fetcher for large training data sets
3 participants