我正在尝试保存以下文件,但不确定如何保存。我曾尝试在训练模型U extends
之前放置 mydict = [:] // Your parameters here
if let theJSONData = try? JSONSerialization.data(
withJSONObject: mydict,
options: []) {
let theJSONText = String(data: theJSONData,
encoding: .ascii)
multipartFormData.append((theJSONText?.data(using: .utf8)!)!, withName: "bulkData")
}
,但收到with tf.Session as sess
。然后,我尝试在模型初始化位置history = model.fit_generator...
上方放置ValueError: No variables to save
。我是Tensorflow的新手,所以我只是想学习绳索。
任何指导都会很棒,谢谢!
with tf.Session...
答案 0 :(得分:1)
来自Keras文档:
from keras.models import load_model
model.save('my_model.h5') # creates a HDF5 file 'my_model.h5'
del model # deletes the existing model
# returns a compiled model
# identical to the previous one
model = load_model('my_model.h5')