CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
[SOT][Exception][3.10-] Add exception handler for Py3.10- #72559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
当前会挂的原因,Python3.8 没有 import dis
def try_except_exception_with_error(x):
# test `JUMP_IF_NOT_EXC_MATCH`
try:
raise ValueError("TESTING!")
except Exception:
pass
return x
dis.dis(try_except_exception_with_error) Py3.8 的行为: 8 >> 14 DUP_TOP
16 LOAD_GLOBAL 1 (Exception)
18 COMPARE_OP 10 (exception match)
20 POP_JUMP_IF_FALSE 32
22 POP_TOP
24 POP_TOP
26 POP_TOP Py3.9/Py3.10 的行为: 8 >> 10 DUP_TOP
12 LOAD_GLOBAL 1 (Exception)
14 JUMP_IF_NOT_EXC_MATCH ...
16 POP_TOP
18 POP_TOP
20 POP_TOP 需要对 ExceptionVariable 实现 COMPARE_OP 部分 |
|
目前 File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/variables/callable.py", line 280, in call_function
output = inline_executor.inline_call()
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/opcode_inline_executor.py", line 99, in inline_call
self.run()
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/opcode_executor.py", line 631, in run
is_stop = self.step(cur_instr)
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/opcode_executor.py", line 677, in step
return getattr(self, opname)(instr) # run single step.
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/opcode_executor.py", line 315, in wrapper
return call_fn(self, instr)
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/opcode_executor.py", line 933, in LOAD_ATTR
BuiltinVariable(
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/variables/callable.py", line 141, in __call__
return self.call_function(*args, **kwargs)
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/variables/callable.py", line 873, in call_function
return handler(*args, **kwargs)
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/variable_dispatch.py", line 590, in <lambda>
lambda var, name, default=None: var.getattr(
File "/workspace/paddle/build/python/paddle/jit/sot/opcode_translator/executor/variables/basic.py", line 1514, in getattr
raise HasNoAttributeError(
paddle.jit.sot.utils.exceptions.HasNoAttributeError: ObjectVariable SuperVariable(super(PolynomialDecay, ObjectVariable(<paddle.optimizer.lr.PolynomialDecay object at 0x7fe7c1e4c910>, object_717)), object_831) has no attribute last_epoch 定位到是 SuperVariable |
|
python/paddle/jit/sot/opcode_translator/executor/exception_stack.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -276,6 +278,8 @@ def call_function(self, /, *args, **kwargs) -> VariableBase: | |||
f"Inline Call: {inline_executor.vframe.code.co_name}, file {inline_executor.vframe.code.co_filename}, line {int(inline_executor.vframe.code.co_firstlineno)}" | |||
): | |||
output = inline_executor.inline_call() | |||
except (SotCapturedException, InnerError) as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: 将部分内部抛出的 InnerError
改为 SotCapturedException
另外这里的改动可能会导致部分模型挂掉,需要关注下
) | ||
|
||
|
||
class TestSuperSetattrGetattr(Dy2StTestBase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sot 单测为什么要继承 Dy2StTestBase
?目的是什么?
# ------ test SuperVariable setattr + getattr ------ | ||
class LrClassBase: | ||
def __init__(self, last_lr, last_epoch): | ||
self.last_lr = last_lr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setattr 是在这里做的吗?python 本身这里也是在 super object 上进行 setattr 么?
PR Category
Execute Infrastructure
PR Types
New features
Description
支持
Python3.10-
的SOT异常处理部分SETUP_FINALLY
、POP_BLOCK
、LOAD_ASSERTION_ERROR
、POP_EXCEPT
、RAISE_VARARGS
、JUMP_IF_NOT_EXC_MATCH
和RERAISE
的实现OpcodeExecutorBase.handle_exception
ExceptionVariable.__eq__
的 dispatch 机制 +operator_exception_match
的 dispatch 机制NOTE:
PCard-66972