question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests failing: AttributeError: 'TrainingParameters' object has no attribute 'thrift_spec'

See original GitHub issue

Hey there, after a fresh install and running the tests I’m getting plenty of ‘TrainingParameters’ object has no attribute ‘thrift_spec’ errors.

I installed thrift via brew with no problems, I also get no errors when importing thrift in python on it’s own. I’m not too sure sure how to continue here, any pointers on what to try?

Also ‘fblib’ is missing and I’m not quite sure how to obtain it, is it internal to FB?

Adding the errors after running the tests:

WARNING:root:This caffe2 python run does not have GPU support. Will run in CPU only mode.
WARNING:root:Debug message: No module named 'caffe2.python.caffe2_pybind11_state_gpu'
Ignoring @/caffe2/caffe2/fb/operators:replace_values_op as it is not a valid file.
EEEEEEEE.EE.
======================================================================
ERROR: ml.rl.test.gridworld.test_continuous_action_dqn_trainer (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: ml.rl.test.gridworld.test_continuous_action_dqn_trainer
Traceback (most recent call last):
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/test/gridworld/test_continuous_action_dqn_trainer.py", line 16, in <module>
    from ml.rl.thrift.core.ttypes import \
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/thrift/core/ttypes.py", line 394, in <module>
    class DiscreteActionModelParameters(object):
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/thrift/core/ttypes.py", line 405, in DiscreteActionModelParameters
    }), training=TrainingParameters(**{
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/thrift/core/ttypes.py", line 148, in __init__
    if layers is self.thrift_spec[4][4]:
AttributeError: 'TrainingParameters' object has no attribute 'thrift_spec'


======================================================================
ERROR: ml.rl.test.gridworld.test_gridworld (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: ml.rl.test.gridworld.test_gridworld
Traceback (most recent call last):
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/test/gridworld/test_gridworld.py", line 10, in <module>
    from libfb.py.testutil import data_provider
ModuleNotFoundError: No module named 'libfb'


======================================================================
ERROR: ml.rl.test.gridworld.test_gridworld_continuous (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: ml.rl.test.gridworld.test_gridworld_continuous
Traceback (most recent call last):
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/test/gridworld/test_gridworld_continuous.py", line 17, in <module>
    from libfb.py.testutil import data_provider
ModuleNotFoundError: No module named 'libfb'


======================================================================
ERROR: ml.rl.test.gridworld.test_limited_action_gridworld (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: ml.rl.test.gridworld.test_limited_action_gridworld
Traceback (most recent call last):
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/test/gridworld/test_limited_action_gridworld.py", line 14, in <module>
    from ml.rl.training.discrete_action_trainer import DiscreteActionTrainer
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/training/discrete_action_trainer.py", line 18, in <module>
    from ml.rl.thrift.core.ttypes import DiscreteActionModelParameters
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/thrift/core/ttypes.py", line 394, in <module>
    class DiscreteActionModelParameters(object):
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/thrift/core/ttypes.py", line 405, in DiscreteActionModelParameters
    }), training=TrainingParameters(**{
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/thrift/core/ttypes.py", line 148, in __init__
    if layers is self.thrift_spec[4][4]:
AttributeError: 'TrainingParameters' object has no attribute 'thrift_spec'


======================================================================
ERROR: ml.rl.test.gym.test_open_ai_gym (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: ml.rl.test.gym.test_open_ai_gym
Traceback (most recent call last):
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/test/gym/test_open_ai_gym.py", line 9, in <module>
    from libfb import parutil  # type: ignore
ModuleNotFoundError: No module named 'libfb'


======================================================================
ERROR: ml.rl.test.test_ml_trainer (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: ml.rl.test.test_ml_trainer
Traceback (most recent call last):
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
    module = self._get_module_from_name(name)
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
    __import__(name)
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/test/test_ml_trainer.py", line 14, in <module>
    from ml.rl.training.ml_trainer import MLTrainer
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/training/ml_trainer.py", line 22, in <module>
    from ml.rl.thrift.core.ttypes import TrainingParameters
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/thrift/core/ttypes.py", line 394, in <module>
    class DiscreteActionModelParameters(object):
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/thrift/core/ttypes.py", line 405, in DiscreteActionModelParameters
    }), training=TrainingParameters(**{
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/thrift/core/ttypes.py", line 148, in __init__
    if layers is self.thrift_spec[4][4]:
AttributeError: 'TrainingParameters' object has no attribute 'thrift_spec'


======================================================================
ERROR: test_normalize_dense_matrix_enum (ml.rl.test.test_normalization.TestNormalization)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/test/test_normalization.py", line 201, in test_normalize_dense_matrix_enum
    False
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/preprocessing/preprocessor_net.py", line 374, in prepare_normalization
    reshaped_input_blob, normalization_param
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/preprocessing/preprocessor_net.py", line 120, in preprocess_blob
    self._net.ReplaceValuesOp(
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/site-packages/caffe2/python/core.py", line 2040, in __getattr__
    ",".join(workspace.C.nearby_opnames(op_type)) + ']'
AttributeError: Method ReplaceValuesOp is not a registered operator. Did you mean: []

======================================================================
ERROR: test_normalize_feature_map_enum (ml.rl.test.test_normalization.TestNormalization)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/test/test_normalization.py", line 151, in test_normalize_feature_map_enum
    False
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/preprocessing/preprocessor_net.py", line 374, in prepare_normalization
    reshaped_input_blob, normalization_param
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/preprocessing/preprocessor_net.py", line 120, in preprocess_blob
    self._net.ReplaceValuesOp(
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/site-packages/caffe2/python/core.py", line 2040, in __getattr__
    ",".join(workspace.C.nearby_opnames(op_type)) + ']'
AttributeError: Method ReplaceValuesOp is not a registered operator. Did you mean: []

======================================================================
ERROR: test_prepare_normalization_and_normalize (ml.rl.test.test_normalization.TestNormalization)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/test/test_normalization.py", line 47, in test_prepare_normalization_and_normalize
    False
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/preprocessing/preprocessor_net.py", line 374, in prepare_normalization
    reshaped_input_blob, normalization_param
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/preprocessing/preprocessor_net.py", line 120, in preprocess_blob
    self._net.ReplaceValuesOp(
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/site-packages/caffe2/python/core.py", line 2040, in __getattr__
    ",".join(workspace.C.nearby_opnames(op_type)) + ']'
AttributeError: Method ReplaceValuesOp is not a registered operator. Did you mean: []

======================================================================
ERROR: test_preprocessing_network (ml.rl.test.test_normalization.TestNormalization)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/test/test_normalization.py", line 301, in test_preprocessing_network
    feature_name, normalization_parameters[feature_name]
  File "/Users/miquelllobet/Code/BlueWhale/ml/rl/preprocessing/preprocessor_net.py", line 120, in preprocess_blob
    self._net.ReplaceValuesOp(
  File "/Users/miquelllobet/anaconda/envs/gym/lib/python3.6/site-packages/caffe2/python/core.py", line 2040, in __getattr__
    ",".join(workspace.C.nearby_opnames(op_type)) + ']'
AttributeError: Method ReplaceValuesOp is not a registered operator. Did you mean: []

----------------------------------------------------------------------
Ran 12 tests in 0.293s

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
MisterTeacommented, Jan 29, 2018

Thanks! Looking into it and should have a fix soon.

0reactions
MisterTeacommented, Apr 17, 2018

Actually the issue was that our thrift was malformed. Fixed with https://github.com/facebookresearch/BlueWhale/commit/fd7c1399b83f10b8069a11d5cfbf97e33619dfe9

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tests failing: AttributeError: 'TrainingParameters' object has no ...
Hey there, after a fresh install and running the tests I'm getting plenty of 'TrainingParameters' object has no attribute 'thrift_spec' ...
Read more >
AttributeError: 'module' object has no attribute 'tests'
I finally figured it out working on another problem. The problem was that my test couldn't find an import. It looks like you...
Read more >
Python AttributeError: 'tuple' object has no attribute
AttributeError : 'tuple' object has no attribute. Learn Data Science with. This error occurs when attempting to access the values of a tuple...
Read more >
unittest — Unit testing framework — Python 3.11.1 ...
If the test fails, an exception will be raised with an explanatory ... This decorator skips the test unless the passed object has...
Read more >
How do I resolve "ERROR Failed to write data to transport with ...
Articles How do I resolve "ERROR Failed to write data to transport with 'NoneType' object has no attribute 'write'" when using the Duo...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found