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

Commit

Permalink
fix(service): fix exception when no chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Aug 30, 2019
1 parent 983b899 commit b140cca
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions gnes/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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'}:
Expand Down
2 changes: 1 addition & 1 deletion gnes/preprocessor/audio/audio_vanilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!')
2 changes: 1 addition & 1 deletion gnes/preprocessor/video/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!')

Expand Down

0 comments on commit b140cca

Please sign in to comment.