Bonjour,
==>Question : Cherche les procédures d’installation complémentaires recommandées à exécuter pour palier la problématique exposée plus bas (tout en étant toujours capable d’utiliser le GPU).
==> Contexte :
Pour le projet, suis en train d’essayer de faire tourner du code permettant de localiser les parties de l’image les plus importantes pour sa catégorisation avec un modèle VGG16.
Les instructions à mettre en place sont listées sur ce site :
Au niveau de l’exécution de la ligne suivante :
grads = K.gradients(dogRace_output, last_conv_layer.output)[0]
(sur mon poste personnel Windows 10 avec carte NVIDIA GTX1080)
J’obtiens le message d’erreur suivant :
[…]
TypeError: You are passing KerasTensor(type_spec=TensorSpec(shape=(None,), dtype=tf.float32, name=None), name=‹ tf.operators.getitem/strided_slice:0 ›, description=« created by layer ‹ tf.operators.getitem › »), an intermediate Keras symbolic input/output, to a TF API that does not allow registering custom dispatchers, such as tf.cond
, tf.function
, gradient tapes, or tf.map_fn
. Keras Functional model construction only supports TF API calls that do support dispatching, such as tf.math.add
or tf.reshape
. Other APIs cannot be called directly on symbolic Kerasinputs/outputs. You can work around this limitation by putting the operation in a custom Keras layer call
and calling that layer on this symbolic input/output.
==>Hypothèse :
Compte tenu qu’un autre membre de l’équipe projet n’éprouve pas de problème à l’exécution de l’intégralité du code proposé sur le lien, je suppose (sans certitude) que la source du problème provient de mon installation de tensorflow décrite ci-après :
-J’ai initialement installé tensorflow 2.11 (via pip ).
-En l’absence de participation du GPU lors du fit des modèles, j’ai ajouté l’installation du TensorFlow-DirectML-Plugin (via pip) et le GPU a bien été pris en compte mais je pense que l’installation de ce plugin a corrompu l’installation précédente de tensorflow2.11.
-Selon les traces d’installation, ce plug-in a rétro installé certaines parties de tf 2.11 en tf 2.10 :
[…]
Installing collected packages: keras, tensorflow-estimator, keras-preprocessing, tensorboard, tensorflow-intel, tensorflow-cpu, tensorflow-directml-plugin
Attempting uninstall: keras
Found existing installation: keras 2.11.0
Uninstalling keras-2.11.0:
Successfully uninstalled keras-2.11.0
Attempting uninstall: tensorflow-estimator
Found existing installation: tensorflow-estimator 2.11.0
Uninstalling tensorflow-estimator-2.11.0:
Successfully uninstalled tensorflow-estimator-2.11.0
Attempting uninstall: tensorboard
Found existing installation: tensorboard 2.11.2
Uninstalling tensorboard-2.11.2:
Successfully uninstalled tensorboard-2.11.2
Attempting uninstall: tensorflow-intel
Found existing installation: tensorflow-intel 2.11.0
Uninstalling tensorflow-intel-2.11.0:
Successfully uninstalled tensorflow-intel-2.11.0
Successfully installed keras-2.10.0 keras-preprocessing-1.1.2 tensorboard-2.10.1 tensorflow-cpu-2.10.0 tensorflow-directml-plugin-0.4.0.dev230202 tensorflow-estimator-2.10.0 tensorflow-intel-2.10.0
Note: you may need to restart the kernel to use updated packages.
ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow 2.11.0 requires tensorflow-intel==2.11.0; platform_system == « Windows », but you have tensorflow-intel 2.10.0 which is incompatible.