Open Fr2nkk opened 3 years ago
我也遇到了同样的问题,请问现在改成功了吗楼主
用了很多办法还是没解决,放弃了
------------------ 原始邮件 ------------------ 发件人: "DanielLin1986/Function-level-Vulnerability-Detection" @.>; 发送时间: 2021年9月16日(星期四) 上午7:40 @.>; @.**@.>; 主题: Re: [DanielLin1986/Function-level-Vulnerability-Detection] tensorflow.python.framework.errors_impl.InternalError: Unsupported object type int (#6)
我也遇到了同样的问题,请问现在改成功了吗楼主
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
在模型训练的时候代码报错的地方
code: train_history = model_func.fit(train_set_x, train_set_y, epochs = self.config['training_settings']['network_config']['epochs'], batch_size = self.config['training_settings']['network_config']['batch_size'], shuffle = False, # The data has already been shuffle before, so it is unnessary to shuffle it again. (And also, we need to correspond the ids to the features of the samples.)) validation_data = (validation_set_x, validation_set_y), callbacks = callbacks_list, verbose=self.paras.verbose, class_weight = class_weights)
error: During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "/home/work/.local/share/JetBrains/PyCharm2021.1/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "/home/work/.local/share/JetBrains/PyCharm2021.1/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/work/下载/Function-level-Vulnerability-Detection-master/main.py", line 35, in helper.exec() File "/home/work/下载/Function-level-Vulnerability-Detection-master/src/helper.py", line 295, in exec class_weight = class_weights) File "/home/work/anaconda3/envs/zhangkun/lib/python3.7/site-packages/keras/engine/training.py", line 1705, in fit validation_steps=validation_steps) File "/home/work/anaconda3/envs/zhangkun/lib/python3.7/site-packages/keras/engine/training.py", line 1236, in _fit_loop outs = f(ins_batch) File "/home/work/anaconda3/envs/zhangkun/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 2482, in call **self.session_kwargs) File "/home/work/anaconda3/envs/zhangkun/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 956, in run run_metadata_ptr) File "/home/work/anaconda3/envs/zhangkun/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1180, in _run feed_dict_tensor, options, run_metadata) File "/home/work/anaconda3/envs/zhangkun/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1359, in _do_run run_metadata) File "/home/work/anaconda3/envs/zhangkun/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1384, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.InternalError: Unsupported object type int
my question: 在构建模型的时候: embeddings = elmo_model(tf.squeeze(tf.cast(x, tf.string)), signature="default", as_dict=True)["elmo"]elmo_input = Input(shape=(None, ), dtype='string') 输入是string类型,然而fit过程中输入不能是string,该怎么改才行。 我们得到的train_set_x = [[ 100 1639 2 ... 0 0 0], [ 27 90 1765 ... 0 0 0], [ 57 12 57 ... 14 3 10], ..., [ 27 20 3636 ... 0 0 0], [ 27 61 20 ... 0 0 0], [ 27 33 5014 ... 0 0 0]] dtype=int32 求解
可以尝试着这样: embeddings = elmo_model(tf.squeeze(tf.cast(x, tf.string), axis=1), signature="default", as_dict=True)["elmo"] 也就是加一个“axis=1”,试试?
我也遇到了同样的问题,请问现在改成功了吗楼主
最近,github上的费劲,都没有看到消息.... 抱歉。请参照上一个问题的答案试试?
用了很多办法还是没解决,放弃了 … ------------------ 原始邮件 ------------------ 发件人: "DanielLin1986/Function-level-Vulnerability-Detection" @.>; 发送时间: 2021年9月16日(星期四) 上午7:40 @.>; @.**@.>; 主题: Re: [DanielLin1986/Function-level-Vulnerability-Detection] tensorflow.python.framework.errors_impl.InternalError: Unsupported object type int (#6) 我也遇到了同样的问题,请问现在改成功了吗楼主 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.
请参照第一个问题的回答,试试看?
我也遇到了同样的问题,请问现在改成功了吗楼主
应该是依赖包版本的问题,我现在已经改成功了
应该是依赖包版本的问题,我现在已经改成功了
how??
应该是依赖包版本的问题,我现在已经改成功了
how??
Tensorflow 1.15, Keras 2.3.1 试试?已测可以运行。
, axis=1
我改了环境但是仍然报一样的错误
Epoch 1/150
2022-08-11 08:21:08.643373: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
Traceback (most recent call last):
File "main.py", line 34, in
请问你的numpy和pandas是什么版本
请问你的numpy和pandas是什么版本
numpy 1.21.5 pandas 1.3.5
, axis=1
我改了环境但是仍然报一样的错误 Epoch 1/150 2022-08-11 08:21:08.643373: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0 Traceback (most recent call last): File "main.py", line 34, in helper.exec() File "/content/drive/MyDrive/Function-level-Vulnerability-Detection-master/src/helper.py", line 285, in exec class_weight = class_weights) File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1239, in fit validation_freq=validation_freq) File "/usr/local/lib/python3.7/dist-packages/keras/engine/training_arrays.py", line 196, in fit_loop outs = fit_function(ins_batch) File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/keras/backend.py", line 3476, in call run_metadata=self.run_metadata) File "/usr/local/lib/python3.7/dist-packages/tensorflow_core/python/client/session.py", line 1472, in call run_metadata_ptr) tensorflow.python.framework.errors_impl.InternalError: Unsupported object type int
请问你解决了嘛
在模型训练的时候代码报错的地方
code: train_history = model_func.fit(train_set_x, train_set_y, epochs = self.config['training_settings']['network_config']['epochs'], batch_size = self.config['training_settings']['network_config']['batch_size'], shuffle = False, # The data has already been shuffle before, so it is unnessary to shuffle it again. (And also, we need to correspond the ids to the features of the samples.)) validation_data = (validation_set_x, validation_set_y), callbacks = callbacks_list, verbose=self.paras.verbose, class_weight = class_weights)
error: During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in
File "/home/work/.local/share/JetBrains/PyCharm2021.1/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "/home/work/.local/share/JetBrains/PyCharm2021.1/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/home/work/下载/Function-level-Vulnerability-Detection-master/main.py", line 35, in
helper.exec()
File "/home/work/下载/Function-level-Vulnerability-Detection-master/src/helper.py", line 295, in exec
class_weight = class_weights)
File "/home/work/anaconda3/envs/zhangkun/lib/python3.7/site-packages/keras/engine/training.py", line 1705, in fit
validation_steps=validation_steps)
File "/home/work/anaconda3/envs/zhangkun/lib/python3.7/site-packages/keras/engine/training.py", line 1236, in _fit_loop
outs = f(ins_batch)
File "/home/work/anaconda3/envs/zhangkun/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 2482, in call
**self.session_kwargs)
File "/home/work/anaconda3/envs/zhangkun/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 956, in run
run_metadata_ptr)
File "/home/work/anaconda3/envs/zhangkun/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1180, in _run
feed_dict_tensor, options, run_metadata)
File "/home/work/anaconda3/envs/zhangkun/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1359, in _do_run
run_metadata)
File "/home/work/anaconda3/envs/zhangkun/lib/python3.7/site-packages/tensorflow_core/python/client/session.py", line 1384, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InternalError: Unsupported object type int
my question: 在构建模型的时候: embeddings = elmo_model(tf.squeeze(tf.cast(x, tf.string)), signature="default", as_dict=True)["elmo"]elmo_input = Input(shape=(None, ), dtype='string') 输入是string类型,然而fit过程中输入不能是string,该怎么改才行。 我们得到的train_set_x = [[ 100 1639 2 ... 0 0 0], [ 27 90 1765 ... 0 0 0], [ 57 12 57 ... 14 3 10], ..., [ 27 20 3636 ... 0 0 0], [ 27 61 20 ... 0 0 0], [ 27 33 5014 ... 0 0 0]] dtype=int32 求解