Code Monkey home page Code Monkey logo

cchess-zero's Issues

不能动

系统是ubuntu18.04
以下是错误讯息:
(venv) kenny@wade-X750JB:~/Desktop/cchess-zero$ python main.py --mode play --ai_count 2 --ai_function mcts --play_playout 1200
Loading Models...
2018-08-29 15:55:02.524177: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
WARNING:tensorflow:From /home/kenny/Desktop/cchess-zero/policy_value_network.py:78: softmax_cross_entropy_with_logits (from tensorflow.python.ops.nn_ops) is deprecated and will be removed in a future version.
Instructions for updating:

Future major versions of TensorFlow will allow gradients to flow
into the labels input on backprop by default.

See @{tf.nn.softmax_cross_entropy_with_logits_v2}.

Traceback (most recent call last):
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1278, in _do_call
return fn(*args)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1263, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1350, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [1] rhs shape= [128]
[[Node: save/Assign_66 = Assign[T=DT_FLOAT, _class=["loc:@conv2d_16/bias"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](conv2d_16/bias, save/RestoreV2:66)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1725, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 877, in run
run_metadata_ptr)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1100, in _run
feed_dict_tensor, options, run_metadata)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1272, in _do_run
run_metadata)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1291, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match. lhs shape= [1] rhs shape= [128]
[[Node: save/Assign_66 = Assign[T=DT_FLOAT, _class=["loc:@conv2d_16/bias"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](conv2d_16/bias, save/RestoreV2:66)]]

Caused by op 'save/Assign_66', defined at:
File "main.py", line 1583, in
args.search_threads, args.processor, args.num_gpus, args.res_block_nums, args.human_color) # * args.num_gpus
File "/home/kenny/Desktop/cchess-zero/ChessGame.py", line 50, in init
processor=processor, num_gpus=num_gpus, res_block_nums=res_block_nums, human_color=human_color)
File "/home/kenny/Desktop/cchess-zero/main.py", line 1142, in init
self.policy_value_netowrk = policy_value_network(res_block_nums) if processor == 'cpu' else policy_value_network_gpus(num_gpus, res_block_nums)
File "/home/kenny/Desktop/cchess-zero/policy_value_network.py", line 148, in init
self.saver = tf.train.Saver()
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1281, in init
self.build()
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1293, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1330, in _build
build_save=build_save, build_restore=build_restore)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 778, in _build_internal
restore_sequentially, reshape)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 419, in _AddRestoreOps
assign_ops.append(saveable.restore(saveable_tensors, shapes))
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 112, in restore
self.op.get_shape().is_fully_defined())
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/ops/state_ops.py", line 216, in assign
validate_shape=validate_shape)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/ops/gen_state_ops.py", line 60, in assign
use_locking=use_locking, name=name)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 454, in new_func
return func(*args, **kwargs)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3155, in create_op
op_def=op_def)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1717, in init
self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Assign requires shapes of both tensors to match. lhs shape= [1] rhs shape= [128]
[[Node: save/Assign_66 = Assign[T=DT_FLOAT, _class=["loc:@conv2d_16/bias"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](conv2d_16/bias, save/RestoreV2:66)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 1583, in
args.search_threads, args.processor, args.num_gpus, args.res_block_nums, args.human_color) # * args.num_gpus
File "/home/kenny/Desktop/cchess-zero/ChessGame.py", line 50, in init
processor=processor, num_gpus=num_gpus, res_block_nums=res_block_nums, human_color=human_color)
File "/home/kenny/Desktop/cchess-zero/main.py", line 1142, in init
self.policy_value_netowrk = policy_value_network(res_block_nums) if processor == 'cpu' else policy_value_network_gpus(num_gpus, res_block_nums)
File "/home/kenny/Desktop/cchess-zero/policy_value_network.py", line 149, in init
self.train_restore()
File "/home/kenny/Desktop/cchess-zero/policy_value_network.py", line 170, in train_restore
self.saver.restore(self.sess, tf.train.latest_checkpoint(self.save_dir))
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1759, in restore
err, "a mismatch between the current graph and the graph")
tensorflow.python.framework.errors_impl.InvalidArgumentError: Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:

