PaddlePaddle / PaddleHub

Awesome pre-trained models toolkit based on PaddlePaddle. (400+ models including Image, Text, Audio, Video and Cross-Modal with Easy Inference & Serving)
https://www.paddlepaddle.org.cn/hub
Apache License 2.0
12.67k stars 2.07k forks source link

wave2lip AI Studio运行bug #1808

Open XYZ-916 opened 2 years ago

XYZ-916 commented 2 years ago

~/.paddlehub/modules/wav2lip/module.py in init(self) 46 nosmooth = False, 47 face_detector = 'sfd', ---> 48 face_enhancement = True) 49 50 ~/.paddlehub/modules/wav2lip/model.py in init(self, checkpoint_path, static, fps, pads, face_det_batch_size, wav2lip_batch_size, resize_factor, crop, box, rotate, nosmooth, face_detector, face_enhancement) 46 if face_enhancement: 47 from ppgan.faceutils.face_enhancement import FaceEnhancement ---> 48 self.faceenhancer = FaceEnhancement() 49 makedirs('./temp', exist_ok=True) 50 /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/ppgan/faceutils/face_enhancement/face_enhance.py in init(self, path_to_enhance, size, batch_size) 40 model_weights = paddle.load(path_to_enhance) 41 ---> 42 self.face_enhance = GPEN(size=512, style_dim=512, n_mlp=8) 43 self.face_enhance.load_dict(model_weights) 44 self.face_enhance.eval() /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/ppgan/models/generators/gpen.py in init(self, size, style_dim, n_mlp, channel_multiplier, blur_kernel, lr_mlp) 52 blur_kernel=blur_kernel, 53 lr_mlp=lr_mlp, ---> 54 is_concat=True) 55 56 conv = [ConvLayer(3, channels[size], 1)] /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/ppgan/models/generators/generator_styleganv2.py in init(self, size, style_dim, n_mlp, channel_multiplier, blur_kernel, lr_mlp, is_concat) 261 style_dim, 262 lr_mul=lr_mlp, --> 263 activation="fused_lrelu")) 264 265 self.style = nn.Sequential(*layers) /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/ppgan/modules/equalized.py in init(self, in_dim, out_dim, bias, bias_init, lr_mul, activation) 86 self.weight = self.create_parameter( 87 (in_dim, out_dim), default_initializer=nn.initializer.Normal()) ---> 88 self.weight.set_value((self.weight / lr_mul)) 89 90 if bias: /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/framework.py in set_value(self, value, scope) 1896 raise TypeError( 1897 "value should be numpy.ndarray or LoDTensor, but received {}.". -> 1898 format(type(value))) 1899 1900 if scope is not None and not isinstance(scope, core._Scope): TypeError: value should be numpy.ndarray or LoDTensor, but received <class 'paddle.fluid.framework.Variable'>.

rainyfly commented 2 years ago

您好,可能是环境版本的问题,我在AI Studio上运行如下代码没有报错

image

可以先按图中代码升级一下paddlehub版本再试试,如果有问题请提供一下复现环境方便我们调试错误