Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

allowing tensorflow version flexibility when installing from source #7

Merged
merged 5 commits into from
May 17, 2021

Conversation

scarrazza
Copy link
Member

Following the discussion this morning, here we:

  • unlock tf versions when installing from source
  • set the latest tensorflow version for the pip package
  • include a check for the tf version, storing the compiled version during installation.

@scarrazza scarrazza requested a review from stavros11 May 17, 2021 08:31
@codecov
Copy link

codecov bot commented May 17, 2021

Codecov Report

Merging #7 (f81f045) into tf250 (2e5e6ac) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             tf250        #7   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         3    -1     
  Lines          373       371    -2     
=========================================
- Hits           373       371    -2     
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...m_operators/python/ops/qibo_tf_custom_operators.py 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2e5e6ac...f81f045. Read the comment docs.

Copy link
Member

@stavros11 stavros11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing this. I was a bit confused about the use of the __init__.py.in file at first but after building the custom operators I now understand the use. Works well for me.

elif tf.__version__ > __target_tf_version__: # pragma: no cover
raise RuntimeError(
f"qibotf {__version__} requires TensorFlow {__target_tf_version__}."
"Please upgrade qibotf or downgrade TensorFlow.")
" Please upgrade qibotf or downgrade TensorFlow.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't these checks equivalent to a single if tf.__version__ != __target_tf_version__ check?

Also regarding the error message, I think there is also the option to just rebuild the custom operators without upgrading/downgrading any of the libraries. However this may be confusing for the average user so it is okay to leave it as it is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, indeed, should be equivalent. The if/else is here just to explain to the average user how to solve the incompatibility.
But, I agree that a simple != should make it, e.g. we could say qibotf and tensorflow do not match, please recompile qibotf or check the documentation. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But, I agree that a simple != should make it, e.g. we could say qibotf and tensorflow do not match, please recompile qibotf or check the documentation. What do you think?

This sounds good and is a bit more general than the current. I would just add "qibotf and tensorflow versions do not match". I am fine with either message, but perhaps referring to the docs is the best idea.

@scarrazza scarrazza merged commit f6ac02d into tf250 May 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants