Last active
February 23, 2020 03:22
-
-
Save kabirahuja2431/bc84edda230d62c45c0dc98cd764c1f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Creating the iterable dataset object | |
dataset = CustomIterableDataset('path_to/somefile') | |
#Creating the dataloader | |
dataloader = DataLoader(dataset, batch_size = 64) | |
for data in dataloader: | |
#Data is a list containing 64 (=batch_size) consecutive lines of the file | |
print(len(data)) #[64,] | |
#We still need to separate the text and labels from each other and preprocess the text | |
X, y = [] | |
for i in range(len(data)): | |
text, label = data[i].split(',') | |
text = preprocess(text) #Defined somewhere outside | |
X.append(text) | |
y.append(label) | |
### Do something with X and y | |
### |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment