Comments (7)
I run model.fit()
without TFF, it is OK in GPU Training.
And I also run the mnist example in tf-gpu:
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
from tensorflow.python import layers
from tensorflow.python import nn
mnist = input_data.read_data_sets("./MNIST_data/", one_hot=True)
sess = tf.InteractiveSession()
x = tf.placeholder(tf.float32, [None, 784])
y_ = tf.placeholder(tf.float32, [None, 10])
x_image = tf.reshape(x, [-1, 28, 28, 1])
conv1 = layers.conv2d(x_image, 32, 5, padding='same', name='conv1')
relu1 = nn.relu(conv1, name='relu1')
maxppool1 = layers.max_pooling2d(relu1, 2, 2, name='maxpool1')
conv2 = layers.conv2d(maxppool1, 64, 5, padding='same', name='conv2')
relu2 = nn.relu(conv2, name='relu2')
maxppool2 = layers.max_pooling2d(relu2, 2, 2, name='maxpool2')
flattern = layers.flatten(maxppool2, name='flattern')
fc1 = layers.dense(flattern, 1024, activation=tf.nn.relu, name='fc1')
fc1_dropout = layers.dropout(fc1, 0.8, name='fc1_dropout')
fc2 = layers.dense(fc1_dropout, 10, activation=tf.nn.softmax, name='fc2')
cross_entropy = tf.reduce_mean(-tf.reduce_sum(y_ * tf.log(fc2), reduction_indices=[1]))
train_step = tf.train.AdamOptimizer(1e-4).minimize(cross_entropy)
correct_prediciton = tf.equal(tf.argmax(fc2, 1), tf.argmax(y_, 1))
accuracy = tf.reduce_mean(tf.cast(correct_prediciton, tf.float32))
tf.global_variables_initializer().run()
for i in range(1, 10001):
batch = mnist.train.next_batch(64)
if i % 10 == 0:
train_accuracy = accuracy.eval(feed_dict={x: batch[0], y_: batch[1]})
print("step %d, examples %d, training accuracy %g" % (i, i * 64, train_accuracy))
print("test accuracy %g" % accuracy.eval(feed_dict={x: mnist.test.images, y_: mnist.test.labels}))
train_step.run(feed_dict={x: batch[0], y_: batch[1]})
print("test accuracy %g" % accuracy.eval(feed_dict={x: mnist.test.images, y_: mnist.test.labels}))
It also work.
@ZacharyGarrett
from federated.
Hello!
I am experiencing the same issue with version 0.7.0 and tf-nightly-gpu (gpu)
And it works just fine with tf-nightly (cpu)
@ZacharyGarrett if we use model.fit instead of tff.learning, is that a workaround for now?
Or do we have to wait for some sort of fix here?
from federated.
Could you try training the Keras model without an TFF and see if the same error is raised? i.e. call model.fit()
without using any of the tff.learning
modules.
from federated.
I installed with version 0.8.0 and am able to run codes with GPU.
from federated.
I tried it with 0.8.0 and I am still getting this error.
@jiachangliu is your code open source? Can you point me to it?
My code is open source [1]. Run federated.py.
from federated.
@anupamme I'm actually just running the image classification tutorial from federated learning. https://www.tensorflow.org/federated/tutorials/federated_learning_for_image_classification
from federated.
Training on GPU with the local executor stack. That is, calling tff.framework.set_default_executor(tff.framework.create_local_executor())
before execution, should allow you to utilize the GPU.
In particular, if you run the image classification colab with a GPU-backed cloud-hosted runtime, you will see a roughly 2X speedup compared with the CPU-backed runtime.
We've seen local training working with our recent versions as well, utilizing GPU resources; closing this issue.
from federated.
Related Issues (20)
- What is the refactored name of `federated_output_computation`? HOT 5
- details = "`TensorFlowExecutor::CreateValue` can only create values for TensorFlow computations and intrinsics. Found computation of type 4" HOT 4
- Implemented simulation tff code to be distribute from server to clients. HOT 2
- LearningProcess Compatibility Error HOT 2
- An error went when I ran pip install --upgrade tensorflow-federated HOT 2
- AttributeError: module 'tensorflow._api.v2.nest' has no attribute 'map_struture' HOT 1
- Documentation Issue - build_fed_kmeans HOT 1
- Error installing Tensorflow Federated with Python 3.9 HOT 4
- OperatorNotAllowedInGraphError Traceback (most recent call last)
- TFF using model resnet,the val accuracy has always been a result of random guessing
- AttributeError: module 'numpy' has no attribute '_no_nep50_warning' when importing TensorFlow Federated HOT 6
- Installation failed HOT 10
- Facing error in "Learning Attribute" Please Help. HOT 2
- tff.federated_computation(lambda: 'Hello World!')() stuck/hanging HOT 6
- Stuck at learning_process.initialize() and tff.federated_computation(lambda: 'Hello, World!')() HOT 1
- Security policy for tensorflow federated?
- Colab stuck at learning_process.initialize() HOT 14
- Exploding memory while training federated model on FLAIR Dataset HOT 3
- No GPU utilization when using the cpp execution context HOT 1
- perform cross-silo federated learning by TFF HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from federated.