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

TypeTransformer for reading and writing from TensorFlowRecord format #1240

Merged
merged 36 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2e6a36f
first commit
ryankarlos Oct 9, 2022
3e641a6
add tensorflow example tf record transformer
ryankarlos Oct 18, 2022
1a7243f
refactor
ryankarlos Oct 18, 2022
548ff21
correct tfexample description
ryankarlos Oct 18, 2022
f83c11f
fix test_native.py
ryankarlos Oct 18, 2022
f7df183
add tensorflow docs and reqs
ryankarlos Oct 19, 2022
3c9fb64
add tensorflow docs and reqs1
ryankarlos Oct 19, 2022
680226e
tensorflow import in init
ryankarlos Oct 19, 2022
c5815c3
fix failing tests
ryankarlos Oct 19, 2022
55dd41c
add tensorflow pinned version to reqs
ryankarlos Oct 20, 2022
90bea9a
pin grpcio-status to remove protobuf error
ryankarlos Oct 20, 2022
cf41f51
add suggested changes
ryankarlos Oct 24, 2022
502b2c8
redesign transformer
ryankarlos Oct 30, 2022
a0225d8
remove old script
ryankarlos Oct 30, 2022
426bfc2
Merge branch 'master' into typetransformer_tf_model
ryankarlos Nov 3, 2022
7fbe338
merge conflixt dev requirements
ryankarlos Nov 4, 2022
a44d0c3
fix type reference for TFREcordDataset
ryankarlos Nov 4, 2022
e2f2095
refactor
ryankarlos Nov 6, 2022
910a71e
refactor
ryankarlos Nov 13, 2022
c8b8c02
spacing and uppercase
ryankarlos Nov 17, 2022
48ff610
merge conflict
ryankarlos Nov 17, 2022
f218bf6
redesign with tfdir and tfrecordfile subclass
ryankarlos Nov 17, 2022
d1b0dc7
fix conflicts and typos
ryankarlos Nov 17, 2022
74d492d
address majority of comments
ryankarlos Nov 23, 2022
057bb85
Merge branch 'master' into typetransformer_tf_model
ryankarlos Nov 23, 2022
c9630f4
refactor
ryankarlos Nov 23, 2022
aa83dec
fix test with flytefile and metadata annotated
ryankarlos Nov 28, 2022
739c8fb
fix check for example records in directory
ryankarlos Nov 28, 2022
18399c6
refactor and correct typing
ryankarlos Nov 29, 2022
5139f08
Merge branch 'master' of https://github.com/flyteorg/flytekit into ty…
ryankarlos Nov 29, 2022
eece4df
lint
ryankarlos Nov 29, 2022
85b2ee9
import annotated from typing_extensions
ryankarlos Nov 29, 2022
39c6237
tweak to tests to test case when Config not passed in as type
ryankarlos Nov 29, 2022
d45efc5
add suggested changes
ryankarlos Nov 30, 2022
d6ae50c
add task for tfrecord dir with no config in test
ryankarlos Dec 2, 2022
23c8bea
get filenames from local dir instead of remote
ryankarlos Dec 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dev-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ codespell
google-cloud-bigquery
google-cloud-bigquery-storage
IPython
tensorflow
grpcio-status<1.49.0
# Newer versions of torch bring in nvidia dependencies that are not present in windows, so
# we put this constraint while we do not have per-environment requirements files
torch<=1.12.1
Expand Down
80 changes: 67 additions & 13 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with python 3.7
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# make dev-requirements.txt
Expand All @@ -8,12 +8,18 @@
# via
# -c requirements.txt
# pytest-flyte
absl-py==1.3.0
# via
# tensorboard
# tensorflow
appnope==0.1.3
# via ipython
arrow==1.2.3
# via
# -c requirements.txt
# jinja2-time
astunparse==1.6.3
# via tensorflow
attrs==20.3.0
# via
# -c requirements.txt
Expand All @@ -28,8 +34,6 @@ binaryornot==0.4.4
# via
# -c requirements.txt
# cookiecutter
cached-property==1.5.2
# via docker-compose
cachetools==5.2.0
# via google-auth
certifi==2022.9.24
Expand Down Expand Up @@ -127,6 +131,8 @@ flyteidl==1.2.5
# via
# -c requirements.txt
# flytekit
gast==0.5.3
# via tensorflow
google-api-core[grpc]==2.10.2
# via
# google-cloud-bigquery
Expand All @@ -135,7 +141,11 @@ google-api-core[grpc]==2.10.2
google-auth==2.14.1
# via
# google-api-core
# google-auth-oauthlib
# google-cloud-core
# tensorboard
google-auth-oauthlib==0.4.6
# via tensorboard
google-cloud-bigquery==3.4.0
# via -r dev-requirements.in
google-cloud-bigquery-storage==2.16.2
Expand All @@ -146,6 +156,8 @@ google-cloud-core==2.3.2
# via google-cloud-bigquery
google-crc32c==1.5.0
# via google-resumable-media
google-pasta==0.2.0
# via tensorflow
google-resumable-media==2.4.0
# via google-cloud-bigquery
googleapis-common-protos==1.57.0
Expand All @@ -161,11 +173,16 @@ grpcio==1.48.2
# google-api-core
# google-cloud-bigquery
# grpcio-status
# tensorboard
# tensorflow
grpcio-status==1.48.2
# via
# -c requirements.txt
# -r dev-requirements.in
# flytekit
# google-api-core
h5py==3.7.0
# via tensorflow
identify==2.5.9
# via pre-commit
idna==3.4
Expand All @@ -175,14 +192,9 @@ idna==3.4
importlib-metadata==5.0.0
# via
# -c requirements.txt
# click
# flytekit
# jsonschema
# keyring
# pluggy
# pre-commit
# pytest
# virtualenv
# markdown
iniconfig==1.1.1
# via pytest
ipython==7.34.0
Expand Down Expand Up @@ -213,14 +225,23 @@ jsonschema==3.2.0
# via
# -c requirements.txt
# docker-compose
keras==2.8.0
# via tensorflow
keras-preprocessing==1.1.2
# via tensorflow
keyring==23.11.0
# via
# -c requirements.txt
# flytekit
libclang==14.0.6
# via tensorflow
markdown==3.4.1
# via tensorboard
markupsafe==2.1.1
# via
# -c requirements.txt
# jinja2
# werkzeug
marshmallow==3.19.0
# via
# -c requirements.txt
Expand Down Expand Up @@ -259,9 +280,17 @@ nodeenv==1.7.0
numpy==1.21.6
# via
# -c requirements.txt
# flytekit
# h5py
# keras-preprocessing
# opt-einsum
# pandas
# pyarrow
# tensorboard
# tensorflow
oauthlib==3.2.2
# via requests-oauthlib
opt-einsum==3.3.0
# via tensorflow
# scikit-learn
# scipy
packaging==21.3
Expand Down Expand Up @@ -307,6 +336,8 @@ protobuf==3.20.3
# grpcio-status
# proto-plus
# protoc-gen-swagger
# tensorboard
# tensorflow
protoc-gen-swagger==0.1.0
# via
# -c requirements.txt
Expand Down Expand Up @@ -407,7 +438,11 @@ requests==2.28.1
# flytekit
# google-api-core
# google-cloud-bigquery
# requests-oauthlib
# responses
# tensorboard
requests-oauthlib==1.3.1
# via google-auth-oauthlib
responses==0.22.0
# via
# -c requirements.txt
Expand All @@ -429,12 +464,16 @@ singledispatchmethod==1.0
six==1.16.0
# via
# -c requirements.txt
# astunparse
# dockerpty
# google-auth
# google-pasta
# grpcio
# jsonschema
# keras-preprocessing
# paramiko
# python-dateutil
# tensorflow
# websocket-client
sortedcontainers==2.4.0
# via
Expand All @@ -444,6 +483,20 @@ statsd==3.3.0
# via
# -c requirements.txt
# flytekit
tensorboard==2.8.0
# via tensorflow
tensorboard-data-server==0.6.1
# via tensorboard
tensorboard-plugin-wit==1.8.1
# via tensorboard
tensorflow==2.8.1
# via -r dev-requirements.in
tensorflow-estimator==2.8.0
# via tensorflow
tensorflow-io-gcs-filesystem==0.27.0
# via tensorflow
termcolor==2.0.1
# via tensorflow
text-unidecode==1.3
# via
# -c requirements.txt
Expand Down Expand Up @@ -477,11 +530,9 @@ types-toml==0.10.8.1
typing-extensions==4.4.0
# via
# -c requirements.txt
# arrow
# flytekit
# importlib-metadata
# mypy
# responses
# tensorflow
# torch
# typing-inspect
typing-inspect==0.8.0
Expand All @@ -507,12 +558,15 @@ websocket-client==0.59.0
wheel==0.38.4
# via
# -c requirements.txt
# astunparse
# flytekit
# tensorboard
wrapt==1.14.1
# via
# -c requirements.txt
# deprecated
# flytekit
# tensorflow
zipp==3.10.0
# via
# -c requirements.txt
Expand Down
7 changes: 7 additions & 0 deletions docs/source/extras.tensorflow.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
############
TensorFlow Type
############
.. automodule:: flytekit.extras.tensorflow
:no-members:
:no-inherited-members:
:no-special-members:
1 change: 1 addition & 0 deletions docs/source/types.extend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ Refer to the :ref:`extensibility contribution guide <cookbook:advanced_custom_ty
types.builtins.file
types.builtins.directory
extras.pytorch
extras.tensorflow
2 changes: 1 addition & 1 deletion flytekit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
from flytekit.core.workflow import ImperativeWorkflow as Workflow
from flytekit.core.workflow import WorkflowFailurePolicy, reference_workflow, workflow
from flytekit.deck import Deck
from flytekit.extras import pytorch
from flytekit.extras import pytorch, tensorflow
from flytekit.extras.persistence import GCSPersistence, HttpPersistence, S3Persistence
from flytekit.loggers import logger
from flytekit.models.common import Annotations, AuthRole, Labels
Expand Down
31 changes: 31 additions & 0 deletions flytekit/extras/tensorflow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
Flytekit TensorFlow
=========================================
.. currentmodule:: flytekit.extras.tensorflow
.. autosummary::
:template: custom.rst
:toctree: generated/
TensorFlowRecord
"""
from flytekit.loggers import logger

# TODO: abstract this out so that there's an established pattern for registering plugins
# that have soft dependencies
try:
# isolate the exception to the tensorflow import
import tensorflow

_tensorflow_installed = True
except (ImportError, OSError):
_tensorflow_installed = False


if _tensorflow_installed:
from .record import TensorFlowRecordFileTransformer, TensorFlowRecordsDirTransformer
else:
logger.info(
"We won't register TensorFlowRecordFileTransformer and TensorFlowRecordsDirTransformer "
"because tensorflow is not installed."
)
Loading