Week 3 Lab Assignment


I was working on Graded assignment for week 3 on “Distributed Multi-worker TensorFlow Training on Kubernetes”

At step Task 4. Preparing TFJob, while using tf.distribute.experimental.MultiWorkerMirrorStrategy() object to retrieve information about the topology of the distributed cluster running a job, I am receiving below strange error. Can instructors, please look into it and advise how to fix it.

<< code snippet>>
global_batch_size=per_worker_batch * strategy.num_replicas_in_sync
<< end>>

Fetched 1 package(s).
student_01_a0b8b3901f69@cloudshell:~/lab-files (qwiklabs-gcp-00-024616e00ebb)$ strategy = tf.distribute.experimental.MultiWorkerMirroredStrategy()
task_type = strategy.cluster_resolver.task_type
task_id = strategy.cluster_resolver.task_id
global_batch_size = per_worker_batch * strategy.num_replicas_in_sync
-bash: syntax error near unexpected token `(’
-bash: task_type: command not found
-bash: task_id: command not found
-bash: global_batch_size: command not found
<< end>>

I referred to the tensorflow tutorial as well, tf.distribute.experimental.MultiWorkerMirroredStrategy  |  TensorFlow Core v2.9.1
but couldn’t understand the error message.


HI Manoj! Welcome to the community! That section is just describing what is written in main.py. That python script is run in the image when you deploy them later. Thus, you don’t have to run it in the terminal. Hope this clarifies it!