首页 > 其他分享 >MindSpore开发静态图调试记录

MindSpore开发静态图调试记录

时间:2023-04-07 15:57:13浏览次数:48  
标签:MindSpore 静态 self py envs conda 调试 file mindspore

主要参考资料

静态图语法支持 - MindSpore master documentation

定位错误:报错会生成rank_0/om/analyze_fail.dat文件,按instruction定位即可

# 1.This file shows the parsed IR info when graph evaluating failed to help find the problem.
# 2.You can search the last `------------------------>` to the node which is inferred failed.
# 3.Refer to https://www.mindspore.cn/search?inputValue=analyze_fail.dat to get more instructions.
# ===============================================================================

1. 不支持对sequentialcell进行for循环(遍历)

Traceback (most recent call last):
  File "mytest.py", line 18, in <module>
    print(test().shape)
  File "mytest.py", line 14, in test
    y = model(dummy_input)
  File ".conda/envs/mindspore/lib/python3.7/site-packages/mindspore/nn/cell.py", line 578, in __call__
    out = self.compile_and_run(*args)
  File ".conda/envs/mindspore/lib/python3.7/site-packages/mindspore/nn/cell.py", line 965, in compile_and_run
    self.compile(*inputs)
  File ".conda/envs/mindspore/lib/python3.7/site-packages/mindspore/nn/cell.py", line 938, in compile
    jit_config_dict=self._jit_config_dict)
  File ".conda/envs/mindspore/lib/python3.7/site-packages/mindspore/common/api.py", line 1137, in compile
    result = self._graph_executor.compile(obj, args_list, phase, self._use_vm_mode())
RuntimeError: MindSpore not support to get attribute '__len__' of a type[Func]

----------------------------------------------------
- The Traceback of Net Construct Code:
----------------------------------------------------
The function call stack (See file '/rank_0/om/analyze_fail.dat' for more details. Get instructions about `analyze_fail.dat` at https://www.mindspore.cn/search?inputValue=analyze_fail.dat):
# 0 In file /models/mobilevit.py(594)
        x = self.layer_3(x)
            ^
# 1 In file .conda/envs/mindspore/lib/python3.7/site-packages/mindspore/nn/layer/container.py(275)
        for cell in self.cell_list:
# 2 In file .conda/envs/mindspore/lib/python3.7/site-packages/mindspore/nn/layer/container.py(276)
            input_data = cell(input_data)
                         ^
# 3 In file /models/mobilevit.py(448)
        for transformer_layer in self.global_rep:
        ^
# 4 In file .conda/envs/mindspore/lib/python3.7/site-packages/mindspore/_extends/parse/standard_method.py(1739)
    return data.__len__()
           ^

----------------------------------------------------
- C++ Call Stack: (For framework developers)
----------------------------------------------------
mindspore/ccsrc/pipeline/jit/static_analysis/prim.cc:1425 GetEvaluatedValueForBuiltinTypeAttrOrMethod

提示信息global_rep类型为func,for循环无法获取它的__len__属性,把global_rep从nn.sequentialcell改为nn.CellList。

2. 不支持对非常量进行强类型转换

Traceback (most recent call last):
  File "mytest.py", line 18, in <module>
    print(test().shape)
  File "mytest.py", line 14, in test
    y = model(dummy_input)
  File ".conda/envs/mindspore/lib/python3.7/site-packages/mindspore/nn/cell.py", line 578, in __call__
    out = self.compile_and_run(*args)
  File ".conda/envs/mindspore/lib/python3.7/site-packages/mindspore/nn/cell.py", line 965, in compile_and_run
    self.compile(*inputs)
  File ".conda/envs/mindspore/lib/python3.7/site-packages/mindspore/nn/cell.py", line 938, in compile
    jit_config_dict=self._jit_config_dict)
  File ".conda/envs/mindspore/lib/python3.7/site-packages/mindspore/common/api.py", line 1137, in compile
    result = self._graph_executor.compile(obj, args_list, phase, self._use_vm_mode())
ValueError: When using JIT Fallback to handle script 'int(H_end[idx_H].asnumpy())', the inputs should be constant, but found variable 'H_end' to be nonconstant.

