Skip to content
Permalink
Browse files

fix(service): fix exception when no chunks

  • Loading branch information...
hanxiao committed Aug 30, 2019
1 parent 983b899 commit b140cca9b9ba80414e281674a20f93ccdd94b7fc
Showing with 8 additions and 8 deletions.
  1. +6 −6 gnes/base/__init__.py
  2. +1 −1 gnes/preprocessor/audio/audio_vanilla.py
  3. +1 −1 gnes/preprocessor/video/ffmpeg.py
@@ -227,9 +227,9 @@ def __setstate__(self, d):
self.logger = set_logger(self.__class__.__name__, self.verbose)
try:
self._post_init_wrapper()
except ImportError:
self.logger.info('ImportError is often caused by a missing component, '
'which often can be solved by "pip install" relevant package.')
except ImportError as ex:
self.logger.warning('ImportError is often caused by a missing component, '
'which often can be solved by "pip install" relevant package. %s' % ex, exc_info=True)

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

@profiling
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):
load_from_dump = False
if dump_path:
obj = cls.load(dump_path)
obj.logger.info('restore %s from %s' % (cls.__name__, dump_path))
obj.logger.critical('restore %s from %s' % (cls.__name__, dump_path))
load_from_dump = True
else:
cls.init_from_yaml = True
@@ -351,7 +351,7 @@ def _get_instance_from_yaml(cls, constructor, node, stop_on_import_error=False):
tmp_p = {kk: _expand_env_var(vv) for kk, vv in data.get('parameters', {}).items()}
obj = cls(**tmp_p, gnes_config=data.get('gnes_config', {}))

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

if node.tag in {'!PipelineEncoder', '!CompositionalTrainableBase'}:
@@ -40,6 +40,6 @@ def apply(self, doc: 'gnes_pb2.Document') -> None:
c.offset = ci
c.weight = 1 / len(audio)
else:
self.logger.info('bad document: no audio extracted')
self.logger.warning('bad document: no audio extracted')
else:
self.logger.error('bad document: "raw_bytes" is empty!')
@@ -178,7 +178,7 @@ def apply(self, doc: 'gnes_pb2.Document') -> None:
c.weight = 1 / len(sub_videos)

else:
self.logger.info('bad document: no key frames extracted')
self.logger.warning('bad document: no key frames extracted')
else:
self.logger.error('bad document: "raw_bytes" is empty!')

0 comments on commit b140cca

Please sign in to comment.
You can’t perform that action at this time.