profile
viewpoint

keras-team/keras 48949

Deep Learning for humans

keras-team/keras-preprocessing 802

Utilities for working with image data, text data, and sequence data.

tensorflow/cloud 73

The TensorFlow Cloud repository provides APIs that will allow to easily go from debugging and training your Keras and TensorFlow code in a local environment to distributed training in the cloud.

pavithrasv/build 0

Build-related tools for TensorFlow

pavithrasv/cloud 0

The TensorFlow Cloud repository provides APIs that will allow to easily go from debugging and training your Keras and TensorFlow code in a local environment to distributed training in the cloud.

pavithrasv/examples 0

TensorFlow examples

pavithrasv/fairing 0

Python SDK for building, training, and deploying ML models

pavithrasv/keras 0

Deep Learning for humans

pavithrasv/keras-io 0

Keras documentation, hosted live at keras.io

startedtensorflow/cloud

started time in 18 hours

fork pavithrasv/cloud

The TensorFlow Cloud repository provides APIs that will allow to easily go from debugging and training your Keras and TensorFlow code in a local environment to distributed training in the cloud.

https://github.com/tensorflow/cloud

fork in 19 hours

push eventtensorflow/cloud

Pavithra Vijay

commit sha f65437668a572bdae718bc89e3f51dc2f5ee9adc

Update version.

view details

Pavithra Vijay

commit sha 9c3d0fafee4cc8d2a5c21bc639e40a8908c4374e

Update version.

view details

Pavithra Vijay

commit sha 6e59eeee1cfb3359c33d947f17ebf8c4f690e5eb

Merge pull request #50 from pavithrasv/master Update version.

view details

push time in 19 hours

PR merged tensorflow/cloud

Update version.

Update version for creating a new release of TF Cloud. I will add release notes and update pypi package once this is submitted.

+2 -2

1 comment

2 changed files

pavithrasv

pr closed time in 19 hours

pull request commenttensorflow/cloud

Update version.

Added release notes: https://github.com/tensorflow/cloud/releases/tag/0.1.3

pavithrasv

comment created time in 2 days

created tagtensorflow/cloud

tag0.1.3

created time in 2 days

release tensorflow/cloud

0.1.3

released time in 2 days

created tagtensorflow/cloud

tag0.1.2

created time in 2 days

release tensorflow/cloud

0.1.2

released time in 2 days

created tagtensorflow/cloud

tag0.1.1

created time in 2 days

release tensorflow/cloud

0.1.1

released time in 2 days

created tagtensorflow/cloud

tag0.1.0

created time in 2 days

release tensorflow/cloud

0.1.0

released time in 2 days

push eventpavithrasv/cloud

Pavithra Vijay

commit sha 9c3d0fafee4cc8d2a5c21bc639e40a8908c4374e

Update version.

view details

push time in 2 days

PR opened tensorflow/cloud

Reviewers
Update version.

Update version for creating a new release of TF Cloud. I will add release notes and update pypi package once this is submitted.

+1 -1

0 comment

1 changed file

pr created time in 2 days

push eventpavithrasv/cloud

Pavithra Vijay

commit sha f65437668a572bdae718bc89e3f51dc2f5ee9adc

Update version.

view details

push time in 2 days

push eventtensorflow/cloud

sina chavoshi

commit sha b31500a30c5524b7dc5683967e999f5571eb6ddc

Add License to files without a license header

view details

Pavithra Vijay

commit sha dd5c18856fcae4948f638392488e94adce90577f

Merge pull request #49 from SinaChavoshi/add_license_files Add License to files without a license header

view details

push time in 2 days

PR merged tensorflow/cloud

Add License to files without a license header

This PR is to add license header to three files that were missing it. Also removed the execution results from one of the notebooks in the process.

+720 -804

2 comments

3 changed files

SinaChavoshi

pr closed time in 2 days

pull request commenttensorflow/cloud

Add License to files without a license header

Thank you for the PR!

SinaChavoshi

comment created time in 2 days

push eventtensorflow/cloud

sina chavoshi

commit sha 7f428aea27e1352bd12e304856d83f6ebb740100

Update integration test links in README

view details

Pavithra Vijay

commit sha a2190f13ae900ac632f13cfc7a5ffd879ad1e33c

Merge pull request #48 from SinaChavoshi/read_me_links Update integration test links in README

view details

push time in 2 days

PR merged tensorflow/cloud

Update integration test links in README

Changing the links in README file to match the new file names (*_test.py) for integration tests.

+7 -7

0 comment

1 changed file

SinaChavoshi

pr closed time in 2 days

push eventtensorflow/cloud

sina chavoshi

commit sha 9969833173340e9f8bd766467dad566fff8552c6

Add *_test.py to integration test files names

view details

sina chavoshi

commit sha 49277ec9ec401ed0fe8bc97f4b878b91a5722172

Merge remote-tracking branch 'upstream/master' into master

view details

sina chavoshi

commit sha 738c463bfbcfac9ca4d97f01690b1d77ae51d828

Merge remote-tracking branch 'upstream/master' into master

view details

sina chavoshi

commit sha 009256782a21f496d46059ab49761274c6b3f23e

adding _test.py to the new integration test

view details

Pavithra Vijay

commit sha 656d2e643ed22dfaf65c1e5ef42edcdd87521bae

Merge pull request #45 from SinaChavoshi/master Add *_test.py to integration test files names

view details

push time in 2 days

PR merged tensorflow/cloud

Add *_test.py to integration test files names

Adding _test.py to integration test files for readability and to help with integration test automation.

+0 -0

3 comments

8 changed files

SinaChavoshi

pr closed time in 2 days

push eventtensorflow/cloud

Jonah Kohn

commit sha 6451faef99ba30b95a1b518741d6dedc57d81504

Readability changes for usage guides.

view details

Pavithra Vijay

commit sha 33920820e65ff8d0ea5b4daab32c19abaf1f9ecd

Merge pull request #46 from jonah-kohn/usage Readability changes for usage guides.

view details

push time in 4 days

PR merged tensorflow/cloud

Readability changes for usage guides.
+7 -11

0 comment

1 changed file

jonah-kohn

pr closed time in 4 days

