Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tensorflow pip package version not specifically defined - manual downgrade required for ITEX 1.1.0 & TF 2.11 #31

Closed
MateuszGrabuszynski opened this issue Apr 12, 2023 · 5 comments
Assignees
Labels

Comments

@MateuszGrabuszynski
Copy link

MateuszGrabuszynski commented Apr 12, 2023

On a clean ubuntu:20.04 container image (after apt update && apt install python3, python3-pip); following commands executed in order (based on main README):

  1. pip install intel-tensorflow==2.11.0
  2. pip install --upgrade intel-extension-for-tensorflow[cpu]

Result in:
$ pip list

Package                            Version  
---------------------------------- ---------
absl-py                            1.4.0    
(...)   
intel-extension-for-tensorflow     1.1.0    
intel-extension-for-tensorflow-lib 1.1.0.0  
intel-tensorflow                   2.11.0   
jax                                0.4.8    
(...) 
pip                                20.0.2   
(...)   
tensorboard-plugin-wit             1.8.1    
tensorflow                         2.12.0   
tensorflow-estimator               2.12.0   
tensorflow-io-gcs-filesystem       0.32.0   
termcolor                          2.2.0    
(...)
wheel                              0.34.2   
wrapt                              1.14.1   
zipp                               3.15.0

Which is against the Compatibility table with intel-extension-for-tensorflow==1.1.0 and tensorflow==2.12.0.

Intel ® Extension for TensorFlow* Stock TensorFlow
v1.2.0 2.12
v1.1.0 2.10 & 2.11
v1.0.0 2.10

This causes issues like mine - sudden Segmentation Faults during the ResNet50 workload execution. And probably also this one (probably not, I missed it was opened last year): intel/ai-reference-models#113. After manually downgrading the tensorflow package with pip install --upgrade tensorflow==2.11.0 the issue was gone.

This issue is not present in intel/intel-extension-for-tensorflow:cpu Docker Hub image.

Root cause seems to be that not a specific-enough package is required during installation. Reference log:
$ pip install --upgrade intel-extension-for-tensorflow[cpu]

Collecting intel-extension-for-tensorflow[cpu]
  Downloading intel_extension_for_tensorflow-1.1.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (121 kB)
     |████████████████████████████████| 121 kB 1.2 MB/s 
Collecting tensorflow>=2.10
  Downloading tensorflow-2.12.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (585.9 MB)
     |████████████████████████████████| 585.9 MB 17 kB/s 
Collecting numpy<1.24
  Downloading numpy-1.23.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)

tensorflow>=2.10 could be changed to tensorflow>=2.10,<=2.11 if it is known tensorflow==2.12 is not working properly (see: PEP 440).

@MateuszGrabuszynski
Copy link
Author

Workaround (doc):

pip install --upgrade intel-extension-for-tensorflow[cpu]==1.1.0 "tensorflow == 2.11.0"

but I will comment further in #23.

@NeoZhangJianyu
Copy link
Contributor

@MateuszGrabuszynski
About the relationship of ITEX, Intel Tensorflow and stock Tensorflow, I answered in another issue: #23 (comment)

For this issue, the installation guide will be updated to fix it.

In stock TF 2.12, the plugin device interface is changed. so, the old plugin (like ITEX 1.1) can't work well with TF 2.12. That's why you meet the crash issue.
Suggestion:

 ITEX 1.1 + stock TF 2.11
 ITEX (latest, built from source code) + stock TF 2.12

Issue of Intel Tensorflow mixed with stock Tensorflow:

  1. When install ITEX by PIP, it will install the dependent packages automatically.
    So, stock Tensorflow will be installed.
    Due to ITEX is not designed to work with Intel Tensorflow, it won't detect the Intel Tensorflow during installation.
    Even if you installed Intel Tensorflow, ITEX still install stock Tensorflow automatically.

It's the root cause of this issue.

  1. If you want to accelerate Tensorflow on Intel CPU, please install "Intel Tensorflow" or "ITEX (CPU) + stock TF".

  2. If you want to run Tensorflow on Intel GPU, please install "ITEX (GPU) + stock TF".

  3. In the future, there will be ITEX (XPU) to support both Intel CPU & GPU in one single release.

@MateuszGrabuszynski
Copy link
Author

Thank you, that is very helpful, I get it now. :)

My suggestion on how to mitigate it better than only a readme note is to bump ITEX 1.1.0 to 1.1.1 and limit tensorflow dependency, so only 2.10 or 2.11 are installed (see the bottom of opening comment). Additionally, I see ITEX 1.0.0 is affected with the same issue, same bump 1.0.0 to 1.0.1 should apply there (to stop at tensorflow==2.10).

Let me put that into the table:

ITEX lock ITEX now ITEX changed TF now TF changed
>=1.2.0, >=1.1.0, >=1.0.0
or ==1.*, ==1.2.*
1.2.0 1.2.0 (no) 2.12 (OK) 2.12 (no, OK)
==1.1.0 1.1.0 1.1.0 (no) 2.12 (NOK) 2.12 (no, NOK*)
==1.1.* 1.1.0 1.1.1 (yes) 2.12 (NOK) 2.11 (yes, OK)
==1.1.1 N/A 1.1.1 N/A 2.11 (OK)
==1.0.0 1.0.0 1.0.0 2.12 (NOK) 2.12 (no, NOK*)
==1.0.* 1.0.0 1.0.1 2.12 (NOK) 2.10 (yes, OK)
==1.0.1 N/A 1.0.1 N/A 2.10 (OK)

*"known issue" notes needed for ==1.1.0 and ==1.0.0.

@NeoZhangJianyu
Copy link
Contributor

Yes, this table is full to show the status.

In fact, the compatible issue between Tensorflow & ITEX comes from the change of plugin interface in TF 2.12.

So, old ITEX (<=1.1) and new TF(>=2.12) have such issue.
We hope the plugin interface in TF 2.12 and newer be stable in future.

Thank you!

@yinghu5
Copy link

yinghu5 commented Oct 8, 2023

The new version is ready: https://intel.github.io/intel-extension-for-tensorflow/latest/docs/install/install_for_xpu.html. Please help to try and feedback to us.

thank you!

@yinghu5 yinghu5 closed this as completed Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants