Skip to content

  • 体验新版
    • 正在加载...
  • 登录
  • PaddlePaddle
  • PaddleHub
  • Issue
  • #706

P
PaddleHub
  • 项目概览

PaddlePaddle / PaddleHub
大约 2 年 前同步成功

通知 285
Star 12117
Fork 2091
  • 代码
    • 文件
    • 提交
    • 分支
    • Tags
    • 贡献者
    • 分支图
    • Diff
  • Issue 200
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 4
  • Wiki 0
    • Wiki
  • 分析
    • 仓库
    • DevOps
  • 项目成员
  • Pages
P
PaddleHub
  • 项目概览
    • 项目概览
    • 详情
    • 发布
  • 仓库
    • 仓库
    • 文件
    • 提交
    • 分支
    • 标签
    • 贡献者
    • 分支图
    • 比较
  • Issue 200
    • Issue 200
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 4
    • 合并请求 4
  • Pages
  • 分析
    • 分析
    • 仓库分析
    • DevOps
  • Wiki 0
    • Wiki
  • 成员
    • 成员
  • 收起侧边栏
  • 动态
  • 分支图
  • 创建新Issue
  • 提交
  • Issue看板
已关闭
开放中
Opened 6月 20, 2020 by saxon_zh@saxon_zhGuest

UnavailableError: Cannot open cv_finetune_EfficientnetB0_2020-6-19-1\step_365\@HUB_efficientnetb0_imagenet@_blocks.0._bn1_offset_beta1_pow_acc_0 to save variables.