pull request commenttensorflow/cloud

Add *_test.py to integration test files names

You will need to add new integration tests as well.

SinaChavoshi

comment created time in 5 days

pull request commenttensorflow/cloud

Add *_test.py to integration test files names

Ideally we should be writing different integration tests covering all use cases. I guess for now it's ok to rename these.

SinaChavoshi

comment created time in 5 days

Pull request review commenttensorflow/cloud

Readability changes for usage guides.

 tfc.run(entry_point='mnist_example.py',  The API call will encompass the following: 1. Making code entities such as a Keras script/notebook, **cloud and distribution ready**.-2. Converting this distribution entity into a **docker container** with all the required dependencies.+2. Converting this distribution entity into a **docker container** with the required dependencies. 3. **Deploy** this container at scale and train using TensorFlow distribution strategies. 4. **Stream logs** and monitor them on hosted TensorBoard, manage checkpoint storage.  By default, we will use local docker daemon for building and publishing docker images to Google container registry. Images are published to `gcr.io/your-gcp-project-id`. If you specify `docker_image_bucket_name`, then we will use [Google Cloud build](https://cloud.google.com/cloud-build) to build and publish docker images.  -**Note** If you are using `run` within a notebook script that contains the `tf.keras` model, `docker_image_bucket_name` must be specified.

Why are we removing this?

jonah-kohn

comment created time in 5 days

push eventtensorflow/cloud

Haifeng Jin

commit sha f1b5b143c7c61da8f9ba5ad5f44dbe9727e6b31c

add autokeras example

view details

Pavithra Vijay

commit sha a8133eec4ee8e4a9040f29648423a4ff4414bc9d

Merge pull request #44 from haifeng-jin/ak add autokeras example

view details

push time in 5 days

PR merged tensorflow/cloud

add autokeras example
+37 -1

1 comment

3 changed files

haifeng-jin

pr closed time in 5 days

pull request commenttensorflow/cloud

add autokeras example

Can you also add a link to this example from the ReadMe end to end examples section?

haifeng-jin

comment created time in 5 days

Pull request review commenttensorflow/cloud

add autokeras example

+"""+Search for a good model for the+[MNIST](https://keras.io/datasets/#mnist-database-of-handwritten-digits) dataset.+"""++from tensorflow.keras.datasets import mnist+import tensorflow_cloud as tfc++import autokeras as ak++# Automated MirroredStrategy: chief config with multiple GPUs+tfc.run(+    entry_point=None,+    distribution_strategy="auto",+    chief_config=tfc.COMMON_MACHINE_CONFIGS["V100_1X"],+    worker_count=0,+    docker_base_image="haifengjin/autokeras:1.0.3",+)+# Prepare the dataset.+(x_train, y_train), (x_test, y_test) = mnist.load_data()+print(x_train.shape)  # (60000, 28, 28)+print(y_train.shape)  # (60000,)+print(y_train[:3])  # array([7, 2, 1], dtype=uint8)++# Initialize the ImageClassifier.+clf = ak.ImageClassifier(max_trials=2)+# Search for the best model.+clf.fit(x_train, y_train, epochs=10)+# Evaluate on the testing data.+print('Accuracy: {accuracy}'.format(+    accuracy=clf.evaluate(x_test, y_test)))++clf.export_model().save('model.h5')

Please see: https://github.com/tensorflow/cloud/blob/master/tests/integration/call_run_on_script_with_keras_save_and_load.py https://github.com/tensorflow/cloud/blob/master/tests/testdata/save_and_load.py

haifeng-jin

comment created time in 5 days

Pull request review commenttensorflow/cloud

add autokeras example

+"""+Search for a good model for the+[MNIST](https://keras.io/datasets/#mnist-database-of-handwritten-digits) dataset.+"""++from tensorflow.keras.datasets import mnist+import tensorflow_cloud as tfc++import autokeras as ak++# Automated MirroredStrategy: chief config with multiple GPUs+tfc.run(+    entry_point=None,+    distribution_strategy="auto",+    chief_config=tfc.COMMON_MACHINE_CONFIGS["V100_1X"],+    worker_count=0,+    docker_base_image="haifengjin/autokeras:1.0.3",+)+# Prepare the dataset.+(x_train, y_train), (x_test, y_test) = mnist.load_data()+print(x_train.shape)  # (60000, 28, 28)+print(y_train.shape)  # (60000,)+print(y_train[:3])  # array([7, 2, 1], dtype=uint8)++# Initialize the ImageClassifier.+clf = ak.ImageClassifier(max_trials=2)+# Search for the best model.+clf.fit(x_train, y_train, epochs=10)+# Evaluate on the testing data.+print('Accuracy: {accuracy}'.format(+    accuracy=clf.evaluate(x_test, y_test)))++clf.export_model().save('model.h5')

Should we provide a GCS bucket location instead of storing in local disk?

haifeng-jin

comment created time in 5 days

Pull request review commenttensorflow/cloud

add autokeras example

+"""+Search for a good model for the+[MNIST](https://keras.io/datasets/#mnist-database-of-handwritten-digits) dataset.+"""++from tensorflow.keras.datasets import mnist+import tensorflow_cloud as tfc++import autokeras as ak++# Automated MirroredStrategy: chief config with multiple GPUs+tfc.run(+    entry_point=None,+    distribution_strategy="auto",+    chief_config=tfc.COMMON_MACHINE_CONFIGS["V100_1X"],+    worker_count=0,+    docker_base_image="haifengjin/autokeras:1.0.3",+)+# Prepare the dataset.+(x_train, y_train), (x_test, y_test) = mnist.load_data()+print(x_train.shape)  # (60000, 28, 28)+print(y_train.shape)  # (60000,)+print(y_train[:3])  # array([7, 2, 1], dtype=uint8)++# Initialize the ImageClassifier.+clf = ak.ImageClassifier(max_trials=2)+# Search for the best model.+clf.fit(x_train, y_train, epochs=10)+# Evaluate on the testing data.+print('Accuracy: {accuracy}'.format(

Can you try formatting using black? pip install black

haifeng-jin

comment created time in 5 days

Pull request review commenttensorflow/cloud

add autokeras example

+"""+Search for a good model for the+[MNIST](https://keras.io/datasets/#mnist-database-of-handwritten-digits) dataset.+"""++from tensorflow.keras.datasets import mnist+import tensorflow_cloud as tfc++import autokeras as ak++# Automated MirroredStrategy: chief config with multiple GPUs+tfc.run(+    entry_point=None,

Can we remove entry_point, distribution_strategy and worker_count params as they are default values?

haifeng-jin

comment created time in 5 days

push eventtensorflow/cloud

Jonah Kohn

commit sha 2db2a07c62c2bba1fcd0ef9b68dc824348093819

Update setup instructions for ease of use.

view details

Jonah Kohn

commit sha 605a07de51091697d7225fb115a93e1097954b8c

Update README.md

view details

Jonah Kohn

commit sha 6d27b243e7da536b5e79b69dda2199ac18e6369d

Prioritize cloud bucket workflow in setup guide. The removed `dockerd` command is readily available as the first thing you read on the provided link https://docs.docker.com/config/daemon/#start-the-daemon-manually. I think it makes sense to provide this resource to users who may need it, but personally don't believe it needs a place in the "recommended setup" workflow.

view details

Jonah Kohn

commit sha bd2b7c16c1fea1a64b63b619279fea21aa5aa282

Include code snippet for local docker setup

view details

Pavithra Vijay

commit sha b2c9a9bebbf0ab67f9bd88460de0c5ff7966b47a

Merge pull request #41 from jonah-kohn/setup Update setup instructions for ease of use.

view details

push time in 5 days

PR merged tensorflow/cloud

Update setup instructions for ease of use.

I'd still like to address the local docker vs cloud bucket issue, but don't want to make any significant changes to the setup structure without your approval.

+9 -15

1 comment

1 changed file

jonah-kohn

pr closed time in 5 days

Pull request review commenttensorflow/cloud

Update setup instructions for ease of use.

 Create the GOOGLE_APPLICATION_CREDENTIALS environment variable. export GOOGLE_APPLICATION_CREDENTIALS=~/key.json ``` -6. Docker dependencies--To use local [docker daemon process](https://docs.docker.com/config/daemon/#start-the-daemon-manually) for docker build and publish--```console-dockerd-```--**or**--[Create a cloud storage bucket](https://cloud.google.com/ai-platform/docs/getting-started-keras#create_a_bucket) for using [Google Cloud build](https://cloud.google.com/cloud-build) for docker image build and publish.+6. [Create a cloud storage bucket](https://cloud.google.com/ai-platform/docs/getting-started-keras#create_a_bucket). Using [Google Cloud build](https://cloud.google.com/cloud-build) is the recommended method for building and publishing docker images, although we optionally allow for local [docker daemon process](https://docs.docker.com/config/daemon/#start-the-daemon-manually) depending on your specific needs.  ```console BUCKET_NAME="your-bucket-name" REGION="us-central1"+gcloud auth login gsutil mb -l $REGION gs://$BUCKET_NAME ``` -7. [Optional] Install [nbconvert](https://nbconvert.readthedocs.io/en/latest/)+(optional for local docker process) 

Please add the code snippet for local docker.

jonah-kohn

comment created time in 5 days

pull request commenttensorflow/cloud

Update setup instructions for ease of use.

Yes, let's make cloud storage bucket as the first option and then talk about local docker process.

jonah-kohn

comment created time in 5 days

push eventtensorflow/cloud

Jonah Kohn

commit sha a17ad353234a03c810da8ddb9331cf15de9bd964

Update requirements and overview for readability.

view details

Pavithra Vijay

commit sha b8c3f7d11e24aed9e8aa5de8cf5351011772e073

Merge pull request #40 from jonah-kohn/readme-readability Update requirements and overview for readability.

view details

push time in 5 days

push eventtensorflow/cloud

Jonah Kohn

commit sha 76d41499094a152b5d753c540c680d3407f1bdf2

Increase default value for max_status_check_attempts Checking the status ever 30 seconds is still a good idea, so I doubled the number of check cycles to reach 10 mins.

view details

Pavithra Vijay

commit sha 567698d5d8f6570ad6bbb1a086f7027476a5445b

Merge pull request #39 from jonah-kohn/master Increase default value for max_status_check_attempts

view details

push time in 7 days

PR merged tensorflow/cloud

Increase default value for max_status_check_attempts

Checking the status ever 30 seconds is still a good idea, so I doubled the number of check cycles to reach 10 mins.

+1 -1

0 comment

1 changed file

jonah-kohn

pr closed time in 7 days

push eventtensorflow/cloud

Pavithra Vijay

commit sha 9fca004084c65e220de6c37b815ab849e51d220b

Default to py3 for TF docker images.

view details

Pavithra Vijay

commit sha 07c0d3c7cab18669ae8a245b470411dd19021798

Merge pull request #35 from pavithrasv/master Default to py3 for TF docker images.

view details

push time in 7 days

PR merged tensorflow/cloud

Default to py3 for TF docker images.

Default to py3 for TF docker images.

+8 -6

0 comment

2 changed files

pavithrasv

pr closed time in 7 days

issue commenttensorflow/cloud

Distributed training for Keras-Tuner

Thank you for the issue @yixingfu. This is definitely an important feature and we have plans to add support for this in the future.

yixingfu

comment created time in 9 days

PR opened tensorflow/cloud

Default to py3 for TF docker images.

Default to py3 for TF docker images.

+8 -6

0 comment

2 changed files

pr created time in 9 days

push eventpavithrasv/cloud

Pavithra Vijay

commit sha 9fca004084c65e220de6c37b815ab849e51d220b

Default to py3 for TF docker images.

view details

push time in 9 days

pull request commenttensorflow/tensorflow

Add checking of kwonlyargs in keras has_arg

Yes, i think it should be ok since Python 2 is not supported.

adriangb

comment created time in 13 days

issue closedtensorflow/cloud

cloud build fail when tf-nightly installed locally

In an environment with tf-nightly, trying to run tfc with cloud build fails.

The failure is caused by dockerfile use version to determine base image. In the case of tf-nightly, it gives something like 2.x.0-dev2020mmdd.

It should be good to check if corresponding image exist before starting build, and throw relevant error message. Also, for the case of nightly build, can we just use nightly for all versions labeled with 'dev'?

closed time in 14 days

yixingfu

issue commenttensorflow/cloud

cloud build fail when tf-nightly installed locally

Fixed in https://github.com/tensorflow/cloud/pull/30

yixingfu

comment created time in 14 days

push eventtensorflow/cloud

Haifeng Jin

commit sha 74b851545c85d8bcdec44ad85545d46c822684b1

output image uri in error message

view details

Haifeng Jin

commit sha 522202980e9e6165f125b94925ce811f70a0e7ac

Merge branch 'master' into image_uri

view details

Haifeng Jin

commit sha 4764fef436ceeb6c52e8a0263e4404eeda32e7a1

Merge branch 'master' into image_uri

view details

Haifeng Jin

commit sha 925d515da2f96784bbe2d3fb1beab8678ed6a603

Merge branch 'image_uri' of github.com:haifeng-jin/cloud into image_uri

view details

Pavithra Vijay

commit sha 59eca3f4bf6d4cb49a6485fe94afd2bf6b02809b

Merge pull request #32 from haifeng-jin/image_uri output image uri in error message

view details

push time in 14 days

PR merged tensorflow/cloud

output image uri in error message

It is easier with the image URI printed out, when trying to find out why the access to the container registry is denied.

+6 -4

0 comment

1 changed file

haifeng-jin

pr closed time in 14 days

push eventtensorflow/cloud

Haifeng Jin

commit sha 9a929e0a73d467c4a1818c49c427c810171dda26

Update README.md The space causes the line break not recognized.

view details

Pavithra Vijay

commit sha ea8918d6f4c62086fc7d37be8030f0e694dc50a5

Merge pull request #31 from haifeng-jin/patch-1 Update README.md

view details

push time in 19 days

PR merged tensorflow/cloud

Update README.md

The space causes the line break not recognized.

+1 -1

0 comment

1 changed file

haifeng-jin

pr closed time in 19 days

push eventtensorflow/cloud

Yixing Fu

commit sha d4335f7e8ac4e941803baa370a4427106aa00d44

check base image exist before build

view details

Yixing Fu

commit sha 2441b8f066dab099cde7ebbedfccc6535abd03c7

add test for checking base image

view details

Yixing Fu

commit sha 0b63ce1872ff55501f8808e1c6f275fe215776f7

format test

view details

Yixing Fu

commit sha 384e2968627f5b23725022f78a6df30c6bb6f533

rephrase error message; format code

view details

Yixing Fu

commit sha 306b32d4bc63981ed6beee4027b4bd62b1473c0c

shorten line

view details

Pavithra Vijay

commit sha af3bcfa48ae7efae94122ceab9880b3112e36ec5

Merge pull request #30 from yixingfu/dockerimage check base image exist before build

view details

push time in 20 days

PR merged tensorflow/cloud

check base image exist before build

The container by default uses the TF version of local environment. This causes build fail when local version of TF does not have corresponding base image. It may be good to check before build, especially for cloud build.

Also, using local TF version makes trouble when tf-nighly is installed locally. I try to reroute any version number including 'dev', that does not have correponding base image, to tf-nightly.

#29

+79 -0

0 comment

2 changed files

yixingfu

pr closed time in 20 days

Pull request review commenttensorflow/cloud

check base image exist before build

 def _create_docker_file(self):             ):                 self.docker_base_image += "-gpu" +        if not self._base_image_exist():+            if "dev" in self.docker_base_image:+                warnings.warn(+                    "Docker base image {} does not exist.".format(+                        self.docker_base_image+                    )+                )+                newtag = "nightly"+                if self.docker_base_image.endswith("-gpu"):+                    newtag += "-gpu"+                self.docker_base_image = (+                    self.docker_base_image.split(":")[0] + ":" + newtag+                )+                warnings.warn("Using TF nightly build.")+            else:+                raise ValueError(+                    "There is no docker base image corresponding to the local TF version: {}. Please provide docker_base_image or try with an other TF version.".format(

Can you format this so that line length is <= 80 and use black? Thank you!

yixingfu

comment created time in 21 days

issue commenttensorflow/tensorflow

Losses with Reduction.NONE do not keep the input shape (the result is averaged along the last axis)

@pGit1 Sorry about that. I understand this can be confusing. This is by design and has been since the beginning of Keras, so any changes to this will be a big breaking change. If your data is 1D, we request that this be converted to 2D as losses expect 2D data. You will get 1D data back ie. one loss value per example when reduction is None.

matgad

comment created time in 22 days

Pull request review commenttensorflow/cloud

check base image exist before build

 def _generate_name(self):         unique_tag = str(uuid.uuid4()).replace("-", "_")         return "{}/{}:{}".format(self.docker_registry, "tf_cloud_train", unique_tag) +    def _base_image_exist(self):+        """Check whether the docker base image exist on dockerhub. +        use docker api v2 to check if base image is available.+        """+        repo_name, tag_name = self.docker_base_image.split(":")+        r = requests.get("http://hub.docker.com/v2/repositories/{}/tags/{}".format(repo_name, tag_name))

Please format files using black. pip install black, black filename.py.

yixingfu

comment created time in 22 days

Pull request review commenttensorflow/cloud

check base image exist before build

 def _create_docker_file(self):             ):                 self.docker_base_image += "-gpu" +        if not self._base_image_exist():

Can you add some unit tests for these?

yixingfu

comment created time in 22 days

Pull request review commenttensorflow/cloud

check base image exist before build

 def _create_docker_file(self):             ):                 self.docker_base_image += "-gpu" +        if not self._base_image_exist():+            if "dev" in self.docker_base_image:+                warnings.warn("Docker base image {} does not exist.".format(self.docker_base_image))+                newtag = "nightly"+                if self.docker_base_image.endswith("-gpu"):+                    newtag += "-gpu"+                self.docker_base_image = self.docker_base_image.split(":")[0] + ":" + newtag+                warnings.warn("Using TF nightly build.")+            else:+                raise ValueError("Local TF version {} does not have available base image.".format(self.VERSION))

"There is no docker base image corresponding to the local TF version: {}. Please provide docker_base_image or try with an other TF version."

yixingfu

comment created time in 22 days

push eventtensorflow/cloud

Lukas Geiger

commit sha c952ef3ecb90c44ed6b45ee262ad7ac1c76f8425

Copy code as last step of the container build

view details

Pavithra Vijay

commit sha 6ef50df9fdb0323ccdcb715528ce6fac7d78ceb7

Merge pull request #28 from lgeiger/faster-docker-builds Copy code as last step of the container build

view details

push time in 22 days

PR merged tensorflow/cloud

Copy code as last step of the container build

The code is the main part that changes during model development. Copying the code to the Docker image before installing the dependencies prevents caching of the dependencies since all Docker layers need to be rebuilt if a previous one changes. This PR changes the order of the Docker file to copy the code as the last step so that dependencies only need to be reinstalled if the requirements.txt file changes. This speeds up local build times by a large amount since dependencies don't need to be reinstalled on every code change.

+13 -6

0 comment

2 changed files

lgeiger

pr closed time in 22 days

issue closedtensorflow/tensorflow

exception in gradient computation for losses when combining Tensor and EagerTensor

System information - Have I written custom code (as opposed to using a stock example script provided in TensorFlow): yes

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): - Linux Mint 19
  • TensorFlow installed from (source or binary): binary (pip)
  • TensorFlow version (use command below): v2.1.0-rc2-17-ge5bf8de 2.1.0
  • Python version: 3.6

