Re: Встречайте, ChatGPT - бот который может поддерживать беседу
Добавлено: Чт июл 04, 2024 1:12 pm
Gemini выступил лучше. Слегка. Ступил только в полях
Для бывших участников forum.privet.com
https://20557.qwva1.group/
The error in the provided Python code is likely related to the function `something(c, d)` not returning a tuple with exactly two elements. You should investigate the following possibilities:
If `something` is actually a class, the code snippet you provided would be incorrect because classes themselves do not return tuples directly. The issue could then be related to how the class is being instantiated or how its methods/properties are being used. Let's break down possible issues and where to look for errors.
The error `CUFFT_INTERNAL_ERROR` typically arises from issues related to the CUDA FFT (Fast Fourier Transform) library. In your case, this error could stem from several potential reasons:Uzito писал(а): ↑what could be a reason the following code crashes with cuFFT error: CUFFT_INTERNAL_ERROR
import torch
dev=torch.device("cuda")
t_audio = torch.load('audio.pt', map_location=dev)
t_window = torch.load('window.pt', map_location=dev)
print("GPU:", torch.cuda.get_device_name())
fft = torch.stft(
input = t_audio,
n_fft = 1024,
hop_length = 256,
win_length = 1024,
window = t_window,
center = True,
return_complex = True,
)
here's the output using dummy tensors CUDA available: True CUDA version: 11.8 t_audio shape: torch.Size([1, 16000]) t_window shape: torch.Size([1024]) Traceback (most recent call last): File "G:\fft_test\fft.py", line 17, in <module> fft = torch.stft( File "G:\fft_test\venv\lib\site-packages\torch\functional.py", line 665, in stft return _VF.stft(input, n_fft, hop_length, win_length, window, # type: ignore[attr-defined] RuntimeError: cuFFT error: CUFFT_INTERNAL_ERROR
Thank you for providing the additional information. Given that you are still encountering the `CUFFT_INTERNAL_ERROR` even with the dummy tensors, there are a few more aspects we can check and steps we can try:Uzito писал(а): ↑here's the output using dummy tensors
CUDA available: True
CUDA version: 11.8
t_audio shape: torch.Size([1, 16000])
t_window shape: torch.Size([1024])
Traceback (most recent call last):
File "G:\fft_test\fft.py", line 17, in <module>
fft = torch.stft(
File "G:\fft_test\venv\lib\site-packages\torch\functional.py", line 665, in stft
return _VF.stft(input, n_fft, hop_length, win_length, window, # type: ignore[attr-defined]
RuntimeError: cuFFT error: CUFFT_INTERNAL_ERROR
new output CUDA available: True CUDA version: 11.8 CUDNN version: 8700 t_audio shape: torch.Size([1, 16000]) t_window shape: torch.Size([1024]) STFT Error: cuFFT error: CUFFT_INTERNAL_ERROR
Since the issue persists even with simplified dummy tensors and after confirming that CUDA and cuDNN are correctly installed, we need to explore other potential solutions. Here are additional steps to help diagnose and potentially resolve this problem:
Thank you for the feedback. Since `torch.fft.fft` is failing but `scipy.signal.stft` works fine, it seems like the issue is specifically related to the CUDA FFT operations in PyTorch.
Yes, you can perform the `torch.stft` operation on the CPU by ensuring that the tensors used in the operation are moved to the CPU. This is a straightforward way to avoid the `cuFFT` issues by running the STFT on the CPU.
I'm getting "Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument mat2 in method wrapper_CUDA_bmm)" error now when I try to use fft value.
This error occurs because the result of the `torch.stft` operation is on the CPU, but subsequent operations may expect tensors to be on the same device (CUDA). If you need to use the result for further computations on the GPU, you'll need to move the result back to the GPU after performing the STFT on the CPU.
The issue you're encountering might be related to how the code interacts with the underlying hardware, specifically when using HIP (Heterogeneous-Computing Interface for Portability) on AMD GPUs. The presence of `print` statements can sometimes alter the execution timing or the memory allocation patterns, inadvertently avoiding race conditions, memory access issues, or other parallel computing pitfalls.Uzito писал(а): ↑Any idea why this function without a print statement would crash but does not if the print statement is present?
def fused_add_tanh_sigmoid_multiply(input_a, input_b, n_channels):
"""
Fused add tanh sigmoid multiply operation.
Args:
input_a: The first input tensor.
input_b: The second input tensor.
n_channels: The number of channels.
Returns:
The result of the fused operation.
"""
n_channels_int = n_channels[0]
in_act = input_a + input_b
t_act = torch.tanh(in_act[:, :n_channels_int, :])
s_act = torch.sigmoid(in_act[:, n_channels_int:, :])
print('this avoids HIP crash somehow')
acts = t_act * s_act
return acts