Closed wikeeyang closed 5 months ago
我来仔细看看哈哈,没问题的,我一个一个回答
我接下来对你的问题一一回答
最新代码已上传,bug已经解决
多谢大佬!我更新一下再试试,有问题再请教啊。。。
好的,有问题可以继续提issue,期待你的成功
不好意思啊,大佬,问题还是继续存在。。。 D:\AITest\LinlyTalker>python app_img.py bin C:\Python\Python310\lib\site-packages\bitsandbytes\libbitsandbytes_cuda118_nocublaslt.dll [2024-01-29 14:41:56,505] [INFO] [real_accelerator.py:161:get_accelerator] Setting ds_accelerator to cuda (auto detect) NOTE: Redirects are currently not supported in Windows or MacOs. Loading checkpoint shards: 100%|███████████████████████████████████████████████████████| 2/2 [00:04<00:00, 2.26s/it] using safetensor as default Running on local URL: https://127.0.0.1:7870
To create a public link, set share=True
in launch()
.
合理规划任务,把握时间节奏。坚持任务完成度评估,及时调整计划。注重效率提高,保持动力持续。
Using Time 6.299382209777832
using safetensor as default
{'checkpoint': 'checkpoints\SadTalker_V0.0.2_256.safetensors', 'dir_of_BFM_fitting': 'src/config', 'audio2pose_yaml_path': 'src/config\auido2pose.yaml', 'audio2exp_yaml_path': 'src/config\auido2exp.yaml', 'pirender_yaml_path': 'src/config\facerender_pirender.yaml', 'pirender_checkpoint': 'checkpoints\epoch_00190_iteration_000400000_checkpoint.pt', 'use_safetensor': True, 'mappingnet_checkpoint': 'checkpoints\mapping_00229-model.pth.tar', 'facerender_yaml': 'src/config\facerender.yaml'}
temp\f025e7772587be8e91b9b4cb1b5c0041f5ca7da5\image.png
landmark Det:: 100%|███████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 5.46it/s]
3DMM Extraction In Video:: 100%|███████████████████████████████████████████████████████| 1/1 [00:00<00:00, 14.84it/s]
audio2exp:: 100%|███████████████████████████████████████████████████████████████████| 28/28 [00:00<00:00, 118.26it/s]
Face Renderer:: 100%|██████████████████████████████████████████████████████████████| 275/275 [01:18<00:00, 3.52it/s]
fps: 25 275
Traceback (most recent call last):
File "C:\Python\Python310\lib\site-packages\gradio\routes.py", line 442, in run_predict
output = await app.get_blocks().process_api(
File "C:\Python\Python310\lib\site-packages\gradio\blocks.py", line 1389, in process_api
result = await self.call_function(
File "C:\Python\Python310\lib\site-packages\gradio\blocks.py", line 1094, in call_function
prediction = await anyio.to_thread.run_sync(
File "C:\Python\Python310\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "C:\Python\Python310\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "C:\Python\Python310\lib\site-packages\anyio_backends_asyncio.py", line 867, in run
result = context.run(func, args)
File "C:\Python\Python310\lib\site-packages\gradio\utils.py", line 703, in wrapper
response = f(args, kwargs)
File "D:\AITest\LinlyTalker\app_img.py", line 69, in text_response
video = sad_talker.test2(source_image,
File "D:\AITest\LinlyTalker\src\SadTalker.py", line 279, in test2
return_path = self.animate_from_coeff.generate(data, save_dir, pic_path, crop_info, enhancer='gfpgan' if use_enhancer else None, preprocess=preprocess, img_size=size)
File "D:\AITest\LinlyTalker\src\facerender\animate.py", line 210, in generate
imageio.mimsave(path, result, fps=float(fps))
File "C:\Python\Python310\lib\site-packages\imageio\v2.py", line 361, in mimwrite
with imopen(uri, "wI", imopen_args) as file:
File "C:\Python\Python310\lib\site-packages\imageio\core\imopen.py", line 113, in imopen
request = Request(uri, io_mode, format_hint=format_hint, extension=extension)
File "C:\Python\Python310\lib\site-packages\imageio\core\request.py", line 248, in init
self._parse_uri(uri)
File "C:\Python\Python310\lib\site-packages\imageio\core\request.py", line 413, in _parse_uri
raise FileNotFoundError("The directory %r does not exist" % dn)
FileNotFoundError: The directory 'D:\AITest\LinlyTalker\results\da884121-abbd-4177-9b0e-cac8baa8ffd4\temp_da884121-abbd-4177-9b0e-cac8baa8ffd4\first_frame_dir\image_da884121-abbd-4177-9b0e-cac8baa8ffd4\input' does not exist
而针对 app.py 和 app_multi.py,修改:source_image = r'example.png' 是没用的。。。
对的,本身改就是没有意义的,我到时候可以单独写一个文件告诉你怎么改,但是现在这个问题emmmmm,我在看看,居然还有bug,现在是说文件没找到
我知道什么问题了,这个问题可能只有在window出现,因为文件夹路径的问题,我会快速改,今晚你可以再试一下
大佬,可以了,路径问题不再报错了。。。
感谢你的问题,逐步把这个bug解决了,后续我也会改进,比如你说的这一部分替换图片,因为我当时聚焦于两种场景,所以并没有进行一个混合,但是后续我可以写一部分告诉大家怎么替换特定的角色
首先,觉得这个项目挺好,所以才会本地部署起来测试,这是值得肯定的!
其次,先描述本人系统状态:
一、直接 Python app.py,成功执行,会有警告: Exception in callback _ProactorBasePipeTransport._call_connection_lost(None) handle: <Handle _ProactorBasePipeTransport._call_connection_lost(None)> Traceback (most recent call last): File "C:\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) File "C:\Python\Python310\lib\asyncio\proactor_events.py", line 165, in _call_connection_lost self._sock.shutdown(socket.SHUT_RDWR) ConnectionResetError: [WinError 10054] 远程主机强迫关闭了一个现有的连接。 查了网上资料,发现这个与网络连接有关的问题,很常见,但不影响使用,具体原因应该是asyncio库在运行时,没有判别系统平台是Windows还是Linux或别的,都直接调用了asyncio.set_event_loop_policy()类引起的,解决方法可通过加入判断: if platform.system() == 'Windows': asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) 之后,就不会再报错。
二、运行过程加载模型的时候,会有提示: bin C:\Python\Python310\lib\site-packages\bitsandbytes\libbitsandbytes_cuda118_nocublaslt.dll [2024-01-25 17:08:13,225] [INFO] [real_accelerator.py:161:get_accelerator] Setting ds_accelerator to cuda (auto detect) NOTE: Redirects are currently not supported in Windows or MacOs. Loading checkpoint shards: 100%|███████████████████████████████████████████████████████| 2/2 [00:37<00:00, 18.90s/it] using safetensor as default 但其实,本人安装的是 windows 版编译的 bitsandbytes,可能是跟某个模型加速的库调用有关,不影响使用。
三、测试 app_img.py,视频合成的最后阶段,报错如下: {'checkpoint': 'checkpoints\SadTalker_V0.0.2_256.safetensors', 'dir_of_BFM_fitting': 'src/config', 'audio2pose_yaml_path': 'src/config\auido2pose.yaml', 'audio2exp_yaml_path': 'src/config\auido2exp.yaml', 'pirender_yaml_path': 'src/config\facerender_pirender.yaml', 'pirender_checkpoint': 'checkpoints\epoch_00190_iteration_000400000_checkpoint.pt', 'use_safetensor': True, 'mappingnet_checkpoint': 'checkpoints\mapping_00229-model.pth.tar', 'facerender_yaml': 'src/config\facerender.yaml'} temp\1822631dac470091cee138bad413911fac97da9e\image.png landmark Det:: 100%|███████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 5.03it/s] 3DMM Extraction In Video:: 100%|███████████████████████████████████████████████████████| 1/1 [00:00<00:00, 14.77it/s] audio2exp:: 100%|███████████████████████████████████████████████████████████████████| 13/13 [00:00<00:00, 110.95it/s] Face Renderer:: 100%|██████████████████████████████████████████████████████████████| 123/123 [00:34<00:00, 3.54it/s] fps: 25 123 ffmpeg error Traceback (most recent call last): File "C:\Python\Python310\lib\site-packages\gradio\routes.py", line 442, in run_predict output = await app.get_blocks().process_api( File "C:\Python\Python310\lib\site-packages\gradio\blocks.py", line 1389, in process_api result = await self.call_function( File "C:\Python\Python310\lib\site-packages\gradio\blocks.py", line 1094, in call_function prediction = await anyio.to_thread.run_sync( File "C:\Python\Python310\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\Python\Python310\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "C:\Python\Python310\lib\site-packages\anyio_backends_asyncio.py", line 867, in run result = context.run(func, args) File "C:\Python\Python310\lib\site-packages\gradio\utils.py", line 703, in wrapper response = f(args, **kwargs) File "D:\AITest\LinlyTalker\my_app_img.py", line 84, in text_response video = sad_talker.test2(source_image, File "D:\AITest\LinlyTalker\src\SadTalker.py", line 279, in test2 return_path = self.animate_from_coeff.generate(data, save_dir, pic_path, crop_info, enhancer='gfpgan' if use_enhancer else None, preprocess=preprocess, img_size=size) File "D:\AITest\LinlyTalker\src\facerender\animate.py", line 272, in generate os.remove(path) FileNotFoundError: [WinError 3] 系统找不到指定的路径。: './results/85200a0a-e6c9-4143-980f-a82b4a8dd3b5\temp_85200a0a-e6c9-4143-980f-a82b4a8dd3b5\first_frame_dir\image_85200a0a-e6c9-4143-980f-a82b4a8dd3b5\input\answer.mp4'
这个可能与大佬传递的系统 path 变量有关,但没找到如何解决,请大佬帮忙分析解决。
四、在使用 app.py 和 app_multi.py 时,想修改默认的头像 example.png 为别的头像,但发现修改脚本里面的 image 路径是不管用的,最后直接删除掉 inputs 目录下的 first_frame_dir 整个目录,执行得到报错信息如下: Traceback (most recent call last): File "C:\Python\Python310\lib\site-packages\scipy\io\matlab_mio.py", line 39, in _open_file return open(file_like, mode), True FileNotFoundError: [Errno 2] No such file or directory: './inputs/first_frame_dir/example.mat'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Python\Python310\lib\site-packages\gradio\routes.py", line 442, in run_predict output = await app.get_blocks().process_api( File "C:\Python\Python310\lib\site-packages\gradio\blocks.py", line 1389, in process_api result = await self.call_function( File "C:\Python\Python310\lib\site-packages\gradio\blocks.py", line 1094, in call_function prediction = await anyio.to_thread.run_sync( File "C:\Python\Python310\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\Python\Python310\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "C:\Python\Python310\lib\site-packages\anyio_backends_asyncio.py", line 867, in run result = context.run(func, args) File "C:\Python\Python310\lib\site-packages\gradio\utils.py", line 703, in wrapper response = f(args, **kwargs) File "D:\AITest\LinlyTalker\my_app_multi.py", line 148, in human_respone video_path = sad_talker.test(source_image, File "D:\AITest\LinlyTalker\src\SadTalker.py", line 153, in test batch = get_data(first_coeff_path, audio_path, self.device, ref_eyeblink_coeff_path=ref_eyeblink_coeff_path, still=still_mode, \ File "D:\AITest\LinlyTalker\src\generate_batch.py", line 82, in get_data source_semantics_dict = scio.loadmat(source_semantics_path) File "C:\Python\Python310\lib\site-packages\scipy\io\matlab_mio.py", line 225, in loadmat with _open_file_context(file_name, appendmat) as f: File "C:\Python\Python310\lib\contextlib.py", line 135, in enter return next(self.gen) File "C:\Python\Python310\lib\site-packages\scipy\io\matlab_mio.py", line 17, in _open_file_context f, opened = _open_file(file_like, appendmat, mode) File "C:\Python\Python310\lib\site-packages\scipy\io\matlab_mio.py", line 45, in _open_file return open(file_like, mode), True FileNotFoundError: [Errno 2] No such file or directory: './inputs/first_frame_dir/example.mat'
感觉这个脚本里面哪里被写死了,请大佬指点修改哪里可以实现替换不同默认头像的功能,谢谢!