Describe the current behavior The following minimal example works when using the second implementation alternative, but raises an error for the first:

ip = layers.Input(10)
with tf.GradientTape() as tape:
    t = tf.zeros((10, 10))
    tape.watch(t)
    # this line throws an error 
    result = keras.losses.MeanSquaredError()(t, ip)
    # but this one works
    # result = (t - ip)**2 / tf.cast(tf.reduce_prod(tf.shape(t)), tf.float32)
tape.gradient(result, t)

The error is

  File "~/wrapper.py", line 101, in <module>
    print(tape.gradient(result, t))
  File "~/venv/lib/python3.6/site-packages/tensorflow_core/python/eager/backprop.py", line 1029, in gradient
    unconnected_gradients=unconnected_gradients)
  File "~/venv/lib/python3.6/site-packages/tensorflow_core/python/eager/imperative_grad.py", line 77, in imperative_grad
    compat.as_str(unconnected_gradients.value))
  File "~/venv/lib/python3.6/site-packages/tensorflow_core/python/eager/backprop.py", line 141, in _gradient_function
    return grad_fn(mock_op, *out_grads)
  File "~/venv/lib/python3.6/site-packages/tensorflow_core/python/ops/math_grad.py", line 258, in _MeanGrad
    sum_grad = _SumGrad(op, grad)[0]
  File "~/venv/lib/python3.6/site-packages/tensorflow_core/python/ops/math_grad.py", line 213, in _SumGrad
    op.inputs[1])
  File "~/venv/lib/python3.6/site-packages/tensorflow_core/python/ops/math_ops.py", line 3502, in reduced_shape
    input_shape = input_shape.numpy()