Created by: zachary-zheng

  • 版本、环境信息 1)PaddleHub和PaddlePaddle版本:PaddleHub1.7.1,Paddle1.8.1 2)系统环境:Windows,python版本3.7.7
  • 复现信息:如为报错,请给出复现环境、复现步骤 你好, 我根据如下link(https://github.com/PaddlePaddle/PaddleHub/tree/release/v1.7/demo/image_classification)的README.MD 进行如下代码,出现如下报错。 我尝试了解决方案(1)在下面代码基础上修改使用module = hub.Module(name="resnet_v2_50_imagenet"), 没有报错。 (2)在下面代码基础上将放置该脚本文件(finetuning.py)的文件夹名称由Fine_tuning_efficientnetb0改为Fine_tuning, 没有报错。 因此我很迷惑,下面代码报错的原因是什么? 烦劳解答,谢谢。 code:
#coding:utf-8
import paddlehub as hub
import numpy as np

#加载预训练模型
# module = hub.Module(name="resnet_v2_50_imagenet")
module = hub.Module(name="efficientnetb0_imagenet")
inputs, outputs, program = module.context(trainable=True)
#下载数据集并使用ImageClassificationReader读取数据
dataset = hub.dataset.Flowers()
data_reader = hub.reader.ImageClassificationReader(
    image_width=module.get_expected_image_width(),
    image_height=module.get_expected_image_height(),
    images_mean=module.get_pretrained_images_mean(),
    images_std=module.get_pretrained_images_std(),
    dataset=dataset)
#选择优化策略和运行配置
strategy = hub.DefaultFinetuneStrategy(
    learning_rate=1e-4,
    optimizer_name="adam",
    regularization_coeff=1e-3)

config = hub.RunConfig(use_cuda=True, checkpoint_dir="cv_finetune_EfficientnetB0_2020-6-19-1", use_data_parallel=True, num_epoch=1, batch_size=8, strategy=strategy)
#构建网络并创建分类迁移任务进行Fine-tune
feature_map = outputs["feature_map"]
feed_list = [inputs["image"].name]

task = hub.ImageClassifierTask(
    data_reader=data_reader,
    feed_list=feed_list,
    feature=feature_map,
    num_classes=dataset.num_labels,
    config=config)

task.finetune_and_eval()
data = [r"C:\Users\admin\.paddlehub\dataset\flower_photos\daisy\525271784_013ddccd1b_m.jpg"] 
task.predict(data=data, return_result=True)  
print(task.predict(data=data, return_result=True))

Running error as following:

E:\Python\Python37-64\python.exe "E:/Python/Pycharm/my work/AI_study/Learning_from_Github/04 paddlepaddle-learn/03 Paddle_hub/peach_class/my_finegtuning/Fine_tuning_efficientnetb0/finetuning.py"
[2020-06-20 09:33:31,950] [    INFO] - Installing efficientnetb0_imagenet module
[2020-06-20 09:33:32,011] [    INFO] - Module efficientnetb0_imagenet already installed in C:\Users\admin\.paddlehub\modules\efficientnetb0_imagenet
[2020-06-20 09:33:32,586] [    INFO] - 311 pretrained paramaters loaded by PaddleHub
[2020-06-20 09:33:32,587] [    INFO] - Dataset C:\Users\admin\.paddlehub\dataset\flower_photos already cached.
[2020-06-20 09:33:32,612] [    INFO] - Dataset label map = {'roses': 0, 'tulips': 1, 'daisy': 2, 'sunflowers': 3, 'dandelion': 4}
[2020-06-20 09:33:32,612] [    INFO] - Checkpoint dir: cv_finetune_EfficientnetB0_2020-6-19-1
[2020-06-20 09:33:37,947] [    INFO] - Strategy with slanted triangle learning rate, L2 regularization, 
E:\Python\Python37-64\lib\site-packages\paddle\fluid\executor.py:1093: UserWarning: There are no operators in the program to be executed. If you pass Program manually, please use fluid.program_guard to ensure the current Program is being used.
  warnings.warn(error_info)
[2020-06-20 09:33:39,553] [    INFO] - Try loading checkpoint from cv_finetune_EfficientnetB0_2020-6-19-1\ckpt.meta
[2020-06-20 09:33:39,554] [    INFO] - PaddleHub model checkpoint not found, start from scratch...
[2020-06-20 09:33:39,693] [    INFO] - PaddleHub finetune start
[2020-06-20 09:33:43,610] [   TRAIN] - step 10 / 364: loss=0.27500 acc=0.27500 [step/sec: 2.70]
[2020-06-20 09:33:46,474] [   TRAIN] - step 20 / 364: loss=0.43750 acc=0.43750 [step/sec: 3.49]
[2020-06-20 09:33:49,364] [   TRAIN] - step 30 / 364: loss=0.57500 acc=0.57500 [step/sec: 3.46]
[2020-06-20 09:33:52,333] [   TRAIN] - step 40 / 364: loss=0.67500 acc=0.67500 [step/sec: 3.37]
[2020-06-20 09:33:55,201] [   TRAIN] - step 50 / 364: loss=0.67500 acc=0.67500 [step/sec: 3.49]
[2020-06-20 09:33:58,057] [   TRAIN] - step 60 / 364: loss=0.75000 acc=0.75000 [step/sec: 3.50]
[2020-06-20 09:34:00,934] [   TRAIN] - step 70 / 364: loss=0.76250 acc=0.76250 [step/sec: 3.48]
[2020-06-20 09:34:03,913] [   TRAIN] - step 80 / 364: loss=0.76250 acc=0.76250 [step/sec: 3.36]
[2020-06-20 09:34:06,765] [   TRAIN] - step 90 / 364: loss=0.72500 acc=0.72500 [step/sec: 3.51]
[2020-06-20 09:34:09,681] [   TRAIN] - step 100 / 364: loss=0.78750 acc=0.78750 [step/sec: 3.43]
[2020-06-20 09:34:09,681] [    INFO] - Evaluation on dev dataset start
share_vars_from is set, scope is ignored.
[2020-06-20 09:34:14,278] [    EVAL] - [dev dataset evaluation result] loss=0.84859 acc=0.84859 [step/sec: 12.69]
[2020-06-20 09:34:14,278] [    EVAL] - best model saved to cv_finetune_EfficientnetB0_2020-6-19-1\best_model [best acc=0.84859]
[2020-06-20 09:34:18,592] [   TRAIN] - step 110 / 364: loss=0.76250 acc=0.76250 [step/sec: 3.48]
[2020-06-20 09:34:21,455] [   TRAIN] - step 120 / 364: loss=0.75000 acc=0.75000 [step/sec: 3.49]
[2020-06-20 09:34:24,333] [   TRAIN] - step 130 / 364: loss=0.90000 acc=0.90000 [step/sec: 3.48]
[2020-06-20 09:34:27,203] [   TRAIN] - step 140 / 364: loss=0.80000 acc=0.80000 [step/sec: 3.48]
[2020-06-20 09:34:30,085] [   TRAIN] - step 150 / 364: loss=0.88750 acc=0.88750 [step/sec: 3.47]
[2020-06-20 09:34:32,956] [   TRAIN] - step 160 / 364: loss=0.73750 acc=0.73750 [step/sec: 3.48]
[2020-06-20 09:34:35,829] [   TRAIN] - step 170 / 364: loss=0.73750 acc=0.73750 [step/sec: 3.48]
[2020-06-20 09:34:38,713] [   TRAIN] - step 180 / 364: loss=0.90000 acc=0.90000 [step/sec: 3.47]
[2020-06-20 09:34:41,580] [   TRAIN] - step 190 / 364: loss=0.83750 acc=0.83750 [step/sec: 3.49]
[2020-06-20 09:34:44,452] [   TRAIN] - step 200 / 364: loss=0.80000 acc=0.80000 [step/sec: 3.48]
[2020-06-20 09:34:44,452] [    INFO] - Evaluation on dev dataset start
[2020-06-20 09:34:48,141] [    EVAL] - [dev dataset evaluation result] loss=0.89807 acc=0.89807 [step/sec: 13.16]
[2020-06-20 09:34:48,141] [    EVAL] - best model saved to cv_finetune_EfficientnetB0_2020-6-19-1\best_model [best acc=0.89807]
[2020-06-20 09:34:51,665] [   TRAIN] - step 210 / 364: loss=0.82500 acc=0.82500 [step/sec: 3.50]
[2020-06-20 09:34:54,527] [   TRAIN] - step 220 / 364: loss=0.90000 acc=0.90000 [step/sec: 3.49]
[2020-06-20 09:34:57,395] [   TRAIN] - step 230 / 364: loss=0.78750 acc=0.78750 [step/sec: 3.49]
[2020-06-20 09:35:00,277] [   TRAIN] - step 240 / 364: loss=0.80000 acc=0.80000 [step/sec: 3.47]
[2020-06-20 09:35:03,154] [   TRAIN] - step 250 / 364: loss=0.85000 acc=0.85000 [step/sec: 3.48]
[2020-06-20 09:35:06,016] [   TRAIN] - step 260 / 364: loss=0.85000 acc=0.85000 [step/sec: 3.49]
[2020-06-20 09:35:08,880] [   TRAIN] - step 270 / 364: loss=0.87500 acc=0.87500 [step/sec: 3.49]
[2020-06-20 09:35:11,767] [   TRAIN] - step 280 / 364: loss=0.88750 acc=0.88750 [step/sec: 3.47]
[2020-06-20 09:35:14,631] [   TRAIN] - step 290 / 364: loss=0.81250 acc=0.81250 [step/sec: 3.49]
[2020-06-20 09:35:17,484] [   TRAIN] - step 300 / 364: loss=0.87500 acc=0.87500 [step/sec: 3.51]
[2020-06-20 09:35:17,484] [    INFO] - Evaluation on dev dataset start
[2020-06-20 09:35:21,191] [    EVAL] - [dev dataset evaluation result] loss=0.93229 acc=0.93229 [step/sec: 13.09]
[2020-06-20 09:35:21,191] [    EVAL] - best model saved to cv_finetune_EfficientnetB0_2020-6-19-1\best_model [best acc=0.93229]
[2020-06-20 09:35:24,724] [   TRAIN] - step 310 / 364: loss=0.83750 acc=0.83750 [step/sec: 3.49]
[2020-06-20 09:35:27,577] [   TRAIN] - step 320 / 364: loss=0.81250 acc=0.81250 [step/sec: 3.51]
[2020-06-20 09:35:30,458] [   TRAIN] - step 330 / 364: loss=0.93750 acc=0.93750 [step/sec: 3.47]
[2020-06-20 09:35:33,320] [   TRAIN] - step 340 / 364: loss=0.86250 acc=0.86250 [step/sec: 3.49]
[2020-06-20 09:35:36,195] [   TRAIN] - step 350 / 364: loss=0.86250 acc=0.86250 [step/sec: 3.48]
[2020-06-20 09:35:39,043] [   TRAIN] - step 360 / 364: loss=0.87500 acc=0.87500 [step/sec: 3.51]
[2020-06-20 09:35:40,383] [    INFO] - Evaluation on dev dataset start
[2020-06-20 09:35:44,070] [    EVAL] - [dev dataset evaluation result] loss=0.92708 acc=0.92708 [step/sec: 13.17]
[2020-06-20 09:35:44,071] [    INFO] - Load the best model from cv_finetune_EfficientnetB0_2020-6-19-1\best_model
[2020-06-20 09:35:44,443] [    INFO] - Evaluation on test dataset start
[2020-06-20 09:35:48,072] [    EVAL] - [test dataset evaluation result] loss=0.92021 acc=0.92021 [step/sec: 13.14]
[2020-06-20 09:35:48,072] [    INFO] - Saving model checkpoint to cv_finetune_EfficientnetB0_2020-6-19-1\step_365
E:\Python\Python37-64\lib\site-packages\paddle\fluid\executor.py:1070: UserWarning: The following exception is not an EOF exception.
  "The following exception is not an EOF exception.")
