Skip to content

Commit

Permalink
Update absa.mdx with necessary imports (#533)
Browse files Browse the repository at this point in the history
Add imports to load dataset and train model
  • Loading branch information
splevine authored Sep 18, 2024
1 parent fb91f67 commit 6d4010d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/source/en/how_to/absa.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ Two datasets that already match this format are these datasets of reviews from t
* [tomaarsen/setfit-absa-semeval-laptops](https://huggingface.co/datasets/tomaarsen/setfit-absa-semeval-laptops)

```py
from dataset import load_dataset

# The training/eval dataset must have `text`, `span`, `label`, and `ordinal` columns
dataset = load_dataset("tomaarsen/setfit-absa-semeval-restaurants", split="train")
train_dataset = dataset.select(range(128))
Expand All @@ -82,6 +84,9 @@ If you wish, you can specify separate training arguments for the aspect model as
</Tip>

```py
from setfit import AbsaTrainer, TrainingArguments
from transformers import EarlyStoppingCallback

args = TrainingArguments(
output_dir="models",
num_epochs=5,
Expand Down

0 comments on commit 6d4010d

Please sign in to comment.