error all of a sudden without changing anything

#25
by leomastoras - opened

hi, i was using this very fine until 2 days ago and now i get this error what happened?

2024-12-13 01:05:48.828205: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0.
2024-12-13 01:05:49.946681: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0.
Traceback (most recent call last):
File "C:\Users\Leonidas\AppData\Local\Programs\Python\Python311\Lib\site-packages\transformers\activations_tf.py", line 22, in
import tf_keras as keras
ModuleNotFoundError: No module named 'tf_keras'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Leonidas\AppData\Local\Programs\Python\Python311\Lib\site-packages\transformers\utils\import_utils.py", line 1778, in get_module
return importlib.import_module("." + module_name, self.name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leonidas\AppData\Local\Programs\Python\Python311\Lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "C:\Users\Leonidas\AppData\Local\Programs\Python\Python311\Lib\site-packages\transformers\models\segformer\modeling_tf_segformer.py", line 24, in
from ...activations_tf import get_tf_activation
File "C:\Users\Leonidas\AppData\Local\Programs\Python\Python311\Lib\site-packages\transformers\activations_tf.py", line 27, in
raise ValueError(
ValueError: Your currently installed version of Keras is Keras 3, but this is not yet supported in Transformers. Please install the backwards-compatible tf-keras package with pip install tf-keras.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\Leonidas\xvision\api.py", line 21, in
segmenter = pipeline(model="mattmdjaga/segformer_b2_clothes",device='cuda')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leonidas\AppData\Local\Programs\Python\Python311\Lib\site-packages\transformers\pipelines_init_.py", line 926, in pipeline
framework, model = infer_framework_load_model(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leonidas\AppData\Local\Programs\Python\Python311\Lib\site-packages\transformers\pipelines\base.py", line 264, in infer_framework_load_model
_class = getattr(transformers_module, f"TF{architecture}", None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leonidas\AppData\Local\Programs\Python\Python311\Lib\site-packages\transformers\utils\import_utils.py", line 1767, in getattr
value = getattr(module, name)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leonidas\AppData\Local\Programs\Python\Python311\Lib\site-packages\transformers\utils\import_utils.py", line 1766, in getattr
module = self._get_module(self._class_to_module[name])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leonidas\AppData\Local\Programs\Python\Python311\Lib\site-packages\transformers\utils\import_utils.py", line 1780, in _get_module
raise RuntimeError(
RuntimeError: Failed to import transformers.models.segformer.modeling_tf_segformer because of the following error (look up to see its traceback):
Your currently installed version of Keras is Keras 3, but this is not yet supported in Transformers. Please install the backwards-compatible tf-keras package with pip install tf-keras.

installing keras solved it but there are still these messages

2024-12-13 01:17:25.906104: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0.
2024-12-13 01:17:27.009068: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0.
WARNING:tensorflow:From C:\Users\Leonidas\AppData\Local\Programs\Python\Python311\Lib\site-packages\tf_keras\src\losses.py:2976: The name tf.losses.sparse_softmax_cross_entropy is deprecated. Please use tf.compat.v1.losses.sparse_softmax_cross_entropy instead.

As nothing in this model has changed in the last 6 months, I don't think the issue is coming from it. And as the warnings indicate, it's to do with tensorflow, but doesn't seem like it should be causing any actual errors.

Sign up or log in to comment