Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
Fix some error in fcn_uhrnetw (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
0x45f authored Jul 5, 2023
1 parent 605fa46 commit b253acc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
11 changes: 6 additions & 5 deletions sot/opcode_translator/executor/opcode_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def __init__(self, code: types.CodeType, graph: FunctionGraph):
self._code = code
self._instructions = get_instructions(self._code)
self._graph = graph
self._current_line: int | None = None
self._current_line: int = -1
self.new_code: types.CodeType | None = None
self.guard_fn = None
self._name = "Executor"
Expand Down Expand Up @@ -527,15 +527,16 @@ def error_message_summary(original_error: Exception) -> str:
message_lines = ["In simulate execution:", ""]
for current_simulator in OpcodeExecutorBase.call_stack:
code = current_simulator._code
current_line = current_simulator._current_line or 0
current_line = current_simulator._current_line
lines, start = inspect.getsourcelines(code)
real_name = code.co_name
message_lines.append(
f"{indent} File \"{code.co_filename}\", line {current_line}, in {real_name}"
)
message_lines.append(
f"{indent} {lines[current_line-start].rstrip()}"
)
if current_line != -1:
message_lines.append(
f"{indent} {lines[current_line-start].rstrip()}"
)
error_message = traceback.format_exception_only(
type(original_error), original_error
)
Expand Down
4 changes: 2 additions & 2 deletions sot/opcode_translator/executor/side_effects.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def get_proxy(

def get_state(self):
return SideEffectsState(
self.data_id_to_proxy,
self.variables,
self.data_id_to_proxy.copy(),
self.variables.copy(),
[proxy.version for proxy in self.data_id_to_proxy.values()],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def calc_offset_from_bytecode_offset(bytecode_offset: int) -> int:

def replace_instr(instructions, instr, new_instr):
idx = instructions.index(instr)
instructions[idx, idx + 1] = new_instr
instructions[idx : idx + 1] = new_instr


def instrs_info(instrs, mark=None):
Expand Down
2 changes: 2 additions & 0 deletions tests/run_all_paddle_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ disabled_tests=(
# Because range interrupts networking, Paddle.grad cannot be networked as a standalone API.
# CAN BE OPEN AFTER: range is support.
${PADDLE_TEST_BASE}/test_grad.py
${PADDLE_TEST_BASE}/test_ptb_lm.py # There is accuracy problem of the model in SOT
${PADDLE_TEST_BASE}/test_ptb_lm_v2.py # There is accuracy problem of the model in SOT
)

for file in ${PADDLE_TEST_BASE}/*.py; do
Expand Down

0 comments on commit b253acc

Please sign in to comment.