lazydroid/deep-murasaki

TypeError: __init__() takes exactly 2 arguments (1 given) in train.py

Closed this issue · 6 comments

FF27 commented

Hi
pgn_splitter.py
parse_game.py
check_data.py

are working , creating *.hdf5 files inside the program dir (6 present in total)
when i start train.py , here is the output

Using TensorFlow backend. Traceback (most recent call last): File "train.py", line 172, in <module> train() File "train.py", line 141, in train model = make_model() File "train.py", line 110, in make_model model.add(Reshape( dims = (1, 8, 8), input_shape = (64,))) TypeError: __init__() takes exactly 2 arguments (1 given)

why?

The original version of the program was supposed to be run using Theano. Please, try changing .keras/keras.json to check if it works with Theano or not. If it does, you might need to reorder the data in the dataset (TF uses the opposite order from Theano), something along the lines of this (in parse_game.py):

with open(os.path.expanduser('~/.keras/keras.json')) as fin :
	keras_config = json.load(fin)

# 'th' (channels, width, height) or 'tf' (width, height, channels)
DIM_ORDERING = 'tf' if keras_config['backend'] == 'tensorflow' else 'th'

and then later:

	if DIM_ORDERING == 'th' :
		im = im.transpose((2,0,1))	# for theano
FF27 commented

Hi

i've changed the .keras/keras.json in

{ "image_dim_ordering": "th", "epsilon": 1e-07, "floatx": "float32", "backend": "theano" }

without touching parse_game.py using train.py ,same output :

Using Theano backend.
Traceback (most recent call last):
  File "train.py", line 172, in <module>
    train()
  File "train.py", line 141, in train
    model = make_model()
  File "train.py", line 110, in make_model
    model.add(Reshape( dims = (1, 8, 8), input_shape = (64,)))
TypeError: __init__() takes exactly 2 arguments (1 given)

Please, use a bit different parameters style for Reshape() layer (I don't know when or why has this changed):

model.add(Reshape( (1, 8, 8), input_shape = (64,)))

If it works, you may try to experiment reverting backed back to TF =)

FF27 commented

Hi
the problem was indeed in dims = . once removed it worked creating conv16_1024_1024_1024_1024.model file. (did not understand why dims was the problem)

But when using with reinforcement.py now it says

Using Theano backend.
Traceback (most recent call last):
  File "reinforcement.py", line 159, in <module>
    main()
  File "reinforcement.py", line 131, in main
    Ws, bs = get_params(['model_reinforcement.pickle', 'model.pickle'])
TypeError: 'NoneType' object is not iterable

seems that it is not able to read the data inside .model file or is a pickle problem?

reinforcement.py is a leftover from the original "deep-pink" project, I did not change it and most likely it's not supposed to work, sorry.

FF27 commented

Thanks for help i'll try reverting backed back to TF anyway