2.3K Star 8.1K Fork 4.3K

GVPMindSpore / mindspore

 / 详情

[CT][MS][doc]convert_to_thor_model and thor api example test fail at gpu

DONE
Bug-Report
创建于  
2021-07-09 17:05

Environment

  • Hardware Environment(Ascend/GPU/CPU):

Uncomment only one /device <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/device gpu

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

Related testcase

Steps to reproduce the issue

  1. open link, https://www.mindspore.cn/doc/api_python/zh-CN/master/mindspore/nn/mindspore.nn.thor.html?highlight=thor#mindspore.nn.thor
  2. open link, https://www.mindspore.cn/doc/api_python/zh-CN/master/mindspore/mindspore.train.html?highlight=convert_to_thor_model#mindspore.train.train_thor.ConvertModelUtils.convert_to_thor_model
  3. 执行以上两个接口里的样例

Describe the current behavior

两个样例全部执行失败
1.lr, model等没有定义


    def test_thor():
        from mindspore.nn.optim import thor
        from mindspore.train.model import Model
        from mindspore.train.loss_scale_manager import FixedLossScaleManager
        from mindspore.train.callback import LossMonitor, TimeMonitor

        net = Net()
>       optim = thor(net, lr=Tensor(1e-3), damping=Tensor(1e-3), momentum=0.9)
E       TypeError: thor() got an unexpected keyword argument 'lr'

lr, damping, loss没有定义

    def test_convert_to_thor_model():
        from mindspore.nn.optim import thor
        from mindspore.train.model import Model
        from mindspore.train.loss_scale_manager import FixedLossScaleManager

        net = Net()
        loss_manager = FixedLossScaleManager(128, drop_overflow_update=False)
>       opt = thor(net, lr, damping, momentum=0.9, weight_decay=1e-4, loss_scale=128, batch_size=32,
                   frequency=100)
E       NameError: name 'lr' is not defined

Describe the expected behavior

样例执行pass

Related log / screenshot

Special notes for this issue

评论 (4)

caoruyue1 创建了Bug-Report
caoruyue1 计划截止日期设置为2021-12-31
caoruyue1 关联仓库设置为MindSpore/mindspore
caoruyue1 负责人设置为wangshuangling
caoruyue1 里程碑设置为B-MBA
caoruyue1 计划开始日期设置为2021-07-09
caoruyue1 优先级设置为次要
caoruyue1 添加了
 
kind/bug
标签
caoruyue1 添加了comp/doc(已删除)标签
展开全部操作日志

Please add labels (comp or sig), also you can visit "https://gitee.com/mindspore/community/blob/master/sigs/dx/docs/labels.md" to find more.
为了让问题更快得到响应,请您为该issue打上**组件(comp)或兴趣组(sig)**标签,打上标签的问题可以直接推送给责任人进行处理。更多的标签可以查看 https://gitee.com/mindspore/community/blob/master/sigs/dx/docs/labels.md"
以组件问题为例,如果你发现问题是data组件造成的,你可以这样评论:
//comp/data
当然你也可以向data SIG组求助,可以这样写:
//comp/data
//sig/data
如果是一个简单的问题,你可以留给刚进入社区的小伙伴来回答,这时候你可以这样写:
//good-first-issue
恭喜你,你已经学会了使用命令来打标签,接下来就在下面的评论里打上标签吧!

Ascend上也有此问题

hello, @caoruyue1 , Has this problem been resolved? If it is in progress, please change the status to WIP. If the issue was solved, please close this issue, thanks!
你好, @caoruyue1 , 这个问题是否已经解决了呢? 如果正在进行中,请把issue状态设置为WIP;如果问题已解决,请关闭这个issue, 谢谢!

caoruyue1 添加了
 
v1.5.0
标签
TingWang 计划截止日期2021-12-31 修改为2021-10-30
wangshuangling 通过mindspore/mindspore Pull Request !24923任务状态TODO 修改为DONE
wangshuangling 任务状态DONE 修改为VALIDATION
wangshuangling 负责人wangshuangling 修改为caoruyue1
wangshuangling 里程碑B-MBA 修改为B-SolutionTest

Appearance & Root Cause

API注释示例中,部分变量未定义,直接使用。

Fix Solution

1、针对thor和convert_to_thor_model接口,修改API注释中的示例
2、基于Ascend和GPU环境分别验证,示例代码均OK
(1) Ascend环境验证结果如下:
epoch: 1 step: 1, loss is 6.9077554
epoch: 1 step: 4, loss is 6.907139
(2) GPU环境验证结果如下:
epoch: 1 step: 1, loss is 6.9077554
epoch: 1 step: 4, loss is 6.907139
3、合入PR如下:
r1.5: !24923:fix thor api examples
Master: !24936:fix thor api examples for master

登录 后才可以发表评论

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

搜索帮助