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

Compliancy with tf-nightly #9570

Merged
merged 2 commits into from
Jan 14, 2021
Merged

Compliancy with tf-nightly #9570

merged 2 commits into from
Jan 14, 2021

Conversation

jplu
Copy link
Contributor

@jplu jplu commented Jan 13, 2021

What does this PR do?

This PR makes the lib able to be used with the nightly builds of TensorFlow. And fix an issue with the min TensorFlow version.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

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

I wonder how many different names tensorflow can have ;-) Thanks for fixing!

if _tf_available:
if version.parse(_tf_version) < version.parse("2"):
if version.parse(_tf_version) < version.parse("2.3"):
Copy link
Collaborator

Choose a reason for hiding this comment

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

No this was just an old check for version 1 that was left, but we should not hardcode anything here, as we will forget to update it when we pin tensorflow to another release.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I let it as it is or completely remove this condition?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should leave it as is. Let's see what the others think!

Copy link
Member

Choose a reason for hiding this comment

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

I agree with Sylvain that this should stay as it is, it's to indicate that the general framework detected (TensorFlow 1) will not work correctly as we expect another (TensorFlow 2).

Copy link
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

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

LGTM!

if _tf_available:
if version.parse(_tf_version) < version.parse("2"):
if version.parse(_tf_version) < version.parse("2.3"):
Copy link
Member

Choose a reason for hiding this comment

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

I agree with Sylvain that this should stay as it is, it's to indicate that the general framework detected (TensorFlow 1) will not work correctly as we expect another (TensorFlow 2).

@jplu
Copy link
Contributor Author

jplu commented Jan 14, 2021

Ok, just restored the previous version checking.

Comment on lines +92 to +105
try:
_tf_version = importlib_metadata.version("tensorflow-gpu")
except importlib_metadata.PackageNotFoundError:
try:
_tf_version = importlib_metadata.version("tf-nightly")
except importlib_metadata.PackageNotFoundError:
try:
_tf_version = importlib_metadata.version("tf-nightly-cpu")
except importlib_metadata.PackageNotFoundError:
try:
_tf_version = importlib_metadata.version("tf-nightly-gpu")
except importlib_metadata.PackageNotFoundError:
_tf_version = None
_tf_available = False
Copy link
Member

Choose a reason for hiding this comment

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

Wow!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, just done a quick search on pypi to be sure we have all of them 😄

Copy link
Collaborator

Choose a reason for hiding this comment

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

Might refactor this using a list of names at this stage ;-)

@LysandreJik LysandreJik merged commit 14d677c into huggingface:master Jan 14, 2021
@jplu jplu deleted the tf-nightly branch January 14, 2021 09:37
LysandreJik pushed a commit that referenced this pull request Jan 14, 2021
* Compliancy with tf-nightly

* Add more version + restore min version check
guyrosin pushed a commit to guyrosin/transformers that referenced this pull request Jan 15, 2021
* Compliancy with tf-nightly

* Add more version + restore min version check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants