NTMC-Community / MatchZoo

Facilitating the design, comparison and sharing of deep text matching models.
Apache License 2.0
3.82k stars 898 forks source link

AttributeError: module 'bson' has no attribute 'BSON' #798

Open aszhanghuali opened 4 years ago

aszhanghuali commented 4 years ago

CANT ENCODE


AttributeError Traceback (most recent call last)

in 5 num_runs=10 6 ) ----> 7 results = tuner.tune() ~/anaconda3/envs/tensorflow/lib/python3.6/site-packages/matchzoo/auto/tuner/tuner.py in tune(self) 131 trials = hyperopt.Trials() 132 --> 133 self._fmin(trials) 134 135 return { ~/anaconda3/envs/tensorflow/lib/python3.6/site-packages/matchzoo/auto/tuner/tuner.py in _fmin(self, trials) 151 hyperopt.fmin( 152 **fmin_kwargs, --> 153 show_progressbar=False 154 ) 155 except TypeError: ~/anaconda3/envs/tensorflow/lib/python3.6/site-packages/hyperopt/fmin.py in fmin(fn, space, algo, max_evals, trials, rstate, allow_trials_fmin, pass_expr_memo_ctrl, catch_eval_exceptions, verbose, return_argmin, points_to_evaluate, max_queue_len, show_progressbar) 401 catch_eval_exceptions=catch_eval_exceptions, 402 return_argmin=return_argmin, --> 403 show_progressbar=show_progressbar, 404 ) 405 ~/anaconda3/envs/tensorflow/lib/python3.6/site-packages/hyperopt/base.py in fmin(self, fn, space, algo, max_evals, max_queue_len, rstate, verbose, pass_expr_memo_ctrl, catch_eval_exceptions, return_argmin, show_progressbar) 649 catch_eval_exceptions=catch_eval_exceptions, 650 return_argmin=return_argmin, --> 651 show_progressbar=show_progressbar) 652 653 ~/anaconda3/envs/tensorflow/lib/python3.6/site-packages/hyperopt/fmin.py in fmin(fn, space, algo, max_evals, trials, rstate, allow_trials_fmin, pass_expr_memo_ctrl, catch_eval_exceptions, verbose, return_argmin, points_to_evaluate, max_queue_len, show_progressbar) 420 show_progressbar=show_progressbar) 421 rval.catch_eval_exceptions = catch_eval_exceptions --> 422 rval.exhaust() 423 if return_argmin: 424 if len(trials.trials) == 0: ~/anaconda3/envs/tensorflow/lib/python3.6/site-packages/hyperopt/fmin.py in exhaust(self) 274 def exhaust(self): 275 n_done = len(self.trials) --> 276 self.run(self.max_evals - n_done, block_until_done=self.asynchronous) 277 self.trials.refresh() 278 return self ~/anaconda3/envs/tensorflow/lib/python3.6/site-packages/hyperopt/fmin.py in run(self, N, block_until_done) 223 assert len(new_ids) >= len(new_trials) 224 if len(new_trials): --> 225 self.trials.insert_trial_docs(new_trials) 226 self.trials.refresh() 227 n_queued += len(new_trials) ~/anaconda3/envs/tensorflow/lib/python3.6/site-packages/hyperopt/base.py in insert_trial_docs(self, docs) 433 """ 434 docs = [self.assert_valid_trial(SONify(doc)) --> 435 for doc in docs] 436 return self._insert_trial_docs(docs) 437 ~/anaconda3/envs/tensorflow/lib/python3.6/site-packages/hyperopt/base.py in (.0) 433 """ 434 docs = [self.assert_valid_trial(SONify(doc)) --> 435 for doc in docs] 436 return self._insert_trial_docs(docs) 437 ~/anaconda3/envs/tensorflow/lib/python3.6/site-packages/hyperopt/base.py in assert_valid_trial(self, trial) 397 if have_bson: 398 try: --> 399 bson.BSON.encode(trial) 400 except: 401 # TODO: save the trial object somewhere to inspect, fix, re-insert AttributeError: module 'bson' has no attribute 'BSON' Looking forword for your reply!
bwanglzu commented 4 years ago

A knowkn issue caused by hyperopt

Try to install the latest hyperopt directly from master branch:

pip install git+https://github.com/hyperopt/hyperopt.git@master
aszhanghuali commented 4 years ago

@bwanglzu Sorry, I tried your method, but the same problem.

matthew-z commented 4 years ago

run pip uninstall hyperopt before pip install git+https://github.com/hyperopt/hyperopt.git@master