yumoxu / stocknet-code

Code for stock movement prediction from tweets and historical stock prices.
MIT License
204 stars 79 forks source link

TypeError: Expected int32, got range(0, 30) of type 'range' instead. #9

Closed cpfffffff closed 1 year ago

cpfffffff commented 1 year ago

Hi,

I set up data, and run with default config, but below err happened, could you please help me how to fix it ? Thanks !

F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) F:\Anaconda3\envs\py36\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint8 = np.dtype([("qint8", np.int8, 1)]) F:\Anaconda3\envs\py36\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint8 = np.dtype([("quint8", np.uint8, 1)]) F:\Anaconda3\envs\py36\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint16 = np.dtype([("qint16", np.int16, 1)]) F:\Anaconda3\envs\py36\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_quint16 = np.dtype([("quint16", np.uint16, 1)]) F:\Anaconda3\envs\py36\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. _np_qint32 = np.dtype([("qint32", np.int32, 1)]) F:\Anaconda3\envs\py36\lib\site-packages\tensorboard\compat\tensorflow_stub\dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'. np_resource = np.dtype([("resource", np.ubyte, 1)]) 2023-04-22 10:11:33,037 INFO INIT: #stock: 88, #vocab+1: 29867 WARNING:tensorflow:From E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py:44: calling Constant.init (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version. Instructions for updating: Call initializer instance with the dtype argument instead of passing it to the constructor 2023-04-22 10:11:33,089 INFO Start graph assembling... WARNING:tensorflow:From E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py:110: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py:128: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.

WARNING:tensorflow:From E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py:136: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.

WARNING:tensorflow:From E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py:137: The name tf.get_variable is deprecated. Please use tf.compat.v1.get_variable instead.

WARNING:tensorflow:From E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py:155: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version. Instructions for updating: Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob. WARNING:tensorflow:From E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py:192: The name tf.AUTO_REUSE is deprecated. Please use tf.compat.v1.AUTO_REUSE instead.

WARNING:tensorflow:From E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py:197: GRUCell.init (from tensorflow.python.ops.rnn_cell_impl) is deprecated and will be removed in a future version. Instructions for updating: This class is equivalent as tf.keras.layers.GRUCell, and will be replaced by that in Tensorflow 2.0. WARNING:tensorflow:From E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py:171: bidirectional_dynamic_rnn (from tensorflow.python.ops.rnn) is deprecated and will be removed in a future version. Instructions for updating: Please use keras.layers.Bidirectional(keras.layers.RNN(cell)), which is equivalent to this API WARNING:tensorflow:From F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\rnn.py:464: dynamic_rnn (from tensorflow.python.ops.rnn) is deprecated and will be removed in a future version. Instructions for updating: Please use keras.layers.RNN(cell), which is equivalent to this API WARNING:tensorflow:From F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\init_ops.py:1251: calling VarianceScaling.init (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version. Instructions for updating: Call initializer instance with the dtype argument instead of passing it to the constructor WARNING:tensorflow:From F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\rnn_cell_impl.py:574: calling Zeros.init (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version. Instructions for updating: Call initializer instance with the dtype argument instead of passing it to the constructor WARNING:tensorflow:Entity <bound method GRUCell.call of <tensorflow.python.ops.rnn_cell_impl.GRUCell object at 0x000001E7F239EEB8>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output. Cause: converting <bound method GRUCell.call of <tensorflow.python.ops.rnn_cell_impl.GRUCell object at 0x000001E7F239EEB8>>: AttributeError: module 'gast' has no attribute 'Str' WARNING:tensorflow:From F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\rnn.py:244: add_dispatch_support..wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version. Instructions for updating: Use tf.where in 2.0, which has the same broadcast rule as np.where WARNING:tensorflow:Entity <bound method GRUCell.call of <tensorflow.python.ops.rnn_cell_impl.GRUCell object at 0x000001E7F23CCEF0>> could not be transformed and will be executed as-is. Please report this to the AutgoGraph team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10) and attach the full output. Cause: converting <bound method GRUCell.call of <tensorflow.python.ops.rnn_cell_impl.GRUCell object at 0x000001E7F23CCEF0>>: AttributeError: module 'gast' has no attribute 'Str' Traceback (most recent call last): File "Main.py", line 8, in model.assemble_graph() File "E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py", line 697, in assemble_graph self._build_mie() File "E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py", line 253, in _build_mie self._create_msg_embed_layer() File "E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py", line 210, in _create_msg_embed_layer msg_embed = tf.reshape(_for_one_batch(), shape=msg_embed_shape) File "E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py", line 189, in _for_one_batch iter_arg=self.mel_in, iter_arg2=self.ss_index_ph, iter_arg3=self.n_wordsph) File "E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\neural.py", line 39, in iter , ta_final = tf.while_loop(cond, body, loop_init) File "F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 3501, in while_loop return_same_structure) File "F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 3012, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2937, in _BuildLoop body_result = body(*packed_vars_for_body) File "E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\neural.py", line 36, in body = lambda i, ta: (i + 1, ta.write(i, func(iter_arg[i], iter_arg2[i], iter_arg3[i], *kwargs))) File "E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py", line 185, in _for_one_sample iter_arg=sample, iter_arg2=sample_ss_index, iter_arg3=samplemask) File "E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\neural.py", line 39, in iter , ta_final = tf.while_loop(cond, body, loop_init) File "F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 3501, in while_loop return_same_structure) File "F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 3012, in BuildLoop pred, body, original_loop_vars, loop_vars, shape_invariants) File "F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\ops\control_flow_ops.py", line 2937, in _BuildLoop body_result = body(packed_vars_for_body) File "E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\neural.py", line 36, in body = lambda i, ta: (i + 1, ta.write(i, func(iter_arg[i], iter_arg2[i], iter_arg3[i], **kwargs))) File "E:\CSDN\毕业论文\stocknet-code-master\stocknet-code-master\src\Model.py", line 175, in _for_one_trading_day msg_ids = tf.constant(range(0, self.max_n_msgs), dtype=tf.int32, shape=[self.max_n_msgs, 1]) # [0, 1, 2, ...] File "F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\constant_op.py", line 180, in constant_v1 allow_broadcast=False) File "F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\constant_op.py", line 284, in _constant_impl allow_broadcast=allow_broadcast)) File "F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 466, in make_tensor_proto _AssertCompatible(values, dtype) File "F:\Anaconda3\envs\py36\lib\site-packages\tensorflow\python\framework\tensor_util.py", line 371, in _AssertCompatible (dtype.name, repr(mismatch), type(mismatch).name)) TypeError: Expected int32, got range(0, 30) of type 'range' instead.