Skip to content

Commit

Permalink
use GE backend for graph mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash-Lee233 committed Jun 17, 2024
1 parent 8f060e9 commit 0396912
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions demo/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def get_parser_infer(parents=None):
def set_default_infer(args):
# Set Context
context.set_context(mode=args.ms_mode, device_target=args.device_target, max_call_depth=2000)
if args.mode == 0:
ms.set_context(jit_config={"jit_level": "O2"})
if args.device_target == "Ascend":
context.set_context(device_id=int(os.getenv("DEVICE_ID", 0)))
elif args.device_target == "GPU" and args.ms_enable_graph_kernel:
Expand Down
2 changes: 2 additions & 0 deletions mindyolo/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def set_seed(seed=2):
def set_default(args):
# Set Context
context.set_context(mode=args.ms_mode, device_target=args.device_target, max_call_depth=2000)
if args.mode == 0:
ms.set_context(jit_config={"jit_level": "O2"})
if args.device_target == "Ascend":
device_id = int(os.getenv("DEVICE_ID", 0))
context.set_context(device_id=device_id)
Expand Down
2 changes: 2 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def get_parser_test(parents=None):
def set_default_test(args):
# Set Context
context.set_context(mode=args.ms_mode, device_target=args.device_target, max_call_depth=2000)
if args.mode == 0:
ms.set_context(jit_config={"jit_level": "O2"})
if args.device_target == "Ascend":
context.set_context(device_id=int(os.getenv("DEVICE_ID", 0)))
elif args.device_target == "GPU" and args.ms_enable_graph_kernel:
Expand Down

0 comments on commit 0396912

Please sign in to comment.