Skip to content
This repository was archived by the owner on Feb 22, 2020. It is now read-only.

Commit b140cca

Browse files
author
hanhxiao
committed
fix(service): fix exception when no chunks
1 parent 983b899 commit b140cca

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

gnes/base/__init__.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ def __setstate__(self, d):
227227
self.logger = set_logger(self.__class__.__name__, self.verbose)
228228
try:
229229
self._post_init_wrapper()
230-
except ImportError:
231-
self.logger.info('ImportError is often caused by a missing component, '
232-
'which often can be solved by "pip install" relevant package.')
230+
except ImportError as ex:
231+
self.logger.warning('ImportError is often caused by a missing component, '
232+
'which often can be solved by "pip install" relevant package. %s' % ex, exc_info=True)
233233

234234
def train(self, *args, **kwargs):
235235
"""
@@ -248,7 +248,7 @@ def dump(self, filename: str = None) -> None:
248248
f = tempfile.NamedTemporaryFile('w', delete=False, dir=os.environ.get('GNES_VOLUME', None)).name
249249
with open(f, 'wb') as fp:
250250
pickle.dump(self, fp)
251-
self.logger.info('model is stored to %s' % f)
251+
self.logger.critical('model is serialized to %s' % f)
252252

253253
@profiling
254254
def dump_yaml(self, filename: str = None) -> None:
@@ -334,7 +334,7 @@ def _get_instance_from_yaml(cls, constructor, node, stop_on_import_error=False):
334334
load_from_dump = False
335335
if dump_path:
336336
obj = cls.load(dump_path)
337-
obj.logger.info('restore %s from %s' % (cls.__name__, dump_path))
337+
obj.logger.critical('restore %s from %s' % (cls.__name__, dump_path))
338338
load_from_dump = True
339339
else:
340340
cls.init_from_yaml = True
@@ -351,7 +351,7 @@ def _get_instance_from_yaml(cls, constructor, node, stop_on_import_error=False):
351351
tmp_p = {kk: _expand_env_var(vv) for kk, vv in data.get('parameters', {}).items()}
352352
obj = cls(**tmp_p, gnes_config=data.get('gnes_config', {}))
353353

354-
obj.logger.info('initialize %s from a yaml config' % cls.__name__)
354+
obj.logger.critical('initialize %s from a yaml config' % cls.__name__)
355355
cls.init_from_yaml = False
356356

357357
if node.tag in {'!PipelineEncoder', '!CompositionalTrainableBase'}:

gnes/preprocessor/audio/audio_vanilla.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ def apply(self, doc: 'gnes_pb2.Document') -> None:
4040
c.offset = ci
4141
c.weight = 1 / len(audio)
4242
else:
43-
self.logger.info('bad document: no audio extracted')
43+
self.logger.warning('bad document: no audio extracted')
4444
else:
4545
self.logger.error('bad document: "raw_bytes" is empty!')

gnes/preprocessor/video/ffmpeg.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def apply(self, doc: 'gnes_pb2.Document') -> None:
178178
c.weight = 1 / len(sub_videos)
179179

180180
else:
181-
self.logger.info('bad document: no key frames extracted')
181+
self.logger.warning('bad document: no key frames extracted')
182182
else:
183183
self.logger.error('bad document: "raw_bytes" is empty!')
184184

0 commit comments

Comments
 (0)