2.4K Star 8.2K Fork 4.4K

GVPMindSpore / mindspore

 / 详情

load_checkpoint不支持加载 UInt8类型数据

DONE
Bug-Report
创建于  
2021-11-08 11:57
name about labels
Bug Report Use this template for reporting a bug kind/bug

Environment

  • Hardware Environment(Ascend/GPU/CPU):
    -- GPU

  • Software Environment:
    -- MindSpore version (source or binary): 1.5.1
    -- Python version (e.g., Python 3.7.5): 3.7.6
    -- OS platform and distribution (e.g., Linux Ubuntu 16.04):
    -- GCC/Compiler version (if compiled from source): None

Related testcase

import numpy as np
import mindspore
from mindspore import Tensor, save_checkpoint, load_checkpoint

if __name__ == "__main__":
    data = Tensor(np.random.uniform(0, 255, (1, 2)), mindspore.uint8)
    save_obj = [{
        "name": "test_data",
        "data": data
    }]

    test_save_path = "test_save_load.ckpt"
    save_checkpoint(save_obj, test_save_path)

    param_dict = load_checkpoint(test_save_path)
    print(param_dict["test_data"].dtype)

Steps to reproduce the issue

  1. Save data with dtype mindspore.uint8 to checkpoint file.
  2. Load saved checkpoint file.

Describe the current behavior

Failed to load the checkpoint file.

Describe the expected behavior

Success to Load checkpoint file, and printUInt8.

Related log / screenshot

[ERROR] ME(38583:139942186227520,MainProcess):2021-11-08-12:08:58.359.733 [mindspore/train/serialization.py:467] Failed to load the checkpoint file `XXX/test_save_load.ckpt`.
Traceback (most recent call last):
  File "XXX/mindspore/train/serialization.py", line 440, in load_checkpoint
    np_type = tensor_to_np_type[data_type]
KeyError: 'UInt8'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "XXX/test_save_load_ckpt.py", line 15, in <module>
    param_dict = load_checkpoint(test_save_path)
  File "XXX/mindspore/train/serialization.py", line 468, in load_checkpoint
    raise RuntimeError(e.__str__())
RuntimeError: 'UInt8'

Special notes for this issue

NA

评论 (2)

moran 创建了Bug-Report
moran 添加了
 
usability
标签
ms_yan 负责人设置为changzherui
ms_yan 关联项目设置为MindSpore Bug Tracking System
ms_yan 里程碑设置为B-SIG-FrontEnd
ms_yan 优先级设置为主要
ms_yan 添加了
 
stage/func-debug
标签
ms_yan 添加了
 
attr/function
标签
ms_yan 添加了func/load-save-model(已删除)标签
ms_yan 添加了
 
sig/frontend
标签
展开全部操作日志

@changzherui 帮看看这个问题,为什么当前没支持来着,支持难度大么

changzherui 任务状态TODO 修改为ACCEPTED
changzherui 计划开始日期设置为2021-11-10
changzherui 计划截止日期设置为2021-11-11

Appearance & Root Cause

加载ckpt时类型转换错误

Fix Solution

修改类型转换map
pr:!26033:modify ckpt convert type

changzherui 添加协作者changzherui
changzherui 负责人changzherui 修改为moran
moran 任务状态ACCEPTED 修改为DONE
moran 移除了func/load-save-model(已删除)标签

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(3)
7347217 changzherui 1584948547
Python
1
https://gitee.com/mindspore/mindspore.git
git@gitee.com:mindspore/mindspore.git
mindspore
mindspore
mindspore

搜索帮助

344bd9b3 5694891 D2dac590 5694891