commit | 8ca7820e4531e61b3d381d5eddf43c4969ba0c7d | [log] [tgz] |
---|---|---|
author | Yanbo Liang <ybliang8@gmail.com> | Tue Oct 18 03:46:01 2022 +0000 |
committer | PyTorch MergeBot <pytorchmergebot@users.noreply.github.com> | Tue Oct 18 03:46:01 2022 +0000 |
tree | eab6306c1a2e31266d2fc025649248299fed75e4 | |
parent | acaf484f0a38f6a7becf342bb3492e1de09f64e1 [diff] |
[Inductor] Lift the maximum depth of the Python interpreter stack to adapt large/deep models (#87130) Partly fixes https://github.com/pytorch/torchdynamo/issues/1693 Pull Request resolved: https://github.com/pytorch/pytorch/pull/87130 Approved by: https://github.com/jansel
diff --git a/torch/_inductor/compile_fx.py b/torch/_inductor/compile_fx.py index 46224d7..2243f82 100644 --- a/torch/_inductor/compile_fx.py +++ b/torch/_inductor/compile_fx.py
@@ -2,6 +2,7 @@ import functools import itertools import logging +import sys from typing import List import functorch @@ -89,6 +90,10 @@ if dynamo_utils.count_calls(gm.graph) == 0: return make_boxed_func(gm.forward) + # lift the maximum depth of the Python interpreter stack + # to adapt large/deep models + sys.setrecursionlimit(max(sys.getrecursionlimit(), 2000)) + _step_logger()( logging.INFO, "torchinductor compiling "