Hi everyone!
I am trying to use the demo script provided on the tensorflow federated page:
but keep running into errors:
OSError Traceback (most recent call last)
Cell In[1], line 30
26 # Simulate a few rounds of training with the selected client devices.
27 trainer = tff.learning.algorithms.build_weighted_fed_avg(
28 model_fn,
29 client_optimizer_fn=lambda: tf.keras.optimizers.SGD(0.1))
—> 30 state = trainer.initialize()
31 for _ in range(5):
32 result = trainer.next(state, train_data)
File /opt/anaconda3/envs/federated_env/lib/python3.10/site-packages/tensorflow_federated/python/core/impl/computation/computation_impl.py:135, in ConcreteComputation.call(self, *args, **kwargs)
133 def call(self, *args, **kwargs):
134 arg = function_utils.pack_args(self._type_signature.parameter, args, kwargs)
→ 135 return self._context_stack.current.invoke(self, arg)
File /opt/anaconda3/envs/federated_env/lib/python3.10/site-packages/tensorflow_federated/python/core/impl/execution_contexts/sync_execution_context.py:67, in ExecutionContext.invoke(self, comp, arg)
66 def invoke(self, comp, arg):
—> 67 return self._async_runner.run_coro_and_return_result(
68 self._async_context.invoke(comp, arg))
File /opt/anaconda3/envs/federated_env/lib/python3.10/site-packages/tensorflow_federated/python/common_libs/async_utils.py:223, in AsyncThreadRunner.run_coro_and_return_result(self, coro)
221 “”“Runs coroutine in the managed event loop, returning the result.”“”
222 future = asyncio.run_coroutine_threadsafe(coro, self._event_loop)
→ 223 return future.result()
…
1846 err_msg = os.strerror(errno_num)
→ 1847 raise child_exception_type(errno_num, err_msg, err_filename)
1848 raise child_exception_type(err_msg)
OSError: [Errno 8] Exec format error: ‘/opt/anaconda3/envs/federated_env/lib/python3.10/site-packages/tensorflow_federated/python/core/backends/native/…/…/…/…/data/worker_binary’
I have also tried using tensorflow_federated on google colab but after installing it I run into the following error:
TypeError Traceback (most recent call last)
in
----> 1 import tensorflow_federated
14 frames
/usr/lib/python3.8/typing.py in _type_check(arg, msg, is_argument)
147 return arg
148 if not callable(arg):
→ 149 raise TypeError(f"{msg} Got {arg!r:.100}.")
150 return arg
151
TypeError: Callable[[arg, …], result]: each arg must be a type. Got Ellipsis.
I have also tried building the library from source following these steps:
but this is still impossible.
Any ideas on what might be wrong?