如果通过catboostregressor保存模型,如何将.h5转换为.tflite

时间:2019-07-27 20:48:40

标签: python tensorflow machine-learning keras catboostregressor

我已经创建了这样的模型

model = CatBoostRegressor(iterations=10000, loss_function='MAE', boosting_type='Ordered')
model.fit(X_train, y_train, silent=True)

现在将其另存为

model.save_model('model.h5')

但无法将其转换为.tflite 我尝试过

converter = tf.lite.TFLiteConverter.from_keras_model_file('model.h5')
tflite_model = converter.convert()

但是出错了

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-33-f713a0f1cc6c> in <module>()
----> 1 converter = tf.lite.TFLiteConverter.from_keras_model_file('model.h5')

4 frames
/usr/local/lib/python3.6/dist-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
    140         if swmr and swmr_support:
    141             flags |= h5f.ACC_SWMR_READ
--> 142         fid = h5f.open(name, flags, fapl=fapl)
    143     elif mode == 'r+':
    144         fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/h5f.pyx in h5py.h5f.open()

OSError: Unable to open file (file signature not found)

0 个答案:

没有答案