frdel / agent-zero

Agent Zero AI framework
Other
4.79k stars 1.05k forks source link

"Failed to import transformers.trainer" Failed to initialize due to choosing HuggingFaceEmbeddings or something else? #57

Closed nessystudio closed 2 months ago

nessystudio commented 2 months ago

I tried too initialize for the first time, but failed. (Is it easier to use OpenAI for setting up the local config on first run? I believe the goal of all AI systems should be local first, perhaps this has been overlooked.)

Debug Console:

Initializing framework...
2024-08-07 18:05:06.975918: I tensorflow/core/util/port.cc:113] 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:\Python311\Lib\site-packages\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.

I had added the env variable, but still getting the error.

Runtime Error:

Exception has occurred: RuntimeError
Failed to import transformers.trainer because of the following error (look up to see its traceback):
cannot import name 'is_mlu_available' from 'accelerate.utils' (c:\Python311\Lib\site-packages\accelerate\utils\__init__.py)
ImportError: cannot import name 'is_mlu_available' from 'accelerate.utils' (c:\Python311\Lib\site-packages\accelerate\utils\__init__.py)

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

  File "C:\Users\user\Dev\agent-zero\models.py", line 34, in get_huggingface_embedding
    return HuggingFaceEmbeddings(model_name=model_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\Dev\agent-zero\main.py", line 33, in initialize
    embedding_llm = models.get_huggingface_embedding(model_name="sentence-transformers/all-MiniLM-L6-v2")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\Dev\agent-zero\main.py", line 157, in <module>
    initialize()
RuntimeError: Failed to import transformers.trainer because of the following error (look up to see its traceback):
cannot import name 'is_mlu_available' from 'accelerate.utils' (c:\Python311\Lib\site-packages\accelerate\utils\__init__.py)
nessystudio commented 2 months ago

Fixed by using Ollama embeddings on first run.