I am trying to use the script for employing a TPG attack using cmd or testing mode. This is the error raised by keras:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/keras/utils/generic_utils.py", line 233, in func_load
code = marshal.loads(raw_code)
ValueError: bad marshal data (unknown type code)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./src/tasks/bert4sim.py", line 565, in <module>
main()
File "./src/tasks/bert4sim.py", line 547, in main
model = ModelWrapper(config)
File "./src/tasks/bert4sim.py", line 285, in __init__
self.model = self.load_finetune()
File "./src/tasks/bert4sim.py", line 420, in load_finetune
return load_model(self.config.model_load, custom_objects=self.custom_objects)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 492, in load_wrapper
return load_function(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 584, in load_model
model = _deserialize_model(h5dict, custom_objects, compile)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 274, in _deserialize_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 627, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "/usr/local/lib/python3.6/dist-packages/keras/layers/__init__.py", line 168, in deserialize
printable_module_name='layer')
File "/usr/local/lib/python3.6/dist-packages/keras/utils/generic_utils.py", line 147, in deserialize_keras_object
list(custom_objects.items())))
File "/usr/local/lib/python3.6/dist-packages/keras/engine/network.py", line 1056, in from_config
process_layer(layer_data)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/network.py", line 1042, in process_layer
custom_objects=custom_objects)
File "/usr/local/lib/python3.6/dist-packages/keras/layers/__init__.py", line 168, in deserialize
printable_module_name='layer')
File "/usr/local/lib/python3.6/dist-packages/keras/utils/generic_utils.py", line 147, in deserialize_keras_object
list(custom_objects.items())))
File "/usr/local/lib/python3.6/dist-packages/keras/layers/core.py", line 764, in from_config
function = func_load(config['function'], globs=globs)
File "/usr/local/lib/python3.6/dist-packages/keras/utils/generic_utils.py", line 237, in func_load
code = marshal.loads(raw_code)
ValueError: bad marshal data (unknown type code)
class Config:
def __init__(self):
self.maxlen = 32
self.batch_size = 128
self.epochs = 3
# number of bert layers
self.layers_num = 4
# Learning rate
self.lr = 1e-5
self.cpu_num = 10
# bert配置
self.config_path = '/tmp/PassBertStrengthMeter/ServerModel/config/bert_config.json'
self.checkpoint_path = ''
self.label_path = ''
self.model_save = '/tmp/PassBertStrengthMeter/ServerModel/model/pretrain/'
self.mode = "cmd" # train, cmd, test
self.model_load = '/tmp/PassBertStrengthMeter/ServerModel/model/TPG/tpg.h5'
self.pwd_pairs = ''
self.output_csv = ''
But probably am I doing something wrong.