Skip to content

set jit_level to O2 under graph mode #705

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

Merged
merged 1 commit into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tools/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from addict import Dict

import mindspore as ms
from mindspore._c_expression import ms_ctx_param
from mindspore.communication import get_group_size, get_rank, init

from mindocr.data import build_dataset
Expand All @@ -27,6 +28,10 @@
def main(cfg):
# env init
ms.set_context(mode=cfg.system.mode)
if "jit_level" in ms_ctx_param.__members__ and cfg.system.mode == 0:
# set jit_level to O2 for better pereformance under graph mode
ms.set_context(jit_config={"jit_level": "O2"})

if cfg.system.distribute:
init()
device_num = get_group_size()
Expand Down
5 changes: 5 additions & 0 deletions tools/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from addict import Dict

import mindspore as ms
from mindspore._c_expression import ms_ctx_param
from mindspore.communication import get_group_size, get_rank, init

from mindocr.data import build_dataset
Expand All @@ -41,6 +42,10 @@
def main(cfg):
# init env
ms.set_context(mode=cfg.system.mode)
if "jit_level" in ms_ctx_param.__members__ and cfg.system.mode == 0:
# set jit_level to O2 for better pereformance under graph mode
ms.set_context(jit_config={"jit_level": "O2"})

if cfg.system.distribute:
init()
device_num = get_group_size()
Expand Down
Loading