DanielLin1986 / Function-level-Vulnerability-Detection

A deep learning-based vulnerability detection framework
73 stars 23 forks source link

AttributeError: 'NoneType' object has no attribute 'summary' #11

Open lihuiuyun opened 2 years ago

lihuiuyun commented 2 years ago

[INFO] Model structure loaded. 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 257, in exec model_func.summary() AttributeError: 'NoneType' object has no attribute 'summary'

Have you ever encountered this problem? I have changed it for a long time or I still can't solve this error. 请问有遇到过这个问题吗,我改了很久还是没办法解决这个报错

DanielLin1986 commented 1 year ago

[INFO] Model structure loaded. 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 257, in exec model_func.summary() AttributeError: 'NoneType' object has no attribute 'summary'

Have you ever encountered this problem? I have changed it for a long time or I still can't solve this error. 请问有遇到过这个问题吗,我改了很久还是没办法解决这个报错

这个问题很有可能是没有具体的模型被载入。model_func.summary()报'NoneType' object has no attribute 'summary'错误表明 model_func 这个变量是空的。也就是说没有具体的一个模型被赋值给model_func这个变量。

请你把完整的脚本贴出来看看。

aravinthk00 commented 1 year ago

I also facing same error , My Error log :

(myenv) C:\Users\30863\Func-level-vul-detect>python main.py --config config\config.yaml --data_dir C:\Users\30863\Func-level-vul-detect\data --embedding elmo Using TensorFlow backend. [INFO] Start training process.... [INFO] Loading data from C:\Users\30863\Func-level-vul-detect\C:\Users\30863\Func-level-vul-detect\data.... [INFO] The length of the loaded data list is : 4399 [INFO] Applying ELMo model! [INFO] Setting padding length 1000 for ELMo model. Each textual sequence contains 1000 elements. [INFO] Patition the data .... [INFO] Data processing completed! [INFO] ------------------------------------------------------- [INFO] There are 2815 total samples in the training set. 2438 vulnerable samples. [INFO] There are 704 total samples in the validation set. 615 vulnerable samples. [INFO] ------------------------------------------------------- 2022-08-01 09:04:42.982466: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2 [INFO] No GPU detected. [INFO] Using CPU for training. It may take considerable time! [INFO] Loading the elmo model. WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:74: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:517: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

