Esempio n. 1
0
def load_framework_support(vars=globals()):
    # load framework-specific backends
    # -- note we do this here to ensure this happens after config updates
    if OMEGA_DISABLE_FRAMEWORKS:
        return
    if 'tensorflow' in vars['OMEGA_FRAMEWORKS'] and tensorflow_available():
        #: tensorflow backend
        # https://stackoverflow.com/a/38645250
        os.environ['TF_CPP_MIN_LOG_LEVEL'] = os.environ.get(
            'TF_CPP_MIN_LOG_LEVEL') or '3'
        logging.getLogger('tensorflow').setLevel(logging.ERROR)
        vars['OMEGA_STORE_BACKENDS'].update(
            vars['OMEGA_STORE_BACKENDS_TENSORFLOW'])
    #: keras backend
    if 'keras' in vars['OMEGA_FRAMEWORKS'] and keras_available():
        vars['OMEGA_STORE_BACKENDS'].update(vars['OMEGA_STORE_BACKENDS_KERAS'])
    #: sqlalchemy backend
    if module_available('sqlalchemy'):
        vars['OMEGA_STORE_BACKENDS'].update(vars['OMEGA_STORE_BACKENDS_SQL'])
    #: dash backend
    if 'dash' in OMEGA_FRAMEWORKS and module_available('dashserve'):
        vars['OMEGA_STORE_BACKENDS'].update(vars['OMEGA_STORE_BACKENDS_DASH'])
    #: r environment
    if shutil.which('R') is not None:
        vars['OMEGA_STORE_BACKENDS'].update(vars['OMEGA_STORE_BACKENDS_R'])
    #: mlflow backends
    if module_available('mlflow'):
        vars['OMEGA_STORE_BACKENDS'].update(
            vars['OMEGA_STORE_BACKENDS_MLFLOW'])
Esempio n. 2
0
    OMEGA_RESTAPI_URL = ''
    logging.getLogger().setLevel(logging.ERROR)
else:
    # overrides in actual operations
    OMEGA_CONFIG_FILE = locate_config_file()
    update_from_config(globals(), config_file=OMEGA_CONFIG_FILE)
    update_from_env(globals())

    if is_cli_run:
        # be les
        import warnings

        warnings.filterwarnings("ignore", category=FutureWarning)

# load framework-specific backends
# -- note we do this here to ensure this happens after config updates
if 'tensorflow' in OMEGA_FRAMEWORKS and tensorflow_available():
    #: tensorflow backend
    # https://stackoverflow.com/a/38645250
    os.environ['TF_CPP_MIN_LOG_LEVEL'] = os.environ.get(
        'TF_CPP_MIN_LOG_LEVEL') or '3'
    logging.getLogger('tensorflow').setLevel(logging.ERROR)
    OMEGA_STORE_BACKENDS.update(OMEGA_STORE_BACKENDS_TENSORFLOW)
#: keras backend
if 'keras' in OMEGA_FRAMEWORKS and keras_available():
    OMEGA_STORE_BACKENDS.update(OMEGA_STORE_BACKENDS_KERAS)

# load user extensions if any
if OMEGA_USER_EXTENSIONS is not None:
    load_user_extensions(OMEGA_USER_EXTENSIONS)
Esempio n. 3
0
#: celery task packages
OMEGA_CELERY_IMPORTS = ['omegaml.tasks', 'omegaml.notebook.tasks']
#: storage backends
OMEGA_STORE_BACKENDS = {
    'sklearn.joblib': 'omegaml.backends.ScikitLearnBackend',
    'ndarray.bin': 'omegaml.backends.npndarray.NumpyNDArrayBackend',
    'virtualobj.dill': 'omegaml.backends.virtualobj.VirtualObjectBackend',
    'pandas.rawdict': 'omegaml.backends.rawdict.PandasRawDictBackend',
    'python.file': 'omegaml.backends.rawfiles.PythonRawFileBackend',
}

#: tensorflow backend
# https://stackoverflow.com/a/38645250
os.environ['TF_CPP_MIN_LOG_LEVEL'] = os.environ.get('TF_CPP_MIN_LOG_LEVEL') or '3'
logging.getLogger('tensorflow').setLevel(logging.ERROR)
if tensorflow_available():
    OMEGA_STORE_BACKENDS.update({
        'tfkeras.h5': 'omegaml.backends.tensorflow.TensorflowKerasBackend',
        'tfkeras.savedmodel': 'omegaml.backends.tensorflow.TensorflowKerasSavedModelBackend',
        'tf.savedmodel': 'omegaml.backends.tensorflow.TensorflowSavedModelBackend',
        'tfestimator.model': 'omegaml.backends.tensorflow.TFEstimatorModelBackend',
    })
#: keras backend
if keras_available():
    OMEGA_STORE_BACKENDS.update({
        'keras.h5': 'omegaml.backends.keras.KerasBackend',
    })

#: storage mixins
OMEGA_STORE_MIXINS = [
    'omegaml.mixins.store.ProjectedMixin',