fedlearner icon indicating copy to clipboard operation
fedlearner copied to clipboard

python leader.py error

Open peniridis opened this issue 6 years ago • 6 comments

fix the error

AttributeError: 'tuple' object has no attribute 'make_one_shot_iterator'

code

    def _get_features_and_labels_from_input_fn(self, input_fn, mode):
        return input_fn(self._bridge, self._trainer_master)

ERROR 1

python leader.py --local-addr=192.168.208.62:50051 --peer-addr=192.168.208.62:50052 --data-path=data/leader

WARNING:root:Bridge failed to connect: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNAVAILABLE
        details = "failed to connect to all addresses"
        debug_error_string = "{"created":"@1604474548.697105063","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":4165,"referenced_errors":[{"created":"@1604474491.601303236","description":"failed to connect to all addresses","file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc","file_line":397,"grpc_status":14}]}"
>. Retry in 1 second...

ERROR 2

python3.6 leader.py --local-addr=localhost:50051 --peer-addr=localhost:50052 --data-path=data/leader --sparse-estimator=True

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/__init__.py:80: RequestsDependencyWarning: urllib3 (1.25.11) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)
Failed to load fedlearner operators from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fedlearner-0.1-py3.6.egg/cc/embedding.so
Traceback (most recent call last):
  File "leader.py", line 113, in <module>
    model_fn, serving_input_receiver_fn)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fedlearner-0.1-py3.6.egg/fedlearner/trainer/trainer_worker.py", line 244, in train
    save_checkpoint_secs=args.save_checkpoint_secs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fedlearner-0.1-py3.6.egg/fedlearner/trainer/estimator.py", line 287, in train
    input_fn, ModeKeys.TRAIN)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fedlearner-0.1-py3.6.egg/fedlearner/trainer/sparse_estimator.py", line 235, in _get_features_and_labels_from_input_fn
    slot_configs = self._set_model_configs(mode) # features, labels, mode)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fedlearner-0.1-py3.6.egg/fedlearner/trainer/sparse_estimator.py", line 223, in _set_model_configs
    self._model_fn(M, None, None, mode) # features, labels, mode)
  File "leader.py", line 51, in model_fn
    x = features['x']
TypeError: 'NoneType' object is not subscriptable

env

python3.6 -V
Python 3.6.6

protoc --version
libprotoc 3.6.1

peniridis avatar Nov 04 '20 07:11 peniridis

I got the same issue.

skyhit avatar Nov 04 '20 09:11 skyhit

same problem encountered What protobuf & protoc version you are using now?

KleinXin avatar Nov 13 '20 07:11 KleinXin

@peniridis Looks like an estimator model according to your error, set flag --sparse-estimator to True.

duanbing avatar Nov 14 '20 07:11 duanbing

@peniridis Looks like an estimator model according to your error, set flag --sparse-estimator to True.

After setting --sparse-estimator=True, another error is reported.

root@a9b116f693ef:/work/Algorithms/FederatedLearning/fedlearner/example/mnist# Failed to load fedlearner operators from /work/Algorithms/FederatedLearning/fedlearner/cc/embedding.so Traceback (most recent call last): File "leader.py", line 116, in <module> model_fn, serving_input_receiver_fn) File "/work/Algorithms/FederatedLearning/fedlearner/fedlearner/trainer/trainer_worker.py", line 244, in train save_checkpoint_secs=args.save_checkpoint_secs) File "/work/Algorithms/FederatedLearning/fedlearner/fedlearner/trainer/estimator.py", line 291, in train input_fn, ModeKeys.TRAIN) File "/work/Algorithms/FederatedLearning/fedlearner/fedlearner/trainer/sparse_estimator.py", line 235, in _get_features_and_labels_from_input_fn slot_configs = self._set_model_configs(mode) # features, labels, mode) File "/work/Algorithms/FederatedLearning/fedlearner/fedlearner/trainer/sparse_estimator.py", line 223, in _set_model_configs self._model_fn(M, None, None, mode) # features, labels, mode) File "leader.py", line 53, in model_fn x = features['x'] TypeError: 'NoneType' object is not subscriptable

KleinXin avatar Nov 16 '20 01:11 KleinXin

Plz refer to here https://github.com/bytedance/fedlearner/blob/master/test/trainer/test_nn_trainer.py#L441 for more details or https://github.com/bytedance/fedlearner/blob/master/example/sparse_model/test.sh to run all in one

duanbing avatar Nov 16 '20 02:11 duanbing

example old, see #422

errord avatar Nov 19 '20 10:11 errord