Assign requires shapes of both tensors to match. lhs shape= [1] rhs shape= [128]
[[Node: save/Assign_66 = Assign[T=DT_FLOAT, _class=["loc:@conv2d_16/bias"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](conv2d_16/bias, save/RestoreV2:66)]]

Caused by op 'save/Assign_66', defined at:
File "main.py", line 1583, in
args.search_threads, args.processor, args.num_gpus, args.res_block_nums, args.human_color) # * args.num_gpus
File "/home/kenny/Desktop/cchess-zero/ChessGame.py", line 50, in init
processor=processor, num_gpus=num_gpus, res_block_nums=res_block_nums, human_color=human_color)
File "/home/kenny/Desktop/cchess-zero/main.py", line 1142, in init
self.policy_value_netowrk = policy_value_network(res_block_nums) if processor == 'cpu' else policy_value_network_gpus(num_gpus, res_block_nums)
File "/home/kenny/Desktop/cchess-zero/policy_value_network.py", line 148, in init
self.saver = tf.train.Saver()
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1281, in init
self.build()
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1293, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1330, in _build
build_save=build_save, build_restore=build_restore)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 778, in _build_internal
restore_sequentially, reshape)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 419, in _AddRestoreOps
assign_ops.append(saveable.restore(saveable_tensors, shapes))
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 112, in restore
self.op.get_shape().is_fully_defined())
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/ops/state_ops.py", line 216, in assign
validate_shape=validate_shape)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/ops/gen_state_ops.py", line 60, in assign
use_locking=use_locking, name=name)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 454, in new_func
return func(*args, **kwargs)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3155, in create_op
op_def=op_def)
File "/home/kenny/tensorflow/venv/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1717, in init
self._traceback = tf_stack.extract_stack()

InvalidArgumentError (see above for traceback): Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:

Assign requires shapes of both tensors to match. lhs shape= [1] rhs shape= [128]
[[Node: save/Assign_66 = Assign[T=DT_FLOAT, _class=["loc:@conv2d_16/bias"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:CPU:0"](conv2d_16/bias, save/RestoreV2:66)]]

(venv) kenny@wade-X750JB:~/Desktop/cchess-zero$

马的走法判断似乎有点问题

很好的工作,正在学习代码,但是看到下面一个问题:

get_legal_moves这个函数,对马的走法判断似乎有问题,下面这些and感觉应该换成or(需要加上括号),不然马没法吃子,只能走到空白区域

image

帮助翻译成英文,以便机器学习的非中文爱好者阅读

Help translate into English for non-Chinese enthusiasts of machine learning to read

[X] - add README.en.md for English
[X] - translate cchess-zero.ipynb
[X] - translate Mastering_Chess_and_Shogi_by_Self-Play_with_a_General_Reinforcement_Learning_Algorithm.ipynb

I did not remove the Chinese text in case you want to merge. It is up to you if you want to merge but I will leave this here.
如果你想合并,我没有删除中文文本。如果你想合并取决于你,但我会把它留在这里。

一點小小疑問

在main.py的第371行:
if self.is_black_turn(current_player): action_probs=cchess_main.flip_policy(action_probs)
是什麼意思?為什麼要判斷是不是黑棋?

temperature

temperature其實就是讓AI在非訓練時選N最大的;訓練時依N的大小隨機選
那為什麼不直接在非訓練時用max()

你好,我restore您百度网盘的权重时报错

NotFoundError (see above for traceback): Key BatchNorm/moving_mean not found in checkpoint
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]

能标注一下tensorflow的版本吗??

Train问题

您好,我在train的时候,在get_action方法里,
actions, visits = zip(*actions_visits)
print(actions, visits)
probs = softmax(1.0 / temperature * np.log(visits)) # + 1e-10
这一步的visits会产生很多0,导致np.log计算时发生错误,这个应该怎么解决呢?

怎麼辦

kenny@wade-X750JB:~/Desktop/cchess-zero$ python2 main.py
File "main.py", line 261
def Q(self, move) -> float:
^
SyntaxError: invalid syntax

你好,可以请问一下TensorBoard的问题么

我用tensorflow1.0去运行tensorBoard ,可以进去,但是SCALARS什么的都是空的,只有EMBEDDINGD里面有东西,tensorflow新手,请问您那边代码可以正常现实tensorBoard么?感谢!

images

images的图片的副档名应该是小写的gif吧?

cpu和gpu用不满改哪里

我在我的5900x+rtx4090上跑起来了,可是cpu和gpu利用率都很低。如何增加cpu并发核心数量以及gpu利用率,加快下棋速度。
我的是ubuntu22.04版本。

绘图时出错

运行下棋指令时,报错:_tkinter.TclError: no display name and no $DISPLAY environment variable
请问您有遇到过吗?

little problem

您好,感谢您的分享现在想问您关于ma.py的程序中
if (x if abs(dx) ==1 else x+dx/2, y if abs(dy) ==1 else y+ (dy/2)) in board.pieces:
#print 'blocked'
return False
这块是什么意思呢

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.