Transformers-Tutorials icon indicating copy to clipboard operation
Transformers-Tutorials copied to clipboard

layoutlmv3 issue

Open tzktz opened this issue 1 year ago • 2 comments

@NielsRogge i am facing this issue....

from transformers import TrainingArguments, Trainer


training_args = TrainingArguments(output_dir="test",
                                  max_steps=1000,
                                  per_device_train_batch_size=2,
                                  per_device_eval_batch_size=2,
                                  learning_rate=1e-5,
                                  evaluation_strategy="steps",
                                  eval_steps=100,
                                  load_best_model_at_end=True,
                                  metric_for_best_model="f1")

ImportError Traceback (most recent call last) in <cell line: 4>() 2 3 ----> 4 training_args = TrainingArguments(output_dir="test", 5 max_steps=1000, 6 per_device_train_batch_size=2,

4 frames /usr/local/lib/python3.10/dist-packages/transformers/training_args.py in _setup_devices(self) 1840 if not is_sagemaker_mp_enabled(): 1841 if not is_accelerate_available(): -> 1842 raise ImportError( 1843 f"Using the Trainer with PyTorch requires accelerate>={ACCELERATE_MIN_VERSION}: " 1844 "Please run pip install transformers[torch] or pip install accelerate -U"

ImportError: Using the Trainer with PyTorch requires accelerate>=0.21.0: Please run pip install transformers[torch] or pip install accelerate -U


NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the "Open Examples" button below.

tzktz avatar Jan 05 '24 11:01 tzktz

Hi,

Yes please follow what's described in the error message. Restarting the runtime might also help.

NielsRogge avatar Jan 05 '24 12:01 NielsRogge

@NielsRogge ..tried all again face same issue

tzktz avatar Jan 05 '24 12:01 tzktz