SparkSharly / DL_for_xss

Deep learnning for detection with xss
148 stars 64 forks source link

ValueError: If printing histograms, validation_data must be provided, and cannot be a generator. #1

Open hunandhan opened 7 years ago

hunandhan commented 7 years ago

你好,我在运行代码的时候遇到了问题。 F:\代码\DL_for_xss-master>python MLP.py Using TensorFlow backend. 2017-10-30 17:10:38.850932: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2017-10-30 17:10:38.851076: W C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. D:\Anaconda3\lib\site-packages\gensim\utils.py:862: UserWarning: detected Windows; aliasing chunkize to chunkize_serial warnings.warn("detected Windows; aliasing chunkize to chunkize_serial") Start Train Job! Epoch 1/1 336/337 [============================>.] - ETA: 2s - loss: 0.0729 - acc: 0.9776Traceback (most recent call last): File "MLP.py", line 73, in train(train_generator,train_size,input_num,dims_num) File "MLP.py", line 35, in train model.fit_generator(train_generator,steps_per_epoch=train_size//batch_size,epochs=epochs_num,callbacks=[call]) File "D:\Anaconda3\lib\site-packages\keras\legacy\interfaces.py", line 87, in wrapper return func(*args, *kwargs) File "D:\Anaconda3\lib\site-packages\keras\models.py", line 1121, in fit_generator initial_epoch=initial_epoch) File "D:\Anaconda3\lib\site-packages\keras\legacy\interfaces.py", line 87, in wrapper return func(args, **kwargs) File "D:\Anaconda3\lib\site-packages\keras\engine\training.py", line 2082, in fit_generator callbacks.on_epoch_end(epoch, epoch_logs) File "D:\Anaconda3\lib\site-packages\keras\callbacks.py", line 77, in on_epoch_end callback.on_epoch_end(epoch, logs) File "D:\Anaconda3\lib\site-packages\keras\callbacks.py", line 751, in on_epoch_end raise ValueError('If printing histograms, validation_data must be ' ValueError: If printing histograms, validation_data must be provided, and cannot be a generator. 不知道这个是什么情况。。。

bts-webber commented 7 years ago

keras版本问题,修改下callback. call = TensorBoard(log_dir=log_dir, write_grads=True) @hunandhan

hunandhan commented 7 years ago

修改了train函数中的call,运行成功了。谢谢dalao! @bts-webber

seutwom commented 6 years ago

您好,我在运行代码时遇到了如下问题: DL_for_xss-master SSU-LEE$ python Conv.py Using TensorFlow backend. 2018-09-17 10:45:19.020542: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA Start Train Job! Epoch 1/1 337/337 [==============================] - 1705s 5s/step - loss: 0.0553 - acc: 0.9824 Over train job in 1708.893095 s Traceback (most recent call last): File "Conv.py", line 51, in test(model_dir,test_generator,test_size,input_num,dims_num,batch_size) File "/Users/SSU-LEE/Downloads/DL_for_xss-master/MLP.py", line 41, in test model=load_model(model_dir) File "/Users/SSU-LEE/testvittualenv/xss/lib/python2.7/site-packages/keras/engine/saving.py", line 263, in load_model load_weights_from_hdf5_group(f['model_weights'], model.layers) File "/Users/SSU-LEE/testvittualenv/xss/lib/python2.7/site-packages/keras/engine/saving.py", line 900, in load_weights_from_hdf5_group str(len(filtered_layers)) + ' layers.') ValueError: You are trying to load a weight file containing 6 layers into a model with 0 layers. 是哪里配置有问题吗

cllx commented 6 years ago

这里想让它printing histograms 有什么其他办法吗 @bts-webber