Zeta36 / chess-alpha-zero

Chess reinforcement learning by AlphaGo Zero methods.
MIT License
2.13k stars 481 forks source link

Module 'keras.backend' has no attribute 'observe_object_name' #105

Closed nikhileshp closed 3 years ago

nikhileshp commented 3 years ago

Error while running run.py --cmd self

Using TensorFlow backend.
2021-04-14 13:18:34,299@chess_zero.agent.model_chess DEBUG # loading model from C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\data\model\model_best_config.json
Traceback (most recent call last):
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\src\chess_zero\run.py", line 20, in <module>
    manager.start()
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\src\chess_zero\manager.py", line 64, in start
    return self_play.start(config)
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\src\chess_zero\worker\self_play.py", line 25, in start
    return SelfPlayWorker(config).start()
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\src\chess_zero\worker\self_play.py", line 45, in __init__
    self.current_model = self.load_model()
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\src\chess_zero\worker\self_play.py", line 85, in load_model
    if self.config.opts.new or not load_best_model_weight(model):
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\src\chess_zero\lib\model_helper.py", line 15, in load_best_model_weight
    return model.load(model.config.resource.model_best_config_path, model.config.resource.model_best_weight_path)
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\src\chess_zero\agent\model_chess.py", line 145, in load
    self.model = Model.from_config(json.load(f))
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\venv\lib\site-packages\keras\engine\training.py", line 2332, in from_config
    functional.reconstruct_from_config(config, custom_objects))
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\venv\lib\site-packages\keras\engine\functional.py", line 1274, in reconstruct_from_config
    process_layer(layer_data)
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\venv\lib\site-packages\keras\engine\functional.py", line 1256, in process_layer
    layer = deserialize_layer(layer_data, custom_objects=custom_objects)
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\venv\lib\site-packages\keras\layers\serialization.py", line 159, in deserialize
    return generic_utils.deserialize_keras_object(
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\venv\lib\site-packages\keras\utils\generic_utils.py", line 675, in deserialize_keras_object
    deserialized_obj = cls.from_config(cls_config)
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\venv\lib\site-packages\keras\engine\base_layer.py", line 716, in from_config
    return cls(**config)
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\venv\lib\site-packages\keras\engine\input_layer.py", line 152, in __init__
    super(InputLayer, self).__init__(dtype=dtype, name=name)
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\venv\lib\site-packages\tensorflow\python\training\tracking\base.py", line 522, in _method_wrapper
    result = method(self, *args, **kwargs)
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\venv\lib\site-packages\keras\engine\base_layer.py", line 350, in __init__
    self._init_set_name(name)
  File "C:\UTD\Sem 2\Machine Learning\chess-alpha-zero-master\venv\lib\site-packages\keras\engine\base_layer.py", line 2372, in _init_set_name
    backend.observe_object_name(name)
AttributeError: module 'keras.backend' has no attribute 'observe_object_name'
nikhileshp commented 3 years ago

pip list

Package                  Version
------------------------ -------------------
absl-py                  0.12.0
astunparse               1.6.3
cachetools               4.2.1
certifi                  2020.12.5
chardet                  4.0.0
flatbuffers              1.12
gast                     0.4.0
google-api-core          1.26.3
google-api-python-client 1.8.0
google-auth              1.28.1
google-auth-httplib2     0.1.0
google-auth-oauthlib     0.4.4
google-pasta             0.2.0
googleapis-common-protos 1.53.0
grpcio                   1.34.1
h5py                     3.1.0
httplib2                 0.19.1
idna                     2.10
Keras                    2.0.8
keras-nightly            2.5.0.dev2021032900
Keras-Preprocessing      1.1.2
Markdown                 3.3.4
numpy                    1.19.5
oauth2client             4.1.3
oauthlib                 3.1.0
opt-einsum               3.3.0
packaging                20.9
pip                      21.0.1
profilehooks             1.12.0
protobuf                 3.15.8
pyasn1                   0.4.8
pyasn1-modules           0.2.8
pyparsing                2.4.7
pyperclip                1.8.2
python-chess             0.25.1
pytz                     2021.1
PyYAML                   5.4.1
requests                 2.25.1
requests-oauthlib        1.3.0
rsa                      4.7.2
scipy                    1.6.2
setuptools               56.0.0
six                      1.15.0
tensorboard              2.4.1
tensorboard-plugin-wit   1.8.0
tensorflow-estimator     2.5.0rc0
tensorflow-gpu           2.5.0rc1
termcolor                1.1.0
typing-extensions        3.7.4.3
uritemplate              3.0.1
urllib3                  1.26.4
Werkzeug                 1.0.1
wheel                    0.36.2
wrapt                    1.12.1
nikhileshp commented 3 years ago

Problem solved after downgrading from Python 3.8 to Python 3.7 and installing tensorflow-gpu==1.15