stack
stack

Reputation: 23

SetFit Model training on a custom dataset

I've a dataframe with 3 columns and I'm trying to perform few shot text classification using SetFit model

Dataframe (df)

           A                   B                      C
0    Lorem ipsum ta      lorem ipsum                  Yes
1    Excepteur sint      occaecat excepteur           No
2    Duis aute irure     aute irure                   Yes

The traditional SetFit model accepts two inputs i.e. Text and label

I want to train the model with an extra input as well i.e. 2 inputs (A,B) to predict the label (C).

And I'm not sure how to apply the SetFit model from Transformers library to do this

I am trying to search how to do this and trying different code pieces but in the meanwhile I would appreciate any guidance, Thank you in advance!

Upvotes: 0

Views: 395

Answers (1)

nn007
nn007

Reputation: 11

SetFit accepts two inputs: Text and Label.

You could concatenate the text in columns A and B and pass that as text input, and use column C for label input.

df['text'] = df['A'] + "_" + df['B']

Upvotes: 1

Related Questions