facebookresearch / audio2photoreal

Code and dataset for photorealistic Codec Avatars driven from audio
Other
2.66k stars 250 forks source link

soundfile.LibsndfileError: Error opening '/tmp/audio_tmp_sample0.wav': System error. #68

Closed nitinmukesh closed 1 month ago

nitinmukesh commented 1 month ago

Please help how to fix this error


(a2p) C:\usable\audio2photoreal>python -m demo.demo
running on... cuda:0
 adding lip conditioning ./assets/iter-0200000.pt
Loading checkpoints from [checkpoints/diffusion/c1_face/model000155000.pt]...
running on... cuda:0
 using keyframes: torch.Size([1, 20, 256])
loading checkpoint from checkpoints/vq/c1_pose/net_iter300000.pth
 loading TRANSFORMER checkpoint from checkpoints/guide/c1_pose/checkpoints/iter-0100000.pt
Loading checkpoints from [checkpoints/diffusion/c1_pose/model000340000.pt]...
C:\Users\nitin\miniconda3\envs\a2p\lib\site-packages\torch\functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\aten\src\ATen\native\TensorShape.cpp:3484.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
WARNING:visualize.ca_body.nn.color_cal:Requested color-calibration identity camera not present, defaulting to 400883.
loading... ./checkpoints/ca_body/data/PXB184/body_dec.ckpt
Running on local URL:  http://127.0.0.1:7860
Running on public URL: https://---.gradio.live