----------------------------------------------------
- The Traceback of Net Construct Code:
----------------------------------------------------
The function call stack (See file '/rank_0/om/analyze_fail.dat' for more details. Get instructions about `analyze_fail.dat` at https://www.mindspore.cn/search?inputValue=analyze_fail.dat):
# 0 In file /models/mobilevit.py(599)
        x = self.classifier(x)
            ^
# 1 In file .conda/envs/mindspore/lib/python3.7/site-packages/mindspore/nn/layer/container.py(275)
        for cell in self.cell_list:
# 2 In file .conda/envs/mindspore/lib/python3.7/site-packages/mindspore/nn/layer/container.py(276)
            input_data = cell(input_data)
                         ^
# 3 In file /models/adaptive_avgpool2d.py(48)
        x = self.adaptive_avgpool2d(x)
            ^
# 4 In file /models/adaptive_avgpool2d.py(23)
        for idx_H in range(H):
# 5 In file /models/adaptive_avgpool2d.py(25)
            for idx_W in range(W):
# 6 In file /models/adaptive_avgpool2d.py(31)
                h_e = int(H_end[idx_H].asnumpy())
                      ^

----------------------------------------------------
- C++ Call Stack: (For framework developers)
----------------------------------------------------
mindspore/ccsrc/pipeline/jit/static_analysis/prim.cc:1936 CheckInterpretInput

标签:MindSpore,静态,self,py,envs,conda,调试,file,mindspore
From: https://www.cnblogs.com/rthete/p/17296423.html

相关文章

  • java基础——静态代理和动态代理
    java代理模式有静态代理和动态代理两种实现方式一、静态代理代理模式可以在不修改被代理对象的基础上,通过扩展代理类,进行一些功能的附加与增强。代理类和被代理类应该共同实现一个接口,或者是共同继承某个类。优点:可以在不修改目标对象的前提下扩展目标对象的功能......
  • c++之静态库与动态库
    一.代码分发方式代码分发方式有三种: 二.动态库与静态库区别三.C/C++到可执行程序的过程:四总结首先清楚,一般来说源码包含.h+.cpp两个文件,而静态库包含.h+.lib文件,动态库包含.h+.lib+.dll,明显动态库要比静态库的文件要更零散一点;其次,要知道.h/.lib/.dll分别起到什么作用,......
  • matlab连续潮流程序绘制PV曲线 静态电压稳定 该程序为连续潮流IEEE14节点和33节点的程
    matlab连续潮流程序绘制PV曲线静态电压稳定该程序为连续潮流IEEE14节点和33节点的程序运行出来有分岔点和鼻点可移植性强,注释详细YID:53120676973227785......
  • 实验八 静态路由
    实验八 静态路由实验目的:理解路由器的工作原理理解静态路由掌握静态路由的配置实验拓扑计算机IP地址及网关地址:PC1:192.168.1.1/24GW:192.168.1.254PC2:192.168.2.1/24GW:192.168.2.254路由器AR1接口的IP地址:G0/0/0:192.168.1.254/24G0/0/1:192.168.3.1/24路由器AR2接......
  • WinDbg调试Dump转储文件及程序崩溃时自动创建转储文件的方式
    通过WinDbg分析转储文件在调试过程中回遇到一些很奇怪的问题,编译器调试无法正常定位问题,所以需要WinDbg,这篇博客是对照多篇文档的简易的入门整理一、必备知识1.1、下载WinDbg微软文档下载Windows调试工具-WinDbg-Windowsdrivers|MicrosoftLearnWinDbgPreview是......
  • # Java笔记(12) 静态代理
    静态代理可以在不改变原有代码的情况下,增加新的功能和操作,对原有对象进行扩展。静态代理要求真实对象和代理对象都实现同一个接口,由代理对象代理真实角色的接口实现,并在实现前后增加新的操作。publicclassStaticProxy{publicstaticvoidmain(String[]args){Person......
  • 力士乐驱动调试软件13v16版本,中文版本的
    力士乐驱动调试软件13v16版本,中文版本的,用这个调试过项目,配套还有好多手册YID:5189656708457614......
  • 迅达扶梯软件 FCOM4 5 6对迅达扶梯进行调试,监控,数据读取
    迅达扶梯软件FCOM4 5 6对迅达扶梯进行调试,监控,数据读取YID:3199667155554379......
  • WebView 调试方法
    使用 remotedebug-ios-webkit-adapter 工具GitHub地址:https://github.com/RemoteDebug/remotedebug-ios-webkit-adapter安装之后-----浏览器输入:chrome://inspect注:打开该页面有时候需要连接vpn,该页面可以设置端口,与下个步骤的端口要一致下一步,命令行输入:remotedebug_ios_webkit......
  • 性能工具之Jmeter一个脚本的编写与调试案例
     引言最近接到一个任务,需要写一个Jmeter脚本,脚本需要“登录”后从返回值获取Cookies,然后从第一个接口的返回参数中提取有用的id,在第二个接口请求的时候使用这个id,从而完成测试。然而这个看似简单的测试用例的编写并不是很容易,还经历了一些有趣的调试。第一个问题开始,完成了登录接......