huggingface / huggingface/setfit
Apparently not possible to create models that are both multi class and multi label
- Dominant language
- Jupyter Notebook
- Stars
- 2.8k
- Forks
- 267
- Avg merge
- 36m
- Merged PRs (30d)
- 5
Description
I've been looking for ages for a way to train multi label - multi class setfit models and I've reached the conclusion that this is either not supported or there is a desperate need for it to be properly documented. Can I ask if this is a feature that could be considered? I include a minimal example bellow of my failed attempts.
```
from datasets import Dataset
from setfit import SetFitModel, Trainer, TrainingArguments
import pandas as pd
dfA = [["test",["A","x"]],["not",["B","y"]],["yes",["C","z"]]]
dfB = [["test",["A",True]], ["not",["B",True]],["yes",["C",False]]]
args = TrainingArguments(num_epochs=1)
for t in ["multi-output","one-vs-rest","classifier-chain"]:
model = SetFitModel.from_pretrained(
"sentence-transformers/paraphrase-mpnet-base-v2",
multi_target_strategy=t)
for df in [dfA,dfB]:
try:
dataset = Dataset.from_pandas(pd.DataFrame(df,
columns=["text","label"]))
trainer = Trainer(
model=model,
args=args,
train_dataset=dataset
)
trainer.train()
except:
print("fail")
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.