This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from Terminal to deploy to Spaces (https://huggingface.co/spaces)

100%|████████████████████████████████████████████████████████████████████████████████| 100/100 [00:18<00:00,  5.33it/s]
created 3 samples
100%|████████████████████████████████████████████████████████████████████████████████| 100/100 [00:09<00:00, 10.40it/s]
created 3 samples
Traceback (most recent call last):
  File "C:\Users\nitin\miniconda3\envs\a2p\lib\site-packages\gradio\queueing.py", line 536, in process_events
    response = await route_utils.call_process_api(
  File "C:\Users\nitin\miniconda3\envs\a2p\lib\site-packages\gradio\route_utils.py", line 276, in call_process_api
    output = await app.get_blocks().process_api(
  File "C:\Users\nitin\miniconda3\envs\a2p\lib\site-packages\gradio\blocks.py", line 1923, in process_api
    result = await self.call_function(
  File "C:\Users\nitin\miniconda3\envs\a2p\lib\site-packages\gradio\blocks.py", line 1508, in call_function
    prediction = await anyio.to_thread.run_sync(  # type: ignore
  File "C:\Users\nitin\miniconda3\envs\a2p\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "C:\Users\nitin\miniconda3\envs\a2p\lib\site-packages\anyio\_backends\_asyncio.py", line 2177, in run_sync_in_worker_thread
    return await future
  File "C:\Users\nitin\miniconda3\envs\a2p\lib\site-packages\anyio\_backends\_asyncio.py", line 859, in run
    result = context.run(func, *args)
  File "C:\Users\nitin\miniconda3\envs\a2p\lib\site-packages\gradio\utils.py", line 818, in wrapper
    response = f(*args, **kwargs)
  File "C:\usable\audio2photoreal\demo\demo.py", line 230, in audio_to_avatar
    gradio_model.body_renderer.render_full_video(
  File "C:\usable\audio2photoreal\visualize\render_codes.py", line 139, in render_full_video
    torchaudio.save(
  File "C:\Users\nitin\miniconda3\envs\a2p\lib\site-packages\torchaudio\backend\soundfile_backend.py", line 451, in save
    soundfile.write(file=filepath, data=src, samplerate=sample_rate, subtype=subtype, format=format)
  File "C:\Users\nitin\miniconda3\envs\a2p\lib\site-packages\soundfile.py", line 343, in write
    with SoundFile(file, 'w', samplerate, channels,
  File "C:\Users\nitin\miniconda3\envs\a2p\lib\site-packages\soundfile.py", line 658, in __init__
    self._file = self._open(file, mode_int, closefd)
  File "C:\Users\nitin\miniconda3\envs\a2p\lib\site-packages\soundfile.py", line 1216, in _open
    raise LibsndfileError(err, prefix="Error opening {0!r}: ".format(self.name))
soundfile.LibsndfileError: Error opening '/tmp/audio_tmp_sample0.wav': System error.
image
nitinmukesh commented 1 month ago

Some more information

  1. Checked audio file and it is NOT corrupted, checked using VLCplayer and through demo WebUI. This is where the recorded audio is stored "C:\Users\nitin\AppData\Local\Temp\gradio\5fbee56ffd6a627966d8c748c54bed31434df024\audio.wav"

  2. ffmpeg is compiled with h264 and is in path

    C:\Users\nitin>ffmpeg -codecs
    DEV.L. h261                 H.261
    DEV.L. h263                 H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2
    D.V.L. h263i                Intel H.263
    DEV.L. h263p                H.263+ / H.263-1998 / H.263 version 2
    DEV.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_qsv h264_cuvid) (encoders: libx264 libx264rgb h264_amf h264_mf h264_nvenc h264_qsv)
  3. I already installed pip install soundfile

(a2p) C:\usable\audio2photoreal>pip list
Package                 Version
----------------------- ------------------
absl-py                 2.1.0
aiofiles                23.2.1
annotated-types         0.7.0
antlr4-python3-runtime  4.8
anyio                   4.4.0
asttokens               2.4.1
attrdict                2.0.1
bitarray                2.9.2
blobfile                2.1.1
certifi                 2024.7.4
cffi                    1.16.0
charset-normalizer      3.3.2
click                   8.1.7
colorama                0.4.6
contourpy               1.2.1
cycler                  0.12.1
Cython                  3.0.10
decorator               5.1.1
dnspython               2.6.1
einops                  0.8.0
email_validator         2.2.0
exceptiongroup          1.2.2
executing               2.0.1
fairseq                 0.12.2
fastapi                 0.111.1
fastapi-cli             0.0.4
ffmpy                   0.3.2
filelock                3.15.4
fonttools               4.53.1
fsspec                  2024.6.1
fvcore                  0.1.5.post20221221
gradio                  4.39.0
gradio_client           1.1.1
grpcio                  1.65.1
h11                     0.14.0
httpcore                1.0.5
httptools               0.6.1
httpx                   0.27.0
huggingface-hub         0.24.1
hydra-core              1.0.7
idna                    3.7
importlib_metadata      8.1.0
importlib_resources     6.4.0
iopath                  0.1.10
ipython                 8.18.1
jedi                    0.19.1
Jinja2                  3.1.4
joblib                  1.4.2
kiwisolver              1.4.5
lxml                    4.9.4
Markdown                3.6
markdown-it-py          3.0.0
MarkupSafe              2.1.5
matplotlib              3.9.1
matplotlib-inline       0.1.7
mdurl                   0.1.2
mediapy                 1.2.2
mpmath                  1.3.0
networkx                3.2.1
numpy                   1.23.0
omegaconf               2.0.6
opencv-python           4.10.0.84
orjson                  3.10.6
packaging               24.1
pandas                  2.2.2
parso                   0.8.4
pillow                  10.4.0
pip                     24.0
portalocker             2.10.1
prompt_toolkit          3.0.47
protobuf                4.25.3
pure_eval               0.2.3
pycparser               2.22
pycryptodomex           3.20.0
pydantic                2.8.2
pydantic_core           2.20.1
pydub                   0.25.1
Pygments                2.18.0
pyparsing               3.1.2
python-dateutil         2.9.0.post0
python-dotenv           1.0.1
python-multipart        0.0.9
pytorch3d               0.7.6+pt2.0.0cu117
pytz                    2024.1
pywin32                 306
PyYAML                  6.0.1
regex                   2024.5.15
requests                2.32.3
rich                    13.7.1
ruff                    0.5.4
sacrebleu               2.4.2
scikit-learn            1.5.1
scipy                   1.13.1
semantic-version        2.10.0
setuptools              69.5.1
shellingham             1.5.4
six                     1.16.0
sniffio                 1.3.1
soundfile               0.12.1
stack-data              0.6.3
starlette               0.37.2
sympy                   1.13.1
tabulate                0.9.0
tensorboard             2.17.0
tensorboard-data-server 0.7.2
tensorboardX            2.6.2.2
termcolor               2.4.0
threadpoolctl           3.5.0
tomlkit                 0.12.0
torch                   2.0.1+cu117
torchaudio              2.0.2+cu117
torchvision             0.15.2+cu117
tqdm                    4.66.4
traitlets               5.14.3
typer                   0.12.3
typing_extensions       4.12.2
tzdata                  2024.1
urllib3                 2.2.2
uvicorn                 0.30.3
watchfiles              0.22.0
wcwidth                 0.2.13
websockets              11.0.3
Werkzeug                3.0.3
wheel                   0.43.0
yacs                    0.1.8
zipp                    3.19.2