Traceback (most recent call last):
  File "E:/Python/Pycharm/my work/AI_study/Learning_from_Github/04 paddlepaddle-learn/03 Paddle_hub/peach_class/my_finegtuning/Fine_tuning_efficientnetb0/finetuning.py", line 35, in <module>
    task.finetune_and_eval()
  File "E:\Python\Python37-64\lib\site-packages\paddlehub\finetune\task\base_task.py", line 868, in finetune_and_eval
    return self.finetune(do_eval=True)
  File "E:\Python\Python37-64\lib\site-packages\paddlehub\finetune\task\base_task.py", line 901, in finetune
    self.save_checkpoint()
  File "E:\Python\Python37-64\lib\site-packages\paddlehub\finetune\task\base_task.py", line 821, in save_checkpoint
    self.exe, dirname=model_saved_dir, main_program=self.main_program)
  File "E:\Python\Python37-64\lib\site-packages\paddle\fluid\io.py", line 647, in save_persistables
    filename=filename)
  File "E:\Python\Python37-64\lib\site-packages\paddle\fluid\io.py", line 301, in save_vars
    filename=filename)
  File "E:\Python\Python37-64\lib\site-packages\paddle\fluid\io.py", line 356, in save_vars
    executor.run(save_program)
  File "E:\Python\Python37-64\lib\site-packages\paddle\fluid\executor.py", line 1071, in run
    six.reraise(*sys.exc_info())
  File "E:\Python\Python37-64\lib\site-packages\six.py", line 703, in reraise
    raise value
  File "E:\Python\Python37-64\lib\site-packages\paddle\fluid\executor.py", line 1066, in run
    return_merged=return_merged)
  File "E:\Python\Python37-64\lib\site-packages\paddle\fluid\executor.py", line 1154, in _run_impl
    use_program_cache=use_program_cache)
  File "E:\Python\Python37-64\lib\site-packages\paddle\fluid\executor.py", line 1229, in _run_program
    fetch_var_name)
