iree-torch
iree-torch copied to clipboard
Do not limit pillow version
Fix https://github.com/iree-org/iree-torch/issues/78
After this change, I successfully install dependencies withpython -m pip install -r requirements.txt
And I can build iree-torch with python setup.py develop
, so that python -c 'import iree_torch'
works for me.
However, when I ran python examples/bert.py
, the following line
https://github.com/iree-org/iree-torch/blob/5fbaf505384eef01f63a618bcc4e59929b87f676/examples/bert.py#L21
raised the error.
Traceback (most recent call last):
File "/Users/y/w/iree-torch/examples/bert.py", line 21, in <module>
from transformers import AutoTokenizer, AutoModelForSequenceClassification
ModuleNotFoundError: No module named 'transformers'
pip install transformers
saved me. But I guess this fix might go into another pull request? I made https://github.com/iree-org/iree-torch/pull/80
$ python examples/bert.py
Parsing sentence tokens.
Downloading: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 512/512 [00:00<00:00, 318kB/s]
Downloading: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 710/710 [00:00<00:00, 468kB/s]
Downloading: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 232k/232k [00:00<00:00, 638kB/s]
Downloading: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 466k/466k [00:00<00:00, 977kB/s]
Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 112/112 [00:00<00:00, 46.4kB/s]
Instantiating model.
Downloading: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 90.9M/90.9M [00:11<00:00, 8.22MB/s]
Tracing model.
Compiling with Torch-MLIR
Compiling with IREE
Loading in IREE
Running on IREE
RESULT: tensor([[ 1.8574, -1.8036]])
Model execution took 0.009077072143554688 seconds.
@silvasean do you know the original reason for limiting the pillow version?
It is documented in the comment just above the restriction.
# For torchvision, use pillow<7 to avoid `ImportError: cannot import name 'PILLOW_VERSION' from 'PIL'`
# See https://github.com/pytorch/vision/issues/1712
If that doesn't happen anymore then we can remove the limitation (we should remove that commend too though)