-
Notifications
You must be signed in to change notification settings - Fork 15
/
__init__.py
43 lines (29 loc) · 1.11 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import logging
from logging import NullHandler
import tensorflow as tf
from .config import Config
logging.getLogger(__name__).addHandler(NullHandler())
__version__ = '0.4'
CONFIG = None
# reduce tensorflow logger verbosity, ignore DEBUG and INFO
tf.logging.set_verbosity(tf.logging.WARN)
def read_config():
if CONFIG is None:
raise ValueError('Configuration has not been set')
return CONFIG
def set_config(path_to_config):
"""Set configuration settings
This function lets the user configure global settings used
trhoughout the execution of the pipeline. The variables set here
determine the behavior of some steps. For that reason once, the values
are set, they cannot be changed, to avoid changing global configuration
changes at runtime
"""
# this variable is accesible in the preprocessa and process blocks to avoid
# having to pass the configuration over and over, to prevent global state
# issues, the config cannot be edited after loaded
global CONFIG
CONFIG = Config.from_yaml(path_to_config)
def reset_config():
global CONFIG
CONFIG = None