AttributeError: 'Tensor' object has no attribute 'numpy'

Describe the expected behavior As the second implementation works, i would also expect the first to work.

I have not done exhaustive testing of different loss functions, but the same problem also occurs when replacing the MeanSquaredError by CategoricalCrossEntropy. The problem seems to be caused by the fact that only one of the arguments to the loss function is an EagerTensor.

closed time in 23 days

ngc92

issue commenttensorflow/tensorflow

exception in gradient computation for losses when combining Tensor and EagerTensor

Thank you @ngc92 . The equivalent of result = keras.losses.MeanSquaredError()(t, ip) will not be result = (t - ip)**2 / tf.cast(tf.reduce_prod(tf.shape(t)), tf.float32).

It will be the following roughly:

      mean_per_sample = math_ops.mean((t - ip)**2 / math_ops.cast(math_ops.reduce_prod(array_ops.shape(t)), dtypes.float32), axis=-1)
      total_loss = math_ops.reduce_sum(mean_per_sample)
      num_present = math_ops.cast(array_ops.size(mean_per_sample), dtype=mean_per_sample.dtype)
      result = math_ops.div_no_nan(total_loss, num_present, name='value')

Here is a detailed example for writing custom training loop: https://keras.io/guides/writing_a_training_loop_from_scratch/. Please check it out.

