Ошибки тензорного потока: cuFFT, cuDNN, cuBLAS и «Утверждение '__n < this->size()' не удалось»Python

Программы на Python
Ответить
Anonymous
 Ошибки тензорного потока: cuFFT, cuDNN, cuBLAS и «Утверждение '__n < this->size()' не удалось»

Сообщение Anonymous »

Я только начал работать с TF и ​​Keras и обнаружил, что не могу запустить их на своем компьютере. Сначала я заметил проблему в блокноте Jupyter, а затем воссоздал ее в файле Python.
Код для воспроизведения (main.py):

Код: Выделить всё

import os
os.environ["KERAS_BACKEND"] = "tensorflow"
import keras
from keras import layers
from keras import ops

print("pass")
model = keras.Sequential()
model.add(layers.Input(shape=(28,)))
print("pass")
Вывод python main.py:

Код: Выделить всё

2024-10-16 22:30:52.054073: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:477] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1729081852.071578   41750 cuda_dnn.cc:8310] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
E0000 00:00:1729081852.076640   41750 cuda_blas.cc:1418] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
pass
/usr/include/c++/14.1.1/bits/stl_vector.h:1130: constexpr std::vector::reference std::vector::operator[](size_type) [with _Tp = pybind11::object; _Alloc = std::allocator
; reference = pybind11::object&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
fish: Job 1, 'python main.py' terminated by signal SIGABRT (Abort)
Я использую Arch Linux и установил пакет python-tensorflow-opt-cuda. У меня есть карта nvidia и рабочий cuda.
Вывод nvcc --version:

Код: Выделить всё

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Sep_12_02:18:05_PDT_2024
Cuda compilation tools, release 12.6, V12.6.77
Build cuda_12.6.r12.6/compiler.34841621_0
Вывод python -c "import tensorflow as tf; print(tf.__version__)":

Код: Выделить всё

2024-10-16 22:35:45.309836: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:477] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
E0000 00:00:1729082145.328052   42393 cuda_dnn.cc:8310] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
E0000 00:00:1729082145.333326   42393 cuda_blas.cc:1418] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2.18.0-rc1
Вывод pacman -Q cuda:

Код: Выделить всё

cuda 12.6.2-1
Вывод pacman -Q cudnn:

Код: Выделить всё

cudnn 9.2.1.18-1
Вывод pacman -Q nvidia:

Код: Выделить всё

nvidia-dkms 560.35.03-14
nvidia-dkms 560.35.03-14
Вывод pacman -Q blas:

Код: Выделить всё

blas 3.12.0-5
Вывод pacman -Q python-tensorflow-opt-cuda:

Код: Выделить всё

python-tensorflow-opt-cuda 2.18rc1-2
Вывод Python pacman -Q:

Код: Выделить всё

python 3.12.7-1
Вывод pacman -Q python-numpy:

Код: Выделить всё

python-numpy 2.1.2-1

Вывод pacman -Q python-keras:

Код: Выделить всё

python-keras 3.4.1-1

Докер sudo запустит --rm --runtime=nvidia --gpus all ubuntu nvidia-smi Вывод:

Код: Выделить всё

+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 560.35.03              Driver Version: 560.35.03      CUDA Version: 12.6     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M.  |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1650        Off |   00000000:01:00.0 Off |                  N/A |
| N/A   43C    P8              1W /   50W |       8MiB /   4096MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
+-----------------------------------------------------------------------------------------+

Код: Выделить всё

Kernel: 6.11.3-zen1-1-zen
CPU: AMD Ryzen 5 4600H with Radeon Graphics (12) @ 3.000GH
GPU: NVIDIA GeForce GTX 1650 Mobile / Max-Q
Я также не понимаю, почему в репозитории пакета Archlinux указана версия tf 2.18. Разве он сейчас не нестабильен?
Я пытался переустановить все пакеты, но еще не понизил их версию. Я также пробовал использовать версию tensorflow для докера, но все равно получал те же ошибки.

Подробнее здесь: https://stackoverflow.com/questions/790 ... -size-fail
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»