Closed iamlxb3 closed 4 years ago
Which version of Keras are you using? "epoch_logs" is internal to Keras and it seems to be an issue with the installation of Keras.
keras 2.0.2 py36_1 conda-forge
It seems like a dimension problem:
Traceback (most recent call last): File "/Users/jiashupu/miniconda3/envs/general/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/Users/jiashupu/miniconda3/envs/general/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/Users/jiashupu/.local/lib/python3.6/site-packages/Keras-2.0.2-py3.6.egg/keras/engine/training.py", line 606, in data_generator_task generator_output = next(self._generator) File "/Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne_utils.py", line 50, in batch_generator_sdne deg_i = np.sum(X_batch_v_i != 0, 1).reshape((batch_size, 1)) ValueError: cannot reshape array of size 154 into shape (300,1)
Here 300 corresponds to the n_batch I set.
Were you able to resolve the above problem?
n_batch is too large. But maybe we can add a
It seems like a dimension problem:
Traceback (most recent call last): File "/Users/jiashupu/miniconda3/envs/general/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/Users/jiashupu/miniconda3/envs/general/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/Users/jiashupu/.local/lib/python3.6/site-packages/Keras-2.0.2-py3.6.egg/keras/engine/training.py", line 606, in data_generator_task generator_output = next(self._generator) File "/Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne_utils.py", line 50, in batch_generator_sdne deg_i = np.sum(X_batch_v_i != 0, 1).reshape((batch_size, 1)) ValueError: cannot reshape array of size 154 into shape (300,1)
Here 300 corresponds to the n_batch I set.
Your n_batch is too large. I made same mistake... But maybe we can add some codes to inform users who made same mistake.
I ran your example and an error occurred.
/Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne_utils.py:71: UserWarning: Update your
Densecall to the Keras 2 API:
Dense(50, activation="relu", kernel_regularizer=<keras.reg...)W_regularizer=Reg.l1_l2(l1=nu1, l2=nu2))(y[i]) WARNING:tensorflow:From /Users/jiashupu/miniconda3/envs/general/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. WARNING:tensorflow:From /Users/jiashupu/.local/lib/python3.6/site-packages/Keras-2.0.2-py3.6.egg/keras/backend/tensorflow_backend.py:1044: calling reduce_sum_v1 (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version. Instructions for updating: keep_dims is deprecated, use keepdims instead /Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne_utils.py:71: UserWarning: Update your
Densecall to the Keras 2 API:
Dense(15, activation="relu", kernel_regularizer=<keras.reg...)W_regularizer=Reg.l1_l2(l1=nu1, l2=nu2))(y[i]) /Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne_utils.py:73: UserWarning: Update your
Densecall to the Keras 2 API:
Dense(2, activation="relu", kernel_regularizer=<keras.reg...)W_regularizer=Reg.l1_l2(l1=nu1, l2=nu2))(y[K - 1]) /Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne_utils.py:75: UserWarning: Update your
Modelcall to the Keras 2 API:
Model(inputs=Tensor("in..., outputs=Tensor("de...)encoder = Model(input=x, output=y[K]) /Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne_utils.py:90: UserWarning: Update your
Densecall to the Keras 2 API:
Dense(15, activation="relu", kernel_regularizer=<keras.reg...)W_regularizer=Reg.l1_l2(l1=nu1, l2=nu2))(y_hat[i + 1]) /Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne_utils.py:90: UserWarning: Update your
Densecall to the Keras 2 API:
Dense(50, activation="relu", kernel_regularizer=<keras.reg...)W_regularizer=Reg.l1_l2(l1=nu1, l2=nu2))(y_hat[i + 1]) /Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne_utils.py:92: UserWarning: Update your
Densecall to the Keras 2 API:
Dense(34, activation="relu", kernel_regularizer=<keras.reg...)W_regularizer=Reg.l1_l2(l1=nu1, l2=nu2))(y_hat[1]) /Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne_utils.py:96: UserWarning: Update your
Modelcall to the Keras 2 API:
Model(inputs=Tensor("in..., outputs=Tensor("de...)decoder = Model(input=y, output=x_hat) /Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne_utils.py:108: UserWarning: Update your
Modelcall to the Keras 2 API:
Model(inputs=Tensor("in..., outputs=[<tf.Tenso...)autoencoder = Model(input=x, output=[x_hat, y]) /Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne.py:115: UserWarning: The
mergefunction is deprecated and will be removed after 08/2017. Use instead layers from
keras.layers.merge, e.g.
add,
concatenate, etc. output_shape=lambda L: L[1]) /Users/jiashupu/.local/lib/python3.6/site-packages/Keras-2.0.2-py3.6.egg/keras/legacy/layers.py:456: UserWarning: The
Mergelayer is deprecated and will be removed after 08/2017. Use instead layers from
keras.layers.merge, e.g.
add,
concatenate, etc. name=name) /Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne.py:118: UserWarning: The
mergefunction is deprecated and will be removed after 08/2017. Use instead layers from
keras.layers.merge, e.g.
add,
concatenate, etc. output_shape=lambda L: L[1]) /Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne.py:121: UserWarning: The
mergefunction is deprecated and will be removed after 08/2017. Use instead layers from
keras.layers.merge, e.g.
add,
concatenate, etc. output_shape=lambda L: L[1]) /Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne.py:147: UserWarning: Update your
Modelcall to the Keras 2 API:
Model(inputs=Tensor("x_..., outputs=[<tf.Tenso...)self._model = Model(input=x_in, output=[x_diff1, x_diff2, y_diff]) /Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne.py:160: UserWarning: The semantics of the Keras 2 argument
steps_per_epochis not the same as the Keras 1 argument
samples_per_epoch.
steps_per_epochis the number of batches to draw from the generator at each epoch. Update your method calls accordingly. verbose=1 /Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne.py:160: UserWarning: Update your
fit_generatorcall to the Keras 2 API:
fit_generator(generator=<generator..., verbose=1, steps_per_epoch=0, epochs=50)verbose=1 WARNING:tensorflow:From /Users/jiashupu/miniconda3/envs/general/lib/python3.6/site-packages/tensorflow/python/ops/math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.cast instead. WARNING:tensorflow:Variable *= will be deprecated. Use
var.assign(var other)if you want assignment to the variable value or
x = x y` if you want a new python Tensor object. Epoch 1/50 Exception in thread Thread-1: Traceback (most recent call last): File "/Users/jiashupu/miniconda3/envs/general/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/Users/jiashupu/miniconda3/envs/general/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/Users/jiashupu/.local/lib/python3.6/site-packages/Keras-2.0.2-py3.6.egg/keras/engine/training.py", line 606, in data_generator_task generator_output = next(self._generator) File "/Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne_utils.py", line 50, in batch_generator_sdne deg_i = np.sum(X_batch_v_i != 0, 1).reshape((batch_size, 1)) ValueError: cannot reshape array of size 154 into shape (500,1)Traceback (most recent call last): File "GEM_example.py", line 53, in
Y, t = embedding.learn_embedding(graph=G, edge_f=None, is_weighted=True, no_python=True)
File "/Users/jiashupu/.local/lib/python3.6/site-packages/gem-1.0.0-py3.6.egg/gem/embedding/sdne.py", line 160, in learn_embedding
verbose=1
File "/Users/jiashupu/.local/lib/python3.6/site-packages/Keras-2.0.2-py3.6.egg/keras/legacy/interfaces.py", line 88, in wrapper
return func(*args, **kwargs)
File "/Users/jiashupu/.local/lib/python3.6/site-packages/Keras-2.0.2-py3.6.egg/keras/engine/training.py", line 1913, in fit_generator
callbacks.on_epoch_end(epoch, epoch_logs)
UnboundLocalError: local variable 'epoch_logs' referenced before assignment
If you suspect this is an IPython bug, please report it at: https://github.com/ipython/ipython/issues or send an email to the mailing list at ipython-dev@python.org
You can print a more detailed traceback right now with "%tb", or use "%debug" to interactively debug it.
Extra-detailed tracebacks for bug-reporting purposes can be enabled via: %config Application.verbose_crash=True`