-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I do training, I get this error : AttributeError: 'FigureCanvasAgg' object has no attribute 'tostring_rgb' #2499
Comments
you probably already seen this previous thread ? : |
matplotlib==3.7.0, |
I had matplotlib 3.7.1 ==> installed 3.7.0 instead. Same result :(
|
After many, many tests... I finally fixed it in a very dumb way ;D Then...one hour ago... i decided to try an other way that i saw in other videos. Everything worked fine at first try. |
was not a waste of time. you got it working, you learned something, and you shared it. thank you! |
can you help me do that too ? i have the same problem .. i installed it using a one line code shown in https://www.youtube.com/watch?v=Y8IxVVQBEpc i even tried downgrading matplotlib and numpy |
I encourage you to try my method (as explained 2 messages above)... After spending days fighting with version conflicts, i installed what i think is the "standalone pack". It probably take more space on your hard-drive... but it worked at first try after :) I hope it'll do for you too. |
replac \infer\lib\train\utils.py, line 238, line 239 with these codes data = np.frombuffer(fig.canvas.buffer_rgba(), dtype=np.uint8) add this codedata = data[..., :3] plt.close() it works for me (matplotlib=3.10.1, numpy=1.26.4) |
2025-02-24 11:37:11 | INFO | main | Use gpus: 0
2025-02-24 11:37:11 | INFO | main | Execute: "C:\pinokio\api\rvc.pinokio.git\app\env\Scripts\python.exe" infer/modules/train/train.py -e "mi-test" -sr 48k -f0 1 -bs 8 -g 0 -te 20 -se 5 -pg assets/pretrained_v2/f0G48k.pth -pd assets/pretrained_v2/f0D48k.pth -l 0 -c 0 -sw 0 -v v2
INFO:mi-test:{'data': {'filter_length': 2048, 'hop_length': 480, 'max_wav_value': 32768.0, 'mel_fmax': None, 'mel_fmin': 0.0, 'n_mel_channels': 128, 'sampling_rate': 48000, 'win_length': 2048, 'training_files': './logs\mi-test/filelist.txt'}, 'model': {'filter_channels': 768, 'gin_channels': 256, 'hidden_channels': 192, 'inter_channels': 192, 'kernel_size': 3, 'n_heads': 2, 'n_layers': 6, 'p_dropout': 0, 'resblock': '1', 'resblock_dilation_sizes': [[1, 3, 5], [1, 3, 5], [1, 3, 5]], 'resblock_kernel_sizes': [3, 7, 11], 'spk_embed_dim': 109, 'upsample_initial_channel': 512, 'upsample_kernel_sizes': [24, 20, 4, 4], 'upsample_rates': [12, 10, 2, 2], 'use_spectral_norm': False}, 'train': {'batch_size': 8, 'betas': [0.8, 0.99], 'c_kl': 1.0, 'c_mel': 45, 'epochs': 20000, 'eps': 1e-09, 'fp16_run': True, 'init_lr_ratio': 1, 'learning_rate': 0.0001, 'log_interval': 200, 'lr_decay': 0.999875, 'seed': 1234, 'segment_size': 17280, 'warmup_epochs': 0}, 'model_dir': './logs\mi-test', 'experiment_dir': './logs\mi-test', 'save_every_epoch': 5, 'name': 'mi-test', 'total_epoch': 20, 'pretrainG': 'assets/pretrained_v2/f0G48k.pth', 'pretrainD': 'assets/pretrained_v2/f0D48k.pth', 'version': 'v2', 'gpus': '0', 'sample_rate': '48k', 'if_f0': 1, 'if_latest': 0, 'save_every_weights': '0', 'if_cache_data_in_gpu': 0}
C:\pinokio\api\rvc.pinokio.git\app\env\lib\site-packages\torch\nn\utils\weight_norm.py:30: UserWarning: torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.
warnings.warn("torch.nn.utils.weight_norm is deprecated in favor of torch.nn.utils.parametrizations.weight_norm.")
DEBUG:infer.lib.infer_pack.models:gin_channels: 256, self.spk_embed_dim: 109
INFO:mi-test:loaded pretrained assets/pretrained_v2/f0G48k.pth
INFO:mi-test:
INFO:mi-test:loaded pretrained assets/pretrained_v2/f0D48k.pth
INFO:mi-test:
C:\pinokio\api\rvc.pinokio.git\app\env\lib\site-packages\torch\autograd_init_.py:251: UserWarning: Grad strides do not match bucket view strides. This may indicate grad was not created according to the gradient layout contract, or that the param's strides changed since DDP was constructed. This is not an error, but may impair performance.
grad.sizes() = [64, 1, 4], strides() = [4, 1, 1]
bucket_view.sizes() = [64, 1, 4], strides() = [4, 4, 1] (Triggered internally at ..\torch\csrc\distributed\c10d\reducer.cpp:334.)
Variable._execution_engine.run_backward( # Calls into the C++ engine to run the backward pass
INFO:mi-test:Train Epoch: 1 [0%]
INFO:mi-test:[0, 0.0001]
INFO:mi-test:loss_disc=3.742, loss_gen=3.616, loss_fm=10.436,loss_mel=29.701, loss_kl=9.000
DEBUG:matplotlib:matplotlib data path: C:\pinokio\api\rvc.pinokio.git\app\env\lib\site-packages\matplotlib\mpl-data
DEBUG:matplotlib:CONFIGDIR=C:\Users\trika.matplotlib
DEBUG:matplotlib:interactive is False
DEBUG:matplotlib:platform is win32
Process Process-1:
Traceback (most recent call last):
File "C:\pinokio\bin\miniconda\lib\multiprocessing\process.py", line 314, in _bootstrap
self.run()
File "C:\pinokio\bin\miniconda\lib\multiprocessing\process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "C:\pinokio\api\rvc.pinokio.git\app\infer\modules\train\train.py", line 268, in run
train_and_evaluate(
File "C:\pinokio\api\rvc.pinokio.git\app\infer\modules\train\train.py", line 545, in train_and_evaluate
"slice/mel_org": utils.plot_spectrogram_to_numpy(
File "C:\pinokio\api\rvc.pinokio.git\app\infer\lib\train\utils.py", line 238, in plot_spectrogram_to_numpy
data = np.fromstring(fig.canvas.tostring_rgb(), dtype=np.uint8, sep="")
AttributeError: 'FigureCanvasAgg' object has no attribute 'tostring_rgb'
The text was updated successfully, but these errors were encountered: