I am struggling to write the correct method: get_items()
for DataBlock
.
This is the tutorial I am following.
question_label_path = 'text_label.csv'
def getTextLabels(arg):
df = pd.read_csv(arg)
return df[['text', 'label']].to_numpy()
textBlock = (TextBlock.from_df(text_cols = ['text'], vocab=dls_lm.vocab),CategoryBlock)
dls_clas = DataBlock(
blocks=textBlock,
get_x = ColReader(cols='text'),
get_y = ColReader(cols = "label"),
get_items= getTextLabels,
splitter = TrainTestSplitter(test_size = 0.2, random_state = 21, stratify=["label"])
).dataloaders(question_label_path, bs=64)
Due to the nature of my work, I cannot provide the full dataset, but it looks like this:
What did I miss?