From 491e95a376be7d7e7fe40ea9e0dbe30210396433 Mon Sep 17 00:00:00 2001 From: Benjamin Kiessling Date: Tue, 25 Jun 2024 10:43:31 +0200 Subject: [PATCH] Shut up coreml version incompatibility warnings We don't use any of the functionality they pertain to --- kraken/lib/layers.py | 8 ++++---- kraken/lib/vgsl.py | 9 +++++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/kraken/lib/layers.py b/kraken/lib/layers.py index a937fdd32..984c59996 100644 --- a/kraken/lib/layers.py +++ b/kraken/lib/layers.py @@ -10,11 +10,11 @@ from torch.nn import functional as F from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence -logger = logging.getLogger('coremltools') -logger.setLevel(logging.ERROR) +root_logger = logging.getLogger() +level = root_logger.getEffectiveLevel() +root_logger.setLevel(logging.ERROR) from coremltools.proto import NeuralNetwork_pb2 # NOQA - -logger.setLevel(logging.WARNING) +root_logger.setLevel(level) # all tensors are ordered NCHW, the "feature" dimension is C, so the output of # an LSTM will be put into C same as the filters of a CNN. diff --git a/kraken/lib/vgsl.py b/kraken/lib/vgsl.py index 9a4f0759b..083abbe25 100644 --- a/kraken/lib/vgsl.py +++ b/kraken/lib/vgsl.py @@ -9,8 +9,6 @@ Tuple, Union) import torch -from coremltools.models import MLModel, datatypes -from coremltools.models.neural_network import NeuralNetworkBuilder from google.protobuf.message import DecodeError from torch import nn @@ -18,6 +16,13 @@ from kraken.lib.codec import PytorchCodec from kraken.lib.exceptions import KrakenInvalidModelException +root_logger = logging.getLogger() +level = root_logger.getEffectiveLevel() +root_logger.setLevel(logging.ERROR) +from coremltools.models import MLModel, datatypes +from coremltools.models.neural_network import NeuralNetworkBuilder +root_logger.setLevel(level) + # all tensors are ordered NCHW, the "feature" dimension is C, so the output of # an LSTM will be put into C same as the filters of a CNN.