diff --git a/src/liveportrait/util.py b/src/liveportrait/util.py index a58ce58..f391391 100644 --- a/src/liveportrait/util.py +++ b/src/liveportrait/util.py @@ -373,7 +373,7 @@ def _apply(self, fn): target_device = target_tensor.device target_dtype = target_tensor.dtype - except: + except Exception: target_device = param.device target_dtype = param.dtype diff --git a/src/modeling/engine_model.py b/src/modeling/engine_model.py index ac41ba4..e2cf658 100644 --- a/src/modeling/engine_model.py +++ b/src/modeling/engine_model.py @@ -124,7 +124,7 @@ def get_safe_shape(engine, name): trt.volume(self.output_shapes[name]), dtype=trt.nptype(self.output_dtypes[name]) ) for name in self.output_names } # 分配 page-locked host 内存以存储输出 - except: + except Exception: self.ctx.pop() raise Exception("CUDA Initialization Failed!") self.ctx.pop() @@ -296,7 +296,7 @@ def unlink(self): try: for name in self.input_names: self.context.set_tensor_address(name, int(self.dinputs[name])) - except: + except Exception: self.ctx.pop() if not(self.extra_lock is None): self.extra_lock.release() diff --git a/src/models/unet_2d_decoder.py b/src/models/unet_2d_decoder.py index e0a1933..4a1e05c 100644 --- a/src/models/unet_2d_decoder.py +++ b/src/models/unet_2d_decoder.py @@ -490,7 +490,7 @@ def from_unet( try: # print('Successfully initializing ControlNet!', name, tensor.shape, src_tensors[name].shape) tensor.copy_(src_tensors[name].detach()) - except: + except Exception: # print('Mismatch occured in initializing ControlNet!', name, tensor.shape, src_tensors[name].shape) # TODO: 确保所有upblock参数有初始化 if tensor.dim() == 1: diff --git a/src/utils/util.py b/src/utils/util.py index 1d9d589..efd762c 100644 --- a/src/utils/util.py +++ b/src/utils/util.py @@ -61,7 +61,7 @@ def create_code_snapshot(root, dst_path, extensions=(".py", ".h", ".cpp", ".cu", try: tar.add(path.as_posix(), arcname=path.relative_to( root).as_posix(), recursive=True) - except: + except Exception: print(path) assert False, 'Error occur in create_code_snapshot'