2022-08-01 09:04:44.182289: W tensorflow/core/graph/graph_constructor.cc:1491] Importing a graph with a lower producer version 26 into an existing graph with producer version 134. Shape inference will have run different parts of the graph with different producer versions. WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:4138: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:4138: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:133: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:133: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:3445: 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 C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:3445: 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 C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\optimizers.py:790: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\optimizers.py:790: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:3376: The name tf.log is deprecated. Please use tf.math.log instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:3376: The name tf.log is deprecated. Please use tf.math.log instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\tensorflow_core\python\ops\nn_impl.py:183: where (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:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\tensorflow_core\python\ops\nn_impl.py:183: where (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


Layer (type) Output Shape Param #

input_1 (InputLayer) (None, None) 0


lambda_1 (Lambda) (None, None, 1024) 0


bidirectional_1 (Bidirection (None, None, 256) 1180672


bidirectional_2 (Bidirection (None, None, 256) 394240


global_max_pooling1d_1 (Glob (None, 256) 0


dropout_1 (Dropout) (None, 256) 0


dense_1 (Dense) (None, 64) 16448


dense_2 (Dense) (None, 1) 65

Total params: 1,591,425 Trainable params: 1,591,425 Non-trainable params: 0


[INFO] Model structure loaded. Traceback (most recent call last): File "main.py", line 34, in helper.exec() File "C:\Users\30863\Func-level-vul-detect\src\helper.py", line 256, in exec model_func.summary() AttributeError: 'NoneType' object has no attribute 'summary'

thanks in advance , please you could help and assist soon

DanielLin1986 commented 1 year ago

I also facing same error , My Error log :

(myenv) C:\Users\30863\Func-level-vul-detect>python main.py --config config\config.yaml --data_dir C:\Users\30863\Func-level-vul-detect\data --embedding elmo Using TensorFlow backend. [INFO] Start training process.... [INFO] Loading data from C:\Users\30863\Func-level-vul-detect\C:\Users\30863\Func-level-vul-detect\data.... [INFO] The length of the loaded data list is : 4399 [INFO] Applying ELMo model! [INFO] Setting padding length 1000 for ELMo model. Each textual sequence contains 1000 elements. [INFO] Patition the data .... [INFO] Data processing completed! [INFO] ------------------------------------------------------- [INFO] There are 2815 total samples in the training set. 2438 vulnerable samples. [INFO] There are 704 total samples in the validation set. 615 vulnerable samples. [INFO] ------------------------------------------------------- 2022-08-01 09:04:42.982466: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2 [INFO] No GPU detected. [INFO] Using CPU for training. It may take considerable time! [INFO] Loading the elmo model. WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:74: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:517: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

2022-08-01 09:04:44.182289: W tensorflow/core/graph/graph_constructor.cc:1491] Importing a graph with a lower producer version 26 into an existing graph with producer version 134. Shape inference will have run different parts of the graph with different producer versions. WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:4138: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:4138: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:133: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:133: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:3445: 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 C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:3445: 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 C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\optimizers.py:790: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\optimizers.py:790: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:3376: The name tf.log is deprecated. Please use tf.math.log instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:3376: The name tf.log is deprecated. Please use tf.math.log instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\tensorflow_core\python\ops\nn_impl.py:183: where (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:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\tensorflow_core\python\ops\nn_impl.py:183: where (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

Layer (type) Output Shape Param

input_1 (InputLayer) (None, None) 0

lambda_1 (Lambda) (None, None, 1024) 0

bidirectional_1 (Bidirection (None, None, 256) 1180672

bidirectional_2 (Bidirection (None, None, 256) 394240

global_max_pooling1d_1 (Glob (None, 256) 0

dropout_1 (Dropout) (None, 256) 0

dense_1 (Dense) (None, 64) 16448

dense_2 (Dense) (None, 1) 65

Total params: 1,591,425 Trainable params: 1,591,425 Non-trainable params: 0

[INFO] Model structure loaded. Traceback (most recent call last): File "main.py", line 34, in helper.exec() File "C:\Users\30863\Func-level-vul-detect\src\helper.py", line 256, in exec model_func.summary() AttributeError: 'NoneType' object has no attribute 'summary'

thanks in advance , please you could help and assist soon

Hi aravinthk00,

Thanks for your comments. The issue was caused by an error in the elmo_network.py file. There is a line of code missing:

The compiled model should be returned at the end of line 64 in the elmo_network.py file.

Thank you for pointing out the bug. It has been fixed.

DanielLin1986 commented 1 year ago

[INFO] Model structure loaded. 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 257, in exec model_func.summary() AttributeError: 'NoneType' object has no attribute 'summary'

Have you ever encountered this problem? I have changed it for a long time or I still can't solve this error. 请问有遇到过这个问题吗,我改了很久还是没办法解决这个报错

感谢发现问题,很抱歉,这个报错的原因是 elmo_network.py 文件末尾漏了一行返回模型的代码。代码已修改,请再试一次。

aravinthk00 commented 1 year ago

try that but I get this new error log :

(myenv) C:\Users\30863\Func-level-vul-detect>python main.py --config config\config.yaml --data_dir C:\Users\30863\Func-level-vul-detect\data --embedding elmo Using TensorFlow backend. [INFO] Start training process.... [INFO] Loading data from C:\Users\30863\Func-level-vul-detect\C:\Users\30863\Func-level-vul-detect\data.... [INFO] The length of the loaded data list is : 622 [INFO] Applying ELMo model! [INFO] Setting padding length 1000 for ELMo model. Each textual sequence contains 1000 elements. [INFO] Patition the data .... [INFO] Data processing completed! [INFO] ------------------------------------------------------- [INFO] There are 397 total samples in the training set. 28 vulnerable samples. [INFO] There are 100 total samples in the validation set. 8 vulnerable samples. [INFO] ------------------------------------------------------- 2022-08-03 11:00:48.311079: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2 [INFO] No GPU detected. [INFO] Using CPU for training. It may take considerable time! [INFO] Loading the elmo model. WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:74: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:517: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

2022-08-03 11:00:49.223380: W tensorflow/core/graph/graph_constructor.cc:1491] Importing a graph with a lower producer version 26 into an existing graph with producer version 134. Shape inference will have run different parts of the graph with different producer versions. WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:4138: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:4138: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:133: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:133: The name tf.placeholder_with_default is deprecated. Please use tf.compat.v1.placeholder_with_default instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:3445: 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 C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:3445: 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 C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\optimizers.py:790: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\optimizers.py:790: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:3376: The name tf.log is deprecated. Please use tf.math.log instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:3376: The name tf.log is deprecated. Please use tf.math.log instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\tensorflow_core\python\ops\nn_impl.py:183: where (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:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\tensorflow_core\python\ops\nn_impl.py:183: where (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 [INFO] Model structure loaded.


Layer (type) Output Shape Param #

input_1 (InputLayer) (None, None) 0


lambda_1 (Lambda) (None, None, 1024) 0


bidirectional_1 (Bidirection (None, None, 256) 1180672


bidirectional_2 (Bidirection (None, None, 256) 394240


global_max_pooling1d_1 (Glob (None, 256) 0


dropout_1 (Dropout) (None, 256) 0


dense_1 (Dense) (None, 64) 16448


dense_2 (Dense) (None, 1) 65

Total params: 1,591,425 Trainable params: 1,591,425 Non-trainable params: 0


WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:986: The name tf.assign_add is deprecated. Please use tf.compat.v1.assign_add instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:986: The name tf.assign_add is deprecated. Please use tf.compat.v1.assign_add instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:973: The name tf.assign is deprecated. Please use tf.compat.v1.assign instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:973: The name tf.assign is deprecated. Please use tf.compat.v1.assign instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:2741: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:2741: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

Train on 397 samples, validate on 100 samples WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:174: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:174: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:181: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:181: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:190: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:190: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:199: The name tf.is_variable_initialized is deprecated. Please use tf.compat.v1.is_variable_initialized instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:199: The name tf.is_variable_initialized is deprecated. Please use tf.compat.v1.is_variable_initialized instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:206: The name tf.variables_initializer is deprecated. Please use tf.compat.v1.variables_initializer instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\backend\tensorflow_backend.py:206: The name tf.variables_initializer is deprecated. Please use tf.compat.v1.variables_initializer instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\callbacks.py:850: The name tf.summary.merge_all is deprecated. Please use tf.compat.v1.summary.merge_all instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\callbacks.py:850: The name tf.summary.merge_all is deprecated. Please use tf.compat.v1.summary.merge_all instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\callbacks.py:853: The name tf.summary.FileWriter is deprecated. Please use tf.compat.v1.summary.FileWriter instead.

WARNING:tensorflow:From C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\callbacks.py:853: The name tf.summary.FileWriter is deprecated. Please use tf.compat.v1.summary.FileWriter instead.

Epoch 1/150 2022-08-03 11:01:25.426100: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 2883584000 exceeds 10% of system memory. 2022-08-03 11:01:25.460726: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 1474560000 exceeds 10% of system memory. 16/397 [>.............................] - ETA: 17:56 - loss: 0.5864 - acc: 0.81252022-08-03 11:02:08.453698: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 2883584000 exceeds 10% of system memory. 2022-08-03 11:02:08.453742: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 1474560000 exceeds 10% of system memory. 32/397 [=>............................] - ETA: 17:06 - loss: 0.5800 - acc: 0.84382022-08-03 11:02:53.258533: W tensorflow/core/framework/cpu_allocator_impl.cc:81] Allocation of 2883584000 exceeds 10% of system memory. 397/397 [==============================] - 1508s 4s/step - loss: 0.4350 - acc: 0.9169 - val_loss: 0.3245 - val_acc: 0.9200

Epoch 00001: val_loss improved from inf to 0.32447, saving model to result/models/test_model_01_0.920_0.324465.h5 Traceback (most recent call last): File "main.py", line 34, in helper.exec() File "C:\Users\30863\Func-level-vul-detect\src\helper.py", line 287, in exec class_weight = class_weights) File "C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\engine\training.py", line 1039, in fit validation_steps=validation_steps) File "C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\engine\training_arrays.py", line 217, in fit_loop callbacks.on_epoch_end(epoch, epoch_logs) File "C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\callbacks.py", line 79, in on_epoch_end callback.on_epoch_end(epoch, logs) File "C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\callbacks.py", line 446, in on_epoch_end self.model.save(filepath, overwrite=True) File "C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\engine\network.py", line 1090, in save save_model(self, filepath, overwrite, include_optimizer) File "C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\keras\engine\saving.py", line 367, in save_model raise ImportError('save_model requires h5py.')

ImportError: save_model requires h5py.

then I installed h5py and try again but now i facing new error :

(myenv) C:\Users\30863\Func-level-vul-detect>python main.py --config config\config.yaml --data_dir C:\Users\30863\Func-level-vul-detect\data --embedding elmo Using TensorFlow backend. Traceback (most recent call last): File "main.py", line 29, in from src.helper import Trainer as Helper File "C:\Users\30863\Func-level-vul-detect\src\helper.py", line 34, in from src.models.elmo_network import elmo_model File "C:\Users\30863\Func-level-vul-detect\src\models\elmo_network.py", line 9, in import tensorflow_hub as hub File "C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\tensorflow_hub__init.py", line 88, in from tensorflow_hub.estimator import LatestModuleExporter File "C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\tensorflow_hub\estimator.py", line 62, in class LatestModuleExporter(tf.compat.v1.estimator.Exporter): File "C:\Users\30863\Anaconda3\envs\myenv\lib\site-packages\tensorflow_core\python\util\module_wrapper.py", line 193, in getattr__ attr = getattr(self._tfmw_wrapped_module, name)

AttributeError: module 'tensorflow._api.v1.compat.v1' has no attribute 'estimator'