Retrieval-based-Voice-Conversion-WebUI icon indicating copy to clipboard operation
Retrieval-based-Voice-Conversion-WebUI copied to clipboard

AttributeError: 'NoneType' object has no attribute 'tobytes'

Open Bigwvevo opened this issue 1 year ago • 15 comments

hello, i have been having this issue for a couple hours now, i have tried alot of different things but nothing i could find is working.

Traceback (most recent call last): File "C:\TCHT\Retrieval-based-Voice-Conversion-WebUI\infer-web.py", line 161, in vc_single audio = load_audio(input_audio_path, 16000) File "C:\TCHT\Retrieval-based-Voice-Conversion-WebUI\my_utils.py", line 19, in load_audio raise RuntimeError(f"Failed to load audio: {e}") RuntimeError: Failed to load audio: ffmpeg error (see stderr output for detail)

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\gradio\routes.py", line 427, in run_predict output = await app.get_blocks().process_api( File "C:\Program Files\Python310\lib\site-packages\gradio\blocks.py", line 1326, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "C:\Program Files\Python310\lib\site-packages\gradio\blocks.py", line 1260, in postprocess_data prediction_value = block.postprocess(prediction_value) File "C:\Program Files\Python310\lib\site-packages\gradio\components.py", line 2586, in postprocess file_path = self.audio_to_temp_file( File "C:\Program Files\Python310\lib\site-packages\gradio\components.py", line 360, in audio_to_temp_file temp_dir = Path(dir) / self.hash_bytes(data.tobytes()) AttributeError: 'NoneType' object has no attribute 'tobytes'

Bigwvevo avatar Jun 07 '23 05:06 Bigwvevo

is there also error about np.int before this?

Naozumi520 avatar Jun 07 '23 06:06 Naozumi520

i dont belive so

Traceback (most recent call last): File "C:\TCHT\Retrieval-based-Voice-Conversion-WebUI\my_utils.py", line 14, in load_audio ffmpeg.input(file, threads=0) File "C:\Program Files\Python310\lib\site-packages\ffmpeg_run.py", line 325, in run raise Error('ffmpeg', out, err) ffmpeg._run.Error: ffmpeg error (see stderr output for detail)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\TCHT\Retrieval-based-Voice-Conversion-WebUI\infer-web.py", line 161, in vc_single audio = load_audio(input_audio_path, 16000) File "C:\TCHT\Retrieval-based-Voice-Conversion-WebUI\my_utils.py", line 19, in load_audio raise RuntimeError(f"Failed to load audio: {e}") RuntimeError: Failed to load audio: ffmpeg error (see stderr output for detail)

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\gradio\routes.py", line 427, in run_predict output = await app.get_blocks().process_api( File "C:\Program Files\Python310\lib\site-packages\gradio\blocks.py", line 1326, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "C:\Program Files\Python310\lib\site-packages\gradio\blocks.py", line 1260, in postprocess_data prediction_value = block.postprocess(prediction_value) File "C:\Program Files\Python310\lib\site-packages\gradio\components.py", line 2586, in postprocess file_path = self.audio_to_temp_file( File "C:\Program Files\Python310\lib\site-packages\gradio\components.py", line 360, in audio_to_temp_file temp_dir = Path(dir) / self.hash_bytes(data.tobytes()) AttributeError: 'NoneType' object has no attribute 'tobytes'

this is the entire msg that comes out when i press convert (model inference)

Bigwvevo avatar Jun 07 '23 07:06 Bigwvevo

I'm having same error

neural-loop avatar Jun 07 '23 12:06 neural-loop

Getting same error, looks like it's related to gradio and it not being able to store or show the temp file. I m not a programmer but i can somewhat read the code and understand it.

gelukuMLG avatar Jun 10 '23 04:06 gelukuMLG

看起来是样的错误,有什么办法修复吗?