paddle.fluid.core_avx.EnforceNotMet: 

--------------------------------------------
C++ Call Stacks (More useful to developers):
--------------------------------------------
Windows not support stack backtrace yet.

------------------------------------------
Python Call Stacks (More useful to users):
------------------------------------------
  File "E:\Python\Python37-64\lib\site-packages\paddle\fluid\framework.py", line 2610, in append_op
    attrs=kwargs.get("attrs", None))
  File "E:\Python\Python37-64\lib\site-packages\paddle\fluid\io.py", line 327, in save_vars
    attrs={'file_path': os.path.normpath(save_file_path)})
  File "E:\Python\Python37-64\lib\site-packages\paddle\fluid\io.py", line 301, in save_vars
    filename=filename)
  File "E:\Python\Python37-64\lib\site-packages\paddle\fluid\io.py", line 647, in save_persistables
    filename=filename)
  File "E:\Python\Python37-64\lib\site-packages\paddlehub\finetune\task\base_task.py", line 821, in save_checkpoint
    self.exe, dirname=model_saved_dir, main_program=self.main_program)
  File "E:\Python\Python37-64\lib\site-packages\paddlehub\finetune\task\base_task.py", line 901, in finetune
    self.save_checkpoint()
  File "E:\Python\Python37-64\lib\site-packages\paddlehub\finetune\task\base_task.py", line 868, in finetune_and_eval
    return self.finetune(do_eval=True)
  File "E:/Python/Pycharm/my work/AI_study/Learning_from_Github/04 paddlepaddle-learn/03 Paddle_hub/peach_class/my_finegtuning/Fine_tuning_efficientnetb0/finetuning.py", line 35, in <module>
    task.finetune_and_eval()

----------------------
Error Message Summary:
----------------------
UnavailableError: Cannot open cv_finetune_EfficientnetB0_2020-6-19-1\step_365\@HUB_efficientnetb0_imagenet@_blocks.0._bn1_offset_beta1_pow_acc_0 to save variables.
  [Hint: Expected static_cast<bool>(fout) == true, but received static_cast<bool>(fout):0 != true:1.] at (D:/1.8.1/paddle\paddle/fluid/operators/save_op.h:85)
  [operator < save > error]

Process finished with exit code 1
指派人
分配到
无
里程碑
无
分配里程碑
工时统计
无
截止日期
无
标识: paddlepaddle/PaddleHub#706
渝ICP备2023009037号

京公网安备11010502055752号

网络110报警服务 Powered by GitLab CE v13.7
开源知识
Git 入门 Pro Git 电子书 在线学 Git
Markdown 基础入门 IT 技术知识开源图谱
帮助
使用手册 反馈建议 博客
《GitCode 隐私声明》 《GitCode 服务条款》 关于GitCode
Powered by GitLab CE v13.7