Skip to content

Commit 1b18982

Browse files
committed
cleanup code
Signed-off-by: Ceng23333 <441651826@qq.com>
1 parent df193c9 commit 1b18982

1 file changed

Lines changed: 5 additions & 23 deletions

File tree

python/infinilm/infer_engine.py

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,6 @@ def is_oom_exception(e: BaseException) -> bool:
7070
return False
7171

7272

73-
def _env_truthy(name: str) -> bool:
74-
v = os.environ.get(name, "")
75-
return v not in ("", "0", "false", "False", "no", "NO")
76-
77-
78-
def _best_effort_flush_logs() -> None:
79-
root = logging.getLogger()
80-
for h in list(root.handlers):
81-
try:
82-
h.flush()
83-
except Exception:
84-
pass
85-
86-
8773
@dataclass
8874
class GenerationConfig:
8975
max_new_tokens: int | None = None
@@ -187,15 +173,11 @@ def forward(
187173
)
188174
except BaseException as e:
189175
if is_oom_exception(e):
190-
try:
191-
logger.error(
192-
"OOM-like exception: exiting worker with code 137: %r",
193-
e,
194-
exc_info=False,
195-
)
196-
except Exception:
197-
pass
198-
_best_effort_flush_logs()
176+
logger.error(
177+
"OOM-like exception: exiting worker with code 137: %r",
178+
e,
179+
exc_info=False,
180+
)
199181
os._exit(137)
200182
raise
201183

0 commit comments

Comments
 (0)