Traceback (most recent call last): File "/root/miniconda3/envs/Retrieval-based-Voice-Conversion-WebUI/lib/python3.9/site-packages/gradio/routes.py", line 437, in run_predict output = await app.get_blocks().process_api( File "/root/miniconda3/envs/Retrieval-based-Voice-Conversion-WebUI/lib/python3.9/site-packages/gradio/blocks.py", line 1349, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "/root/miniconda3/envs/Retrieval-based-Voice-Conversion-WebUI/lib/python3.9/site-packages/gradio/blocks.py", line 1283, in postprocess_data prediction_value = block.postprocess(prediction_value) File "/root/miniconda3/envs/Retrieval-based-Voice-Conversion-WebUI/lib/python3.9/site-packages/gradio/components.py", line 2586, in postprocess file_path = self.audio_to_temp_file( File "/root/miniconda3/envs/Retrieval-based-Voice-Conversion-WebUI/lib/python3.9/site-packages/gradio/components.py", line 360, in audio_to_temp_file temp_dir = Path(dir) / self.hash_bytes(data.tobytes()) AttributeError: 'NoneType' object has no attribute 'tobytes'

ltbjwzttzz avatar Jun 10 '23 10:06 ltbjwzttzz

Using MiniConda with python 3.10.11, ~~had~~ have the same issue. ~~Using pip install -r requirements.txt as README suggests will install version 0.0.20. As said in #371, downgrading torchcrepe to 0.0.18 fixed this for me.~~

Update: Downgrading fix only lasts a while, after a few voice conversion/training tries this issue still came up.

azhuge233 avatar Jun 13 '23 20:06 azhuge233

Need some help with this 🙏

Traceback (most recent call last): File "F:\Programs\RVC\Retrieval-based-Voice-Conversion-WebUI\infer-web.py", line 185, in vc_single audio_opt = vc.pipeline( File "F:\Programs\RVC\Retrieval-based-Voice-Conversion-WebUI\vc_infer_pipeline.py", line 366, in pipeline self.vc( File "F:\Programs\RVC\Retrieval-based-Voice-Conversion-WebUI\vc_infer_pipeline.py", line 201, in vc score, ix = index.search(npy, k=8) File "E:\Programs\Python\Python310\lib\site-packages\faiss\class_wrappers.py", line 329, in replacement_search assert d == self.d AssertionError

Traceback (most recent call last): File "E:\Programs\Python\Python310\lib\site-packages\gradio\routes.py", line 437, in run_predict output = await app.get_blocks().process_api( File "E:\Programs\Python\Python310\lib\site-packages\gradio\blocks.py", line 1355, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "E:\Programs\Python\Python310\lib\site-packages\gradio\blocks.py", line 1289, in postprocess_data prediction_value = block.postprocess(prediction_value) File "E:\Programs\Python\Python310\lib\site-packages\gradio\components\audio.py", line 316, in postprocess file_path = self.audio_to_temp_file( File "E:\Programs\Python\Python310\lib\site-packages\gradio\components\base.py", line 324, in audio_to_temp_file temp_dir = Path(dir) / self.hash_bytes(data.tobytes()) AttributeError: 'NoneType' object has no attribute 'tobytes'

CirnoChan999 avatar Jun 19 '23 07:06 CirnoChan999

having same issue bro

SilverAsh60 avatar Jun 21 '23 20:06 SilverAsh60

Traceback (most recent call last): File "D:\RVC\Retrieval-based-Voice-Conversion-WebUI\my_utils.py", line 14, in load_audio ffmpeg.input(file, threads=0) File "C:\Python310\lib\site-packages\ffmpeg_run.py", line 325, in run raise Error('ffmpeg', out, err) ffmpeg._run.Error: ffmpeg error (see stderr output for detail)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\RVC\Retrieval-based-Voice-Conversion-WebUI\infer-web.py", line 178, in vc_single audio = load_audio(input_audio_path, 16000) File "D:\RVC\Retrieval-based-Voice-Conversion-WebUI\my_utils.py", line 19, in load_audio raise RuntimeError(f"Failed to load audio: {e}") RuntimeError: Failed to load audio: ffmpeg error (see stderr output for detail)

Traceback (most recent call last): File "C:\Python310\lib\site-packages\gradio\routes.py", line 437, in run_predict output = await app.get_blocks().process_api( File "C:\Python310\lib\site-packages\gradio\blocks.py", line 1355, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "C:\Python310\lib\site-packages\gradio\blocks.py", line 1289, in postprocess_data prediction_value = block.postprocess(prediction_value) File "C:\Python310\lib\site-packages\gradio\components\audio.py", line 316, in postprocess file_path = self.audio_to_temp_file( File "C:\Python310\lib\site-packages\gradio\components\base.py", line 324, in audio_to_temp_file temp_dir = Path(dir) / self.hash_bytes(data.tobytes()) AttributeError: 'NoneType' object has no attribute 'tobytes' 2023-06-22 03:39:08 | INFO | httpx | HTTP Request: POST http://localhost:7865/api/predict "HTTP/1.1 500 Internal Server Error" 2023-06-22 03:39:08 | INFO | httpx | HTTP Request: POST http://localhost:7865/reset "HTTP/1.1 200 OK"

SilverAsh60 avatar Jun 21 '23 20:06 SilverAsh60

hello, i have been having this issue for a couple hours now, i have tried alot of different things but nothing i could find is working.

Traceback (most recent call last): File "C:\TCHT\Retrieval-based-Voice-Conversion-WebUI\infer-web.py", line 161, in vc_single audio = load_audio(input_audio_path, 16000) File "C:\TCHT\Retrieval-based-Voice-Conversion-WebUI\my_utils.py", line 19, in load_audio raise RuntimeError(f"Failed to load audio: {e}") RuntimeError: Failed to load audio: ffmpeg error (see stderr output for detail)

Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\gradio\routes.py", line 427, in run_predict output = await app.get_blocks().process_api( File "C:\Program Files\Python310\lib\site-packages\gradio\blocks.py", line 1326, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "C:\Program Files\Python310\lib\site-packages\gradio\blocks.py", line 1260, in postprocess_data prediction_value = block.postprocess(prediction_value) File "C:\Program Files\Python310\lib\site-packages\gradio\components.py", line 2586, in postprocess file_path = self.audio_to_temp_file( File "C:\Program Files\Python310\lib\site-packages\gradio\components.py", line 360, in audio_to_temp_file temp_dir = Path(dir) / self.hash_bytes(data.tobytes()) AttributeError: 'NoneType' object has no attribute 'tobytes'

Traceback (most recent call last): File "G:\RVC-beta-v2-0618\runtime\lib\site-packages\gradio\routes.py", line 321, in run_predict output = await app.blocks.process_api( File "G:\RVC-beta-v2-0618\runtime\lib\site-packages\gradio\blocks.py", line 1007, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "G:\RVC-beta-v2-0618\runtime\lib\site-packages\gradio\blocks.py", line 953, in postprocess_data prediction_value = block.postprocess(prediction_value) File "G:\RVC-beta-v2-0618\runtime\lib\site-packages\gradio\components.py", line 2076, in postprocess processing_utils.audio_to_file(sample_rate, data, file.name) File "G:\RVC-beta-v2-0618\runtime\lib\site-packages\gradio\processing_utils.py", line 206, in audio_to_file data = convert_to_16_bit_wav(data) File "G:\RVC-beta-v2-0618\runtime\lib\site-packages\gradio\processing_utils.py", line 219, in convert_to_16_bit_wav if data.dtype in [np.float64, np.float32, np.float16]: AttributeError: 'NoneType' object has no attribute 'dtype'

我的也是这个,我按报错一行行找下去,大概意思是格式化音源出现问题 def convert_to_16_bit_wav(data): # Based on: https://docs.scipy.org/doc/scipy/reference/generated/scipy.io.wavfile.write.html warning = "Trying to convert audio automatically from {} to 16-bit int format." if data.dtype in [np.float64, np.float32, np.float16]: warnings.warn(warning.format(data.dtype)) data = data / np.abs(data).max() data = data * 32767 data = data.astype(np.int16) elif data.dtype == np.int32: warnings.warn(warning.format(data.dtype)) data = data / 65538 data = data.astype(np.int16) elif data.dtype == np.int16: pass elif data.dtype == np.uint16: warnings.warn(warning.format(data.dtype)) data = data - 32768 data = data.astype(np.int16) elif data.dtype == np.uint8: warnings.warn(warning.format(data.dtype)) data = data * 257 - 32768 data = data.astype(np.int16)

就是下面这里

else:
    raise ValueError(
        "Audio data cannot be converted automatically from "
        f"{data.dtype} to 16-bit int format."
    )
return data

Wuxlol avatar Jun 22 '23 02:06 Wuxlol

hello, i have been having this issue for a couple hours now, i have tried alot of different things but nothing i could find is working. Traceback (most recent call last): File "C:\TCHT\Retrieval-based-Voice-Conversion-WebUI\infer-web.py", line 161, in vc_single audio = load_audio(input_audio_path, 16000) File "C:\TCHT\Retrieval-based-Voice-Conversion-WebUI\my_utils.py", line 19, in load_audio raise RuntimeError(f"Failed to load audio: {e}") RuntimeError: Failed to load audio: ffmpeg error (see stderr output for detail) Traceback (most recent call last): File "C:\Program Files\Python310\lib\site-packages\gradio\routes.py", line 427, in run_predict output = await app.get_blocks().process_api( File "C:\Program Files\Python310\lib\site-packages\gradio\blocks.py", line 1326, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "C:\Program Files\Python310\lib\site-packages\gradio\blocks.py", line 1260, in postprocess_data prediction_value = block.postprocess(prediction_value) File "C:\Program Files\Python310\lib\site-packages\gradio\components.py", line 2586, in postprocess file_path = self.audio_to_temp_file( File "C:\Program Files\Python310\lib\site-packages\gradio\components.py", line 360, in audio_to_temp_file temp_dir = Path(dir) / self.hash_bytes(data.tobytes()) AttributeError: 'NoneType' object has no attribute 'tobytes'

Traceback (most recent call last): File "G:\RVC-beta-v2-0618\runtime\lib\site-packages\gradio\routes.py", line 321, in run_predict output = await app.blocks.process_api( File "G:\RVC-beta-v2-0618\runtime\lib\site-packages\gradio\blocks.py", line 1007, in process_api data = self.postprocess_data(fn_index, result["prediction"], state) File "G:\RVC-beta-v2-0618\runtime\lib\site-packages\gradio\blocks.py", line 953, in postprocess_data prediction_value = block.postprocess(prediction_value) File "G:\RVC-beta-v2-0618\runtime\lib\site-packages\gradio\components.py", line 2076, in postprocess processing_utils.audio_to_file(sample_rate, data, file.name) File "G:\RVC-beta-v2-0618\runtime\lib\site-packages\gradio\processing_utils.py", line 206, in audio_to_file data = convert_to_16_bit_wav(data) File "G:\RVC-beta-v2-0618\runtime\lib\site-packages\gradio\processing_utils.py", line 219, in convert_to_16_bit_wav if data.dtype in [np.float64, np.float32, np.float16]: AttributeError: 'NoneType' object has no attribute 'dtype'

我的也是这个,我按报错一行行找下去,大概意思是格式化音源出现问题 def convert_to_16_bit_wav(data): # Based on: https://docs.scipy.org/doc/scipy/reference/generated/scipy.io.wavfile.write.html warning = "Trying to convert audio automatically from {} to 16-bit int format." if data.dtype in [np.float64, np.float32, np.float16]: warnings.warn(warning.format(data.dtype)) data = data / np.abs(data).max() data = data * 32767 data = data.astype(np.int16) elif data.dtype == np.int32: warnings.warn(warning.format(data.dtype)) data = data / 65538 data = data.astype(np.int16) elif data.dtype == np.int16: pass elif data.dtype == np.uint16: warnings.warn(warning.format(data.dtype)) data = data - 32768 data = data.astype(np.int16) elif data.dtype == np.uint8: warnings.warn(warning.format(data.dtype)) data = data * 257 - 32768 data = data.astype(np.int16)

就是下面这里

else:
    raise ValueError(
        "Audio data cannot be converted automatically from "
        f"{data.dtype} to 16-bit int format."
    )
return data

那怎么解决呢?

Kar1chan avatar Jul 07 '23 07:07 Kar1chan

I have somewhat managed to solve this (but only for models I trained myself). Make sure to read every instruction when training your models in the "Train" tab.

For example: You can't use 48K sample rate when training V2 models. If you want to train V2 models, use 40K sample rate.

I've found out that it can sometimes bug out while you are using someone else's pretrained model. If you get the NoneType errors with existing models you've downloaded, try switching the pitch extraction algorithm to the others (pm/harvest/crepe).

CirnoChan999 avatar Jul 08 '23 22:07 CirnoChan999

I have somewhat managed to solve this (but only for models I trained myself). Make sure to read every instruction when training your models in the "Train" tab.

For example: You can't use 48K sample rate when training V2 models. If you want to train V2 models, use 40K sample rate.

I've found out that it can sometimes bug out while you are using someone else's pretrained model. If you get the NoneType errors with existing models you've downloaded, try switching the pitch extraction algorithm to the others (pm/harvest/crepe).

i was using a model i found so sadly im still having this issue, annoying since only some models are compatible with RVC

Bigwvevo avatar Jul 12 '23 13:07 Bigwvevo

I have somewhat managed to solve this (but only for models I trained myself). Make sure to read every instruction when training your models in the "Train" tab. For example: You can't use 48K sample rate when training V2 models. If you want to train V2 models, use 40K sample rate. I've found out that it can sometimes bug out while you are using someone else's pretrained model. If you get the NoneType errors with existing models you've downloaded, try switching the pitch extraction algorithm to the others (pm/harvest/crepe).

i was using a model i found so sadly im still having this issue, annoying since only some models are compatible with RVC

ok i found a RVC gui and that works for me however if you have a AMD graphics card crepe wont work

https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI

Bigwvevo avatar Jul 12 '23 14:07 Bigwvevo

ok i found a RVC gui and that works for me however if you have a AMD graphics card crepe won't work

Try to follow the steps:

  1. Use the command pip show torchcrepe to show where is torchcrepe located
  2. Look at Location: /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (For example)
  3. Go to /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/torchcrepe
  4. Open load.py with text editor, change the line torch.load(file, map_location=device)) to torch.load(file, map_location={'0': device}))

This works for me on macOS. I've submitted a pull request to that repo but I don't understand his reply, all I know is it did work for me.

Naozumi520 avatar Jul 12 '23 15:07 Naozumi520

pip install --upgrade --no-deps --force-reinstall torchcrepe

This did the trick for me

Volt24 avatar Aug 23 '23 18:08 Volt24

I still get this error despite upgrading torchcrepe and gradio (3.47.1). I implemented everything in these responses and still no luck with any of the pitch extraction algorithms :(

mabbs90 avatar Oct 15 '23 22:10 mabbs90

I solved it temporaryly it have to solve this problem anytime -you just need the original 7zip file, or redownload it with the bat file -open it in winrar and copy the system folders, especially runtime, pycache, lib, logs and temp or you can try what exact folders are needed -restart the app, if you didn't closed it before and it resetted itself. Keep the 7zip file because probably you will need it in the future. You can do it anytime if the error occours. Not the most convenient way but it 100% works!

gergo-ptnk avatar Jan 24 '24 10:01 gergo-ptnk

@Naozumi520's solution worked for me although I needed to add in some more tweaks

arghhjayy avatar Feb 18 '24 17:02 arghhjayy

@Naozumi520's solution worked for me although I needed to add in some more tweaks

@arghhjayy Do you happen to remember what else you did to make this error disappear?

gabrielxq avatar Feb 20 '24 19:02 gabrielxq

@gabrielxq I'm sorry I didn't write the steps down when I should have :/ But I think it was something macos specific, like installing a library called aria2c for downloading content I guess I didn't write down the step as I was too excited

arghhjayy avatar Feb 21 '24 05:02 arghhjayy

This issue was closed because it has been inactive for 15 days since being marked as stale.

github-actions[bot] avatar Apr 28 '24 04:04 github-actions[bot]

Same issue for me: AttributeError: 'NoneType' object has no attribute 'tobytes'

ltorsini avatar Jul 15 '24 18:07 ltorsini