ngc92

comment created time in 23 days

issue commenttensorflow/tensorflow

Some bugs of CategoricalCrossentropy and SparseCategoricalCrossentropy in tf.keras.losses

I made the change in this nightly colab. The workaround works for sparse_categorical_crossentropy as well. PTAL and let me know.

gdhy9064

comment created time in a month

issue commenttensorflow/tensorflow

Some bugs of CategoricalCrossentropy and SparseCategoricalCrossentropy in tf.keras.losses

Thank you @gdhy9064, one simple workaround you can do for both the cases above is : remove activation parameter from the Dense layer and add a separate Activation layer like

    o = layers.Dense(2)(i[:, None])
    o = layers.Activation('softmax')(o)

We will fix the underlying issue soon.

gdhy9064

comment created time in a month

issue closedtensorflow/cloud

TensorFlow Cloud on Colab

Is there any way of using this tensorflow-cloud repository on Google Colab?

closed time in a month

m3sibti

issue commenttensorflow/cloud

TensorFlow Cloud on Colab

Please checkout colab example: https://github.com/tensorflow/cloud/blob/master/tests/integration/call_run_within_nb_on_colab.ipynb

Thank you!

m3sibti

comment created time in a month

push eventtensorflow/cloud

Lukas Geiger

commit sha efce989a35e6495b2f679450a429aea07a53c266

Fix docker logging decode error

view details

Pavithra Vijay

commit sha afa0e4cc1165c06b663e2e906255dd30cc7f0e0b

Merge pull request #26 from lgeiger/fix-logging Fix docker build logs decode error

view details

push time in a month

PR merged tensorflow/cloud

Fix docker build logs decode error

When trying out the example in the README I ran into the following JSON decode error during the local docker build since the logger couldn't decode {"stream":"\n"}:

INFO:tensorflow_cloud.containerize:Building docker image: gcr.io/bnn-research/tf_cloud_train:6040dde0_5626_4e5a_b4c4_1b13d427c421
INFO:tensorflow_cloud.containerize:{"stream":"Step 1/6 : FROM tensorflow/tensorflow:2.2.0-gpu"}
{"stream":"\n"}
Traceback (most recent call last):
  File "/Users/lukasgeiger/code/cloud/tensorflow_cloud/containerize.py", line 304, in _get_logs
    line = json.loads(unicode_line)
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 62)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "example.py", line 6, in <module>
    requirements_txt="requirements.txt",
  File "/Users/lukasgeiger/code/cloud/tensorflow_cloud/run.py", line 211, in run
    docker_img_uri = container_builder.get_docker_image()
  File "/Users/lukasgeiger/code/cloud/tensorflow_cloud/containerize.py", line 251, in get_docker_image
    image_uri = self._build_docker_image()
  File "/Users/lukasgeiger/code/cloud/tensorflow_cloud/containerize.py", line 272, in _build_docker_image
    self._get_logs(bld_logs_generator, "build")
  File "/Users/lukasgeiger/code/cloud/tensorflow_cloud/containerize.py", line 312, in _get_logs
    raise RuntimeError("There was an error decoding the Docker logs")
RuntimeError: There was an error decoding the Docker logs

Using the builtin decode function of the Docker API fixes the error.

This PR also changes the logging to only print the stream instead of the entire JSON dict which make the output a lot more readable in the example I tried.

Note: This is the first time I am trying out TensorFlow Cloud so I might miss some edge cases.

+12 -19

0 comment

2 changed files

lgeiger

pr closed time in a month

issue commenttensorflow/tensorflow

Inconsistency in MirroredStrategy evaluation results for batch dependent metrics

That's correct, that will not reset in evaluation.

zaccharieramzi

comment created time in a month

push eventtensorflow/cloud

Lukas Geiger

commit sha 2e08e7b9d964551f1840d649e2e224061c9fc45e

Add .gitignore This PR adds a the [default Python `.gitignore`](https://github.com/github/gitignore/blob/master/Python.gitignore) to the repo in order to prevent contributors from commiting cache files or their virtual environment.

view details

Pavithra Vijay

commit sha 428f896348781170eb5a933131ad1f44b4283bda

Merge pull request #27 from lgeiger/add-gitignore Add .gitignore

view details

push time in a month

PR merged tensorflow/cloud

Add .gitignore

This PR adds a the default Python .gitignore to the repo in order to prevent contributors from commiting cache files or their virtual environment.

+138 -0

1 comment

1 changed file

lgeiger

pr closed time in a month

pull request commenttensorflow/cloud

Add .gitignore

Thank you for the PR!

lgeiger

comment created time in a month

push eventtensorflow/cloud

Pavithra Vijay

commit sha 3dc7e0c0c7cd04ccf5500c920369722a7ee48798

Keras tuner example.

view details

Pavithra Vijay

commit sha 96d2aa51a0638ff715e147289ac3674d04190b9e

Keras tuner example.

view details

Pavithra Vijay

commit sha 36617e1f90b70af7fa3420aec3c757a2797e4a0e

Keras tuner example.

view details

Pavithra Vijay

commit sha e380b51ca9b99d60ed986482c75c99a032c61229

Merge pull request #25 from pavithrasv/master Keras tuner example.

view details

push time in a month

PR merged tensorflow/cloud

Keras tuner example.

Simple keras tuner example.

+155 -7

2 comments

4 changed files

pavithrasv

pr closed time in a month

pull request commenttensorflow/cloud

Keras tuner example.

Updated, PTAL. Thank you Francois!

pavithrasv

comment created time in a month

push eventpavithrasv/cloud

Pavithra Vijay

commit sha 36617e1f90b70af7fa3420aec3c757a2797e4a0e

Keras tuner example.

view details

push time in a month

Pull request review commenttensorflow/cloud

Keras tuner example.

+import argparse+import os++from tensorflow import keras+from tensorflow.keras import layers+from tensorflow.keras.datasets import cifar10++from tensorflow.keras.preprocessing.image import ImageDataGenerator++from kerastuner.tuners import RandomSearch+from kerastuner.engine.hypermodel import HyperModel+from kerastuner.engine.hyperparameters import HyperParameters++(x_train, y_train), (x_test, y_test) = cifar10.load_data()+y_train = keras.utils.to_categorical(y_train, 10)+y_test = keras.utils.to_categorical(y_test, 10)+x_train = x_train.astype("float32")+x_test = x_test.astype("float32")+x_train /= 255+x_test /= 255+++def build_model(hp):+    model = keras.Sequential()

Used just 'relu' and 'elu' activations as hp.Choice does not allow objects of different types. I could not use layers.Activation('relu') and layers.LeakyRelu() together in hp.Choice.

pavithrasv

comment created time in a month

Pull request review commenttensorflow/cloud

Keras tuner example.

+import argparse+import os++from tensorflow import keras+from tensorflow.keras import layers+from tensorflow.keras.datasets import cifar10++from tensorflow.keras.preprocessing.image import ImageDataGenerator++from kerastuner.tuners import RandomSearch+from kerastuner.engine.hypermodel import HyperModel+from kerastuner.engine.hyperparameters import HyperParameters++(x_train, y_train), (x_test, y_test) = cifar10.load_data()+y_train = keras.utils.to_categorical(y_train, 10)+y_test = keras.utils.to_categorical(y_test, 10)+x_train = x_train.astype("float32")+x_test = x_test.astype("float32")+x_train /= 255+x_test /= 255+++def build_model(hp):+    model = keras.Sequential()+    model.add(+        layers.Conv2D(+            32, (3, 3), padding="same", activation="relu", input_shape=x_train.shape[1:]+        )+    )+    model.add(layers.Conv2D(32, (3, 3), activation="relu"))+    model.add(layers.MaxPooling2D(pool_size=(2, 2)))+    model.add(+        layers.Dropout(+            rate=hp.Float(+                "dropout_1", min_value=0.0, max_value=0.5, default=0.25, step=0.05,+            )+        )+    )++    model.add(+        layers.Conv2D(+            hp.Choice("num_filters", values=[32, 64], default=64,),+            (3, 3),+            padding="same",+            activation="relu",+        )+    )+    model.add(layers.Conv2D(64, (3, 3), activation="relu"))+    model.add(layers.MaxPooling2D(pool_size=(2, 2)))+    model.add(+        layers.Dropout(+            rate=hp.Float(+                "dropout_2", min_value=0.0, max_value=0.5, default=0.25, step=0.05,+            )+        )+    )++    model.add(layers.Flatten())+    model.add(layers.Dense(512, activation="relu"))+    model.add(+        layers.Dropout(+            rate=hp.Float(+                "dropout_3", min_value=0.0, max_value=0.5, default=0.25, step=0.05,+            )+        )+    )+    model.add(layers.Dense(10, activation="softmax"))++    model.compile(+        loss="categorical_crossentropy",+        optimizer=keras.optimizers.RMSprop(+            learning_rate=hp.Choice("learning_rate", [1e-2, 1e-3, 1e-4]), decay=1e-6+        ),+        metrics=["accuracy"],+    )+    return model+++datagen = ImageDataGenerator(+    width_shift_range=0.1,+    height_shift_range=0.1,+    horizontal_flip=True,+    vertical_flip=True,+)+datagen.fit(x_train)++tuner = RandomSearch(+    build_model,+    objective="val_accuracy",+    max_trials=5,+    executions_per_trial=3,+    directory="test_dir",+)++tuner.search_space_summary()+tuner.search(+    datagen.flow(x_train, y_train, batch_size=32),+    epochs=50,

Done.

pavithrasv

comment created time in a month

Pull request review commenttensorflow/cloud

Keras tuner example.

+import argparse+import os++from tensorflow import keras+from tensorflow.keras import layers+from tensorflow.keras.datasets import cifar10++from tensorflow.keras.preprocessing.image import ImageDataGenerator++from kerastuner.tuners import RandomSearch+from kerastuner.engine.hypermodel import HyperModel+from kerastuner.engine.hyperparameters import HyperParameters++(x_train, y_train), (x_test, y_test) = cifar10.load_data()+y_train = keras.utils.to_categorical(y_train, 10)+y_test = keras.utils.to_categorical(y_test, 10)+x_train = x_train.astype("float32")+x_test = x_test.astype("float32")+x_train /= 255+x_test /= 255+++def build_model(hp):+    model = keras.Sequential()

Done.

pavithrasv

comment created time in a month

Pull request review commenttensorflow/cloud

Keras tuner example.

+import argparse+import os++from tensorflow import keras+from tensorflow.keras import layers+from tensorflow.keras.datasets import cifar10++from tensorflow.keras.preprocessing.image import ImageDataGenerator++from kerastuner.tuners import RandomSearch+from kerastuner.engine.hypermodel import HyperModel+from kerastuner.engine.hyperparameters import HyperParameters++(x_train, y_train), (x_test, y_test) = cifar10.load_data()+y_train = keras.utils.to_categorical(y_train, 10)+y_test = keras.utils.to_categorical(y_test, 10)+x_train = x_train.astype("float32")+x_test = x_test.astype("float32")+x_train /= 255+x_test /= 255+++def build_model(hp):+    model = keras.Sequential()+    model.add(+        layers.Conv2D(+            32, (3, 3), padding="same", activation="relu", input_shape=x_train.shape[1:]+        )+    )+    model.add(layers.Conv2D(32, (3, 3), activation="relu"))+    model.add(layers.MaxPooling2D(pool_size=(2, 2)))+    model.add(+        layers.Dropout(+            rate=hp.Float(+                "dropout_1", min_value=0.0, max_value=0.5, default=0.25, step=0.05,+            )+        )+    )++    model.add(+        layers.Conv2D(+            hp.Choice("num_filters", values=[32, 64], default=64,),+            (3, 3),+            padding="same",+            activation="relu",+        )+    )+    model.add(layers.Conv2D(64, (3, 3), activation="relu"))+    model.add(layers.MaxPooling2D(pool_size=(2, 2)))+    model.add(+        layers.Dropout(+            rate=hp.Float(+                "dropout_2", min_value=0.0, max_value=0.5, default=0.25, step=0.05,+            )+        )+    )++    model.add(layers.Flatten())+    model.add(layers.Dense(512, activation="relu"))+    model.add(+        layers.Dropout(+            rate=hp.Float(+                "dropout_3", min_value=0.0, max_value=0.5, default=0.25, step=0.05,+            )+        )+    )+    model.add(layers.Dense(10, activation="softmax"))++    model.compile(+        loss="categorical_crossentropy",+        optimizer=keras.optimizers.RMSprop(+            learning_rate=hp.Choice("learning_rate", [1e-2, 1e-3, 1e-4]), decay=1e-6

Done.

pavithrasv

comment created time in a month

Pull request review commenttensorflow/cloud

Keras tuner example.

+import argparse+import os++from tensorflow import keras+from tensorflow.keras import layers+from tensorflow.keras.datasets import cifar10++from tensorflow.keras.preprocessing.image import ImageDataGenerator++from kerastuner.tuners import RandomSearch+from kerastuner.engine.hypermodel import HyperModel+from kerastuner.engine.hyperparameters import HyperParameters++(x_train, y_train), (x_test, y_test) = cifar10.load_data()+y_train = keras.utils.to_categorical(y_train, 10)+y_test = keras.utils.to_categorical(y_test, 10)+x_train = x_train.astype("float32")+x_test = x_test.astype("float32")+x_train /= 255+x_test /= 255+++def build_model(hp):+    model = keras.Sequential()+    model.add(+        layers.Conv2D(+            32, (3, 3), padding="same", activation="relu", input_shape=x_train.shape[1:]+        )+    )+    model.add(layers.Conv2D(32, (3, 3), activation="relu"))+    model.add(layers.MaxPooling2D(pool_size=(2, 2)))+    model.add(+        layers.Dropout(+            rate=hp.Float(+                "dropout_1", min_value=0.0, max_value=0.5, default=0.25, step=0.05,+            )+        )+    )++    model.add(+        layers.Conv2D(+            hp.Choice("num_filters", values=[32, 64], default=64,),+            (3, 3),+            padding="same",+            activation="relu",+        )+    )+    model.add(layers.Conv2D(64, (3, 3), activation="relu"))+    model.add(layers.MaxPooling2D(pool_size=(2, 2)))+    model.add(+        layers.Dropout(+            rate=hp.Float(+                "dropout_2", min_value=0.0, max_value=0.5, default=0.25, step=0.05,+            )+        )+    )++    model.add(layers.Flatten())+    model.add(layers.Dense(512, activation="relu"))+    model.add(+        layers.Dropout(+            rate=hp.Float(+                "dropout_3", min_value=0.0, max_value=0.5, default=0.25, step=0.05,+            )+        )+    )+    model.add(layers.Dense(10, activation="softmax"))++    model.compile(+        loss="categorical_crossentropy",+        optimizer=keras.optimizers.RMSprop(+            learning_rate=hp.Choice("learning_rate", [1e-2, 1e-3, 1e-4]), decay=1e-6+        ),+        metrics=["accuracy"],+    )+    return model+++datagen = ImageDataGenerator(

Done.

pavithrasv

comment created time in a month

pull request commenttensorflow/cloud

Keras tuner example.

Updated. Thank you Francois!

pavithrasv

comment created time in a month

Pull request review commenttensorflow/cloud

Keras tuner example.

+from tensorflow import keras+from tensorflow.keras import layers+++from kerastuner.tuners import RandomSearch+from kerastuner.engine.hypermodel import HyperModel+from kerastuner.engine.hyperparameters import HyperParameters+++(x, y), (val_x, val_y) = keras.datasets.mnist.load_data()+x = x.astype("float32") / 255.0+val_x = val_x.astype("float32") / 255.0++x = x[:10000]+y = y[:10000]+++def build_model(hp):+    model = keras.Sequential()+    model.add(layers.Flatten(input_shape=(28, 28)))+    for i in range(hp.Int("num_layers", 2, 20)):+        model.add(+            layers.Dense(+                units=hp.Int("units_" + str(i), 32, 512, 32), activation="relu"+            )+        )+    model.add(layers.Dense(10, activation="softmax"))+    model.compile(+        optimizer=keras.optimizers.Adam(hp.Choice("learning_rate", [1e-2, 1e-3, 1e-4])),+        loss="sparse_categorical_crossentropy",+        metrics=["accuracy"],+    )+    return model+++tuner = RandomSearch(+    build_model,+    objective="val_accuracy",+    max_trials=5,+    executions_per_trial=3,+    directory="test_dir",+)++tuner.search_space_summary()++tuner.search(x=x, y=y, epochs=3, validation_data=(val_x, val_y))++tuner.results_summary()

Retrieving the best model and saving it in GCS path.

pavithrasv

comment created time in a month

Pull request review commenttensorflow/cloud

Keras tuner example.

+# Copyright 2020 Google LLC. All Rights Reserved.+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+#     http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.+from __future__ import absolute_import+from __future__ import division+from __future__ import print_function++import tensorflow_cloud as tfc++# Automated CPU strategy: CPU chief config and no workers+# tfc.run(+#     entry_point='tests/testdata/keras_tuner_mnist_example.py',+#     distribution_strategy='auto',+#     requirements_txt='tests/testdata/requirements.txt',+#     chief_config=tfc.COMMON_MACHINE_CONFIGS['CPU'],+#     stream_logs=True)+++# Automated OneDeviceStrategy: default 1 GPU chief config and no workers+# tfc.run(+#     entry_point='tests/testdata/keras_tuner_mnist_example.py',+#     distribution_strategy='auto',+#     requirements_txt='tests/testdata/requirements.txt',+#     stream_logs=True)++# Automated MirroredStrategy: chief config with multiple GPUs+tfc.run(

Added a model save path.

pavithrasv

comment created time in a month

Pull request review commenttensorflow/cloud

Keras tuner example.

+from tensorflow import keras+from tensorflow.keras import layers+++from kerastuner.tuners import RandomSearch+from kerastuner.engine.hypermodel import HyperModel+from kerastuner.engine.hyperparameters import HyperParameters+++(x, y), (val_x, val_y) = keras.datasets.mnist.load_data()

Done.

pavithrasv

comment created time in a month

push eventpavithrasv/cloud

Pavithra Vijay

commit sha 96d2aa51a0638ff715e147289ac3674d04190b9e

Keras tuner example.

view details

push time in a month

Pull request review commenttensorflow/cloud

Keras tuner example.

 def validate(self):         accelerator_type=AcceleratorType.NVIDIA_TESLA_V100,         accelerator_count=4,     ),-    "V100_8X": MachineConfig(

Removed this as 8 V100s cannot be created. It is above the allowed limit of 4 for Cloud ML engine

pavithrasv

comment created time in a month

PR opened tensorflow/cloud

Keras tuner example.

Simple keras tuner example.

+94 -7

0 comment

4 changed files

pr created time in a month

push eventpavithrasv/cloud

Pavithra Vijay

commit sha 3dc7e0c0c7cd04ccf5500c920369722a7ee48798

Keras tuner example.

view details

push time in a month

issue commenttensorflow/tensorflow

Keras connectivity metadata is not set correctly in TF 2.2.0rc0

I have fixed the original issue. ie. you can use _keras_history or inbound_nodes to get the information. There are no plans at this time to add properties describing the Keras graph structure.

drasmuss

comment created time in a month

push eventtensorflow/cloud

Yixing Fu

commit sha 2d6efb92cd8f161165124fc422bbc30203164cad

add example for tfc on colab

view details

yixingfu

commit sha 5cbef627b2508e6fa62ac1d174ee475ace59af66

add open in colab button

view details

Pavithra Vijay

commit sha 99890b34d1a78a358d7958fa596fbc5633db5484

Merge pull request #24 from yixingfu/master add colab-compatible example

view details

push time in a month

PR merged tensorflow/cloud

add colab-compatible example
+418 -0

2 comments

1 changed file

yixingfu

pr closed time in a month

more