Skip to content

Commit

Permalink
Fixing preparation for sensenet
Browse files Browse the repository at this point in the history
  • Loading branch information
mmerce committed Oct 3, 2024
1 parent d2ecb57 commit 1d54070
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
9 changes: 3 additions & 6 deletions bigml/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
from bigml.fields import Fields, sorted_headers, get_new_fields
from bigml.api import get_api_connection, get_dataset_id, get_status
from bigml.basemodel import get_resource_dict
from bigml.util import DEFAULT_LOCALE, use_cache, cast, load, dump, dumps
from bigml.util import DEFAULT_LOCALE, use_cache, cast, load, dump, dumps, \
sensenet_logging
from bigml.constants import FINISHED
from bigml.flatline import Flatline
from bigml.featurizer import Featurizer
Expand All @@ -40,11 +41,7 @@
#pylint: disable=locally-disabled,bare-except,ungrouped-imports
try:
# bigml-sensenet should be installed for image processing
logging.disable(logging.WARNING)
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
tf.autograph.set_verbosity(0)
logging.getLogger("tensorflow").setLevel(logging.ERROR)
sensenet_logging()
import sensenet
from bigml.images.featurizers import ImageFeaturizer as Featurizer
except:
Expand Down
8 changes: 2 additions & 6 deletions bigml/deepnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from bigml.api import FINISHED
from bigml.api import get_status, get_api_connection, get_deepnet_id
from bigml.util import cast, use_cache, load, get_data_transformations, \
PRECISION
PRECISION, sensenet_logging
from bigml.basemodel import get_resource_dict, extract_objective
from bigml.modelfields import ModelFields
from bigml.laminar.constants import NUMERIC
Expand All @@ -62,11 +62,7 @@
import bigml.laminar.preprocess_np as pp

try:
logging.disable(logging.WARNING)
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
logging.getLogger("tensorflow").setLevel(logging.ERROR)
import tensorflow as tf
tf.autograph.set_verbosity(0)
sensenet_logging()
from sensenet.models.wrappers import create_model
from bigml.images.utils import to_relative_coordinates
from bigml.constants import IOU_REMOTE_SETTINGS
Expand Down
11 changes: 11 additions & 0 deletions bigml/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ def get_formatted_data(input_data_list, out_format=None):
inner_data_list = input_data_list.copy()
return inner_data_list


#pylint: disable=locally-disabled,import-outside-toplevel
def get_data_transformations(resource_id, parent_id):
"""Returns the pipeline that contains the tranformations and derived
Expand All @@ -760,3 +761,13 @@ def get_data_transformations(resource_id, parent_id):
"pipeline.")
from bigml.pipeline.pipeline import BMLPipeline
return BMLPipeline("dt-%s" % resource_id, [parent_id])


def sensenet_logging():
"""Removes warnings unnecessary logging when using sensenet"""
logging.disable(logging.WARNING)
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
os.environ["TF_USE_LEGACY_KERAS"] = "1"
import tensorflow as tf
tf.autograph.set_verbosity(0)
logging.getLogger("tensorflow").setLevel(logging.ERROR)

0 comments on commit 1d54070

Please sign in to comment.