huggingface / huggingface/course
Chapter 3 call to "training_args = TrainingArguments("test-trainer")" returned "ImportError" despite having satisfied all the Import Requirements!!
- Dominant language
- MDX
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 13m
- Merged PRs (30d)
- 1
Description
All I am trying to do is call "training_args = TrainingArguments("test-trainer")" as per Chapter 3 "Fine-Tuning a model with the Trainer API" Lesson "Training".
I am having this exact same problem and I tried
- calling pip install transformers[torch]
- calling pip install accelerate -U
- calling pip install datasets evaluate accelerate transformers[sentencepiece] per PaulHendi
- calling pip install accelerate==0.21.0
(I reboot after every new attempt)
However, I continue to get the ImportError even though I have all the right dependencies installed...
**ImportError: Using the `Trainer` with `PyTorch` requires `accelerate>=0.21.0`: Please run `pip install transformers[torch]` or `pip install accelerate -U`**
This is what my virtual environment holds:
Package Version
------------------ -----------
accelerate 0.32.1
aiohttp 3.9.5
aiosignal 1.3.1
attrs 23.2.0
certifi 2024.7.4
charset-normalizer 3.3.2
colorama 0.4.6
contourpy 1.2.1
cycler 0.12.1
datasets 2.20.0
dill 0.3.8
et-xmlfile 1.1.0
evaluate 0.4.2
filelock 3.15.4
fonttools 4.53.0
frozenlist 1.4.1
fsspec 2024.5.0
huggingface-hub 0.23.4
idna 3.7
intel-openmp 2021.4.0
Jinja2 3.1.4
kiwisolver 1.4.5
MarkupSafe 2.1.5
matplotlib 3.9.0
mkl 2021.4.0
mpmath 1.3.0
multidict 6.0.5
multiprocess 0.70.16
networkx 3.3
numpy 1.26.4
openpyxl 3.1.3
packaging 24.1
pandas 2.2.2
pillow 10.3.0
pip 24.1.2
protobuf 5.27.2
psutil 6.0.0
pyarrow 16.1.0
pyarrow-hotfix 0.6
pyparsing 3.1.2
python-dateutil 2.9.0.post0
pytz 2024.1
PyYAML 6.0.1
regex 2024.5.15
requests 2.32.3
safetensors 0.4.3
seaborn 0.13.2
sentencepiece 0.2.0
six 1.16.0
sympy 1.13.0
tbb 2021.13.0
tokenizers 0.19.1
torch 2.3.1
tqdm 4.66.4
transformers 4.42.4
typing_extensions 4.12.2
tzdata 2024.1
urllib3 2.2.2
xxhash 3.4.1
yarl 1.9.4
I really do not want to have to recreate my virtual environment.
Please Help!!!
I had the same problem. Try including accelerate in the pip install instruction in the first cell :
```
!pip install datasets evaluate accelerate transformers[sentencepiece]
```
And restart the notebook, re-run the cells, it should be fine normally.
_Originally posted by @PaulHendi in https://github.com/huggingface/course/issues/644#issuecomment-1932311009_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.