Closed wangjianqiao111 closed 1 year ago
请检查该codesave_model(model=estimator.model, model_file=dc.conf.outputs.dl_model)
的正确性,其中:
1、model=model
,该model是experiment.run返回的,目前不知道您的estimator.model
是什么;
2、model_file=xxx
,请给一个空文件夹。
如果上述没有问题,请检查packages版本,包括但不限于tensorflow、numpy等(Note: hyperts不支持keras, /usr/local/lib/python3.7/site-packages/keras/saving/saving_utils.py
,不知您的环境,该提示无法解答)。
我环境的包版本如下: keras==2.6.0 numpy==1.19.5 pyparsing==2.4.7 tensorflow==2.6.3 1、请帮忙看下包版本有问题吗? 2、hyperts不支持keras。但从报错信息看是hyperts直接调用了keras包,而不是tensorflow的keras,可以帮忙看下这是怎么回事吗 2023-04-07 16:38:27.961 [ERROR] File "/usr/local/lib/python3.7/site-packages/hyperts/framework/dl/_base.py", line 885, in save_model 2023-04-07 16:38:27.961 [ERROR] save_model(self.model, h, save_format='h5') 2023-04-07 16:38:27.961 [ERROR] File "/usr/local/lib/python3.7/site-packages/keras/saving/save.py", line 130, in save_model 2023-04-07 16:38:27.961 [ERROR] saving_utils.try_build_compiled_arguments(model)
您好,调用了keras而非tensorflow也可能该keras是tensorflow中的keras, 或者您的环境混乱产生冲突了(该问题超出了hyperts的控制范围)。如果按照教程进行模型的保存与重载,许多用户反馈是没有问题的,您也可以在检查一下您的执行流程是否存在问题。
from hyperts.utils.models import save_model dc.conf.outputs.dl_model是一个路径:/opt/aps/workdir/output/dl_model.model.dir save_model(model=estimator.model, model_file=dc.conf.outputs.dl_model) 你好,我在做回归任务的时候保存模型报以下错误,麻烦帮忙看下是什么问题 2023-04-07 16:38:27.956 [ERROR] Traceback (most recent call last): 2023-04-07 16:38:27.956 [ERROR] File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main 2023-04-07 16:38:27.956 [ERROR] "main", mod_spec) 2023-04-07 16:38:27.956 [ERROR] File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code 2023-04-07 16:38:27.956 [ERROR] exec(code, run_globals) 2023-04-07 16:38:27.956 [ERROR] File "/opt/pylib/dc_runtime.zip/datacanvas/shell.py", line 134, in
2023-04-07 16:38:27.958 [ERROR] File "/opt/pylib/dc_runtime.zip/datacanvas/shell.py", line 120, in
2023-04-07 16:38:27.958 [ERROR] File "/opt/pylib/dc_runtime.zip/datacanvas/shell.py", line 29, in get_args_func
2023-04-07 16:38:27.958 [ERROR] File "/opt/pylib/dc_runtime.zip/datacanvas/shell.py", line 61, in _execfile
2023-04-07 16:38:27.958 [ERROR] File "main.py", line 232, in
2023-04-07 16:38:27.960 [ERROR] save_model(model=estimator.model, model_file=dc.conf.outputs.dl_model)
2023-04-07 16:38:27.960 [ERROR] File "/usr/local/lib/python3.7/site-packages/hyperts/utils/models.py", line 25, in save_model
2023-04-07 16:38:27.960 [ERROR] submodel.sk_pipeline.steps[-1][1].save(model_file, external=True)
2023-04-07 16:38:27.960 [ERROR] File "/usr/local/lib/python3.7/site-packages/hyperts/hyper_ts.py", line 415, in save
2023-04-07 16:38:27.961 [ERROR] subself.model.model.save_model(model_file, external=external)
2023-04-07 16:38:27.961 [ERROR] File "/usr/local/lib/python3.7/site-packages/hyperts/framework/dl/_base.py", line 885, in save_model
2023-04-07 16:38:27.961 [ERROR] save_model(self.model, h, save_format='h5')
2023-04-07 16:38:27.961 [ERROR] File "/usr/local/lib/python3.7/site-packages/keras/saving/save.py", line 130, in save_model
2023-04-07 16:38:27.961 [ERROR] saving_utils.try_build_compiled_arguments(model)
2023-04-07 16:38:27.961 [ERROR] File "/usr/local/lib/python3.7/site-packages/keras/saving/saving_utils.py", line 306, in try_build_compiled_arguments
2023-04-07 16:38:27.961 [ERROR] model.outputs is not None):
2023-04-07 16:38:27.961 [ERROR] AttributeError: 'NoneType' object has no attribute 'outputs'