-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix py3 issue with AI Platform models #2311
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
Conversation
|
@tolga-b please review |
|
This roughly looks like something that six probably addresses. Since I lack profound knowledge, I assigned the PR to @nfelt for review. |
|
I wonder if six.ensure_text or six.ensure_str is the way to go.
|
|
switched to six.ensure_str - thanks |
| from IPython import display | ||
| from google.protobuf import json_format | ||
| from numbers import Number | ||
| from six import ensure_str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to add six dependency on the BUILD file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
|
||
| import base64 | ||
| import json | ||
| import googleapiclient.discovery |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably do this as a separate PR but how was this previously working? GAPI isn't part of our dependency declaration and I believe we didn't do anything special to install it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
acknowledged
In WIT, models that accept JSON as input were failing in python 3 notebooks due to how bytes_list protos are handled.
Added wrapper method for handling of objects that in py3 are bytes but in py2 are string (such as bytes_list handling from tf Example proto) to ensure they encoded as strings for use in WIT.
N/A
Ran py3 colab notebook with the offending model with local pip package built with this change and verified that it now works correctly in WIT.
Ran other colab notebooks to verify it didn't cause regressions.