fix file not found cause TypeError (#385)

* fix file not found cause TypeError

* fix linter test

* fix linter test

* format code

---------

Co-authored-by: Krasus <chen@krasus.red>
Co-authored-by: wenmeng.zwm <wenmeng.zwm@alibaba-inc.com>
This commit is contained in:
LingFeng.Chen.Cn
2023-07-21 15:34:19 +08:00
committed by GitHub
parent 19ea082fec
commit 9c4d9cdb68
4 changed files with 14 additions and 7 deletions

View File

@@ -46,8 +46,9 @@ def mesh_warp_frame(frame, x_motion, y_motion, cap_width, cap_height):
homo,
origin_kp.contiguous().view(2, -1).permute(1, 0)).permute(1, 0)
projection.append(projected_kp.contiguous().view(
*origin_kp.shape).permute(1, 2, 0)) # 2, H, W --> H, W, 2
projection.append(
projected_kp.contiguous().view(*origin_kp.shape).permute(
1, 2, 0)) # 2, H, W --> H, W, 2
projection = torch.stack(projection, 0)
projection[:, :, :, 0] = projection[:, :, :, 0] / cfg.MODEL.WIDTH * 2. - 1.

View File

@@ -430,9 +430,9 @@ class MOELayer(Base):
self.use_expert_residual_network = use_expert_residual_network
if self.use_expert_residual_network:
self.expert_network = nn.Sequential(*([
ExpertResidualLayer(self.gate.model_dim) for _ in range(6)
])) # noqa
self.expert_network = nn.Sequential(
*([ExpertResidualLayer(self.gate.model_dim)
for _ in range(6)])) # noqa
self.use_tutel = use_tutel and TUTEL_INSTALLED

View File

@@ -210,7 +210,12 @@ class AutomaticSpeechRecognitionPipeline(Pipeline):
if isinstance(audio_in, str):
# for funasr code, generate wav.scp from url or local path
self.audio_in, self.raw_inputs = generate_scp_from_url(audio_in)
if audio_in.startswith('http') or os.path.isfile(audio_in):
self.audio_in, self.raw_inputs = generate_scp_from_url(
audio_in)
else:
raise FileNotFoundError(
f'file {audio_in} NOT FOUND, please CHECK!')
elif isinstance(audio_in, bytes):
self.audio_in = audio_in
self.raw_inputs = None

View File

@@ -237,7 +237,8 @@ class SpeakerDiarizationPipeline(Pipeline):
(isinstance(audio_in, tuple) and all(isinstance(item, str) for item in audio_in)):
logger.info(f'Speaker Verification Processing: {audio_in} ...')
else:
logger.info(f'Speaker Verification Processing: {str(audio_in)[:100]} ...')
logger.info(
f'Speaker Verification Processing: {str(audio_in)[:100]} ...')
data_cmd, raw_inputs = None, None
if isinstance(audio_in, tuple) or isinstance(audio_in, list):