"research/lexnet_nc/learn_classifier.py" did not exist on "5798262bc1be122cd23d7728ebb60baa7be33584"
info.py 1.11 KB
Newer Older
1
# Copyright (c) OpenMMLab. All rights reserved.
2
import os
3
import warnings
4

pc's avatar
pc committed
5
6
import torch

7

8
def is_custom_op_loaded() -> bool:
9
10
11
12
13
14
15
16
17
18
19
20
21

    # Following strings of text style are from colorama package
    bright_style, reset_style = '\x1b[1m', '\x1b[0m'
    red_text, blue_text = '\x1b[31m', '\x1b[34m'
    white_background = '\x1b[107m'

    msg = white_background + bright_style + red_text
    msg += 'DeprecationWarning: This function will be deprecated in future. '
    msg += blue_text + 'Welcome to use the unified model deployment toolbox '
    msg += 'MMDeploy: https://github.com/open-mmlab/mmdeploy'
    msg += reset_style
    warnings.warn(msg)

22
23
24
25
26
27
28
29
30
31
32
33
34
    flag = False
    try:
        from ..tensorrt import is_tensorrt_plugin_loaded
        flag = is_tensorrt_plugin_loaded()
    except (ImportError, ModuleNotFoundError):
        pass
    if not flag:
        try:
            from ..ops import get_onnxruntime_op_path
            ort_lib_path = get_onnxruntime_op_path()
            flag = os.path.exists(ort_lib_path)
        except (ImportError, ModuleNotFoundError):
            pass
pc's avatar
pc committed
35
    return flag or torch.__version__ == 'parrots'