Giter Site home page Giter Site logo

yichen914 / myalphagozeroonconnect4 Goto Github PK

View Code? Open in Web Editor NEW
18.0 2.0 4.0 4.5 MB

My Simple Implementation of AlphaGo Zero on Connect4

Python 100.00%
neural-network residual-networks monte-carlo-tree-search alphago-zero connect4-game reinforcement-learning tensorflow keras

myalphagozeroonconnect4's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

myalphagozeroonconnect4's Issues

Trying to run monte_carlo_tree.py results in an error.

Thanks for publishing your experiments, tried to run the monte_carlo_tree program but the name is missing in the current master:

> python monte_carlo_tree.py
Using TensorFlow backend.
Traceback (most recent call last):
  File "monte_carlo_tree.py", line 174, in <module>
    root_path=None)
TypeError: __init__() missing 1 required positional argument: 'name'

Question about MCTS

First, great implementation, this really helped me understand how AlphaGo Zero works, and I’ve used it for other games as well.
There’s is still one thing I couldn’t understand though. Why do you return -v instead of v when you do the Monte Carlo tree search?

Error running training_multithreads.py

Same error is given regardless of the response Y or N

>python training_multithreads.py
Using TensorFlow backend.
Would you like to train the network before test it (answer Y or N): N
2018-12-05 09:24:45.572326: I C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2018-12-05 09:24:45.816212: I C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:1105] Found device 0 with properties:
name: GeForce GTX 1080 Ti major: 6 minor: 1 memoryClockRate(GHz): 1.582
pciBusID: 0000:01:00.0
totalMemory: 11.00GiB freeMemory: 9.09GiB
2018-12-05 09:24:45.825529: I C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:1195] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1)
Traceback (most recent call last):
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 686, in _call_cpp_shape_fn_impl
    input_tensors_as_shapes, status)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 473, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape must be rank 1 but is rank 0 for 'batch_normalization_1/cond/Reshape_4' (op: 'Reshape') with input shapes: [1,7,1,1], [].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "training_multithreads.py", line 328, in <module>
    best_network = Network('Best')
  File "C:\Users\Agustin\Documents\MyAlphaGoZeroOnConnect4\src\Connect4\network.py", line 31, in __init__
    self.model = self._build_model()
  File "C:\Users\Agustin\Documents\MyAlphaGoZeroOnConnect4\src\Connect4\network.py", line 87, in _build_model
    kernel_size=self.layers_metadata[0]['kernel_size'])
  File "C:\Users\Agustin\Documents\MyAlphaGoZeroOnConnect4\src\Connect4\network.py", line 43, in _add_conv_block
    block = BatchNormalization(axis=1)(block)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\keras\engine\base_layer.py", line 457, in __call__
    output = self.call(inputs, **kwargs)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\keras\layers\normalization.py", line 206, in call
    training=training)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\keras\backend\tensorflow_backend.py", line 3123, in in_train_phase
    x = switch(training, x, alt)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\keras\backend\tensorflow_backend.py", line 3058, in switch
    else_expression_fn)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\util\deprecation.py", line 316, in new_func
    return func(*args, **kwargs)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 1903, in cond
    orig_res_f, res_f = context_f.BuildCondBranch(false_fn)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 1752, in BuildCondBranch
    original_result = fn()
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\keras\layers\normalization.py", line 167, in normalize_inference
    epsilon=self.epsilon)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\keras\backend\tensorflow_backend.py", line 1908, in batch_normalization
    mean = tf.reshape(mean, (-1))
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\ops\gen_array_ops.py", line 5184, in reshape
    "Reshape", tensor=tensor, shape=shape, name=name)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 3162, in create_op
    compute_device=compute_device)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 3208, in _create_op_helper
    set_shapes_for_outputs(op)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 2427, in set_shapes_for_outputs
    return _set_shapes_for_outputs(op)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 2400, in _set_shapes_for_outputs
    shapes = shape_func(op)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\ops.py", line 2330, in call_with_requiring
    return call_cpp_shape_fn(op, require_shape_fn=True)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 627, in call_cpp_shape_fn
    require_shape_fn)
  File "C:\Users\Agustin\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 691, in _call_cpp_shape_fn_impl
    raise ValueError(err.message)
ValueError: Shape must be rank 1 but is rank 0 for 'batch_normalization_1/cond/Reshape_4' (op: 'Reshape') with input shapes: [1,7,1,1], [].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.