-
Notifications
You must be signed in to change notification settings - Fork 253
Open
Description
Hi, it's super basic and I apologize, but I seem to be getting a strange error when trying to run the trainer from SetFit.
Here is the code to instantiate:
trainer = AbsaTrainer(
model,
train_dataset=train_data
When I run this once, I get this errr:
ImportError: Using the `Trainer` with `PyTorch` requires `accelerate>=0.26.0`: Please run `pip install transformers[torch]` or `pip install 'accelerate>=0.26.0'`
File <command-6658730431216308>, line 5
2 model = AbsaModel.from_pretrained("sentence-transformers/paraphrase-mpnet-base-v2")
4 # Create a trainer:
----> 5 trainer = AbsaTrainer(
6 model,
7 train_dataset=train_data
8 )
9 # Execute training:
10 trainer.train()
File /local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/transformers/training_args.py:2192, in TrainingArguments._setup_devices(self)
2190 if not is_sagemaker_mp_enabled():
2191 if not is_accelerate_available():
-> 2192 raise ImportError(
2193 f"Using the `Trainer` with `PyTorch` requires `accelerate>={ACCELERATE_MIN_VERSION}`: "
2194 f"Please run `pip install transformers[torch]` or `pip install 'accelerate>={ACCELERATE_MIN_VERSION}'`"
2195 )
2196 # We delay the init of `PartialState` to the end for clarity
2197 accelerator_state_kwargs: dict[str, Any] = {"enabled": True, "use_configured_state": False}
but when I re-run the cell, I get a different error:
KeyError: 'text'
File <command-6658730431216308>, line 5
2 model = AbsaModel.from_pretrained("sentence-transformers/paraphrase-mpnet-base-v2")
4 # Create a trainer:
----> 5 trainer = AbsaTrainer(
6 model,
7 train_dataset=train_data
8 )
9 # Execute training:
10 trainer.train()
File /local_disk0/.ephemeral_nfs/envs/pythonEnv-87f5ca92-d40a-4dab-b7e4-2553804dffba/lib/python3.11/site-packages/setfit/span/trainer.py:120, in AbsaTrainer.preprocess_dataset(self, aspect_model, polarity_model, dataset)
118 grouped_data = defaultdict(list)
119 for sample in dataset:
--> 120 text = sample.pop("text")
121 grouped_data[text].append(sample)
123 def index_ordinal(text: str, target: str, ordinal: int) -> Tuple[int, int]:```
From what I've read of the pop function it just removes and return this element. My data is already in the dictionary format of text, span, label ordinal dictionaries as needed by SetFit. Torch and accelerate are indeed installed. Metadata
Metadata
Assignees
Labels
No labels