Akash
Akash

Reputation: 359

AttributeError: 'Collection' object has no attribute '__pydantic_private__'. Did you mean: '__pydantic_complete__'?

I am trying to create pdf chat using open source LLM. I get the below error when I run ingest.py

(my_venv) PS C:\GithubRepository\Chat-with-PDF-Chatbot> python ingest.py            
bill.pdf
splitting into chunks
Loading sentence transformers model
C:\GithubRepository\Chat-with-PDF-Chatbot\my_venv\lib\site-packages\bitsandbytes\cextension.py:34: UserWarning: The installed version of bitsandbytes was compiled without GPU support. 8-bit optimizers, 8-bit multiplication, and GPU quantization are unavailable.
  warn("The installed version of bitsandbytes was compiled without GPU support. "
'NoneType' object has no attribute 'cadam32bit_grad_fp32'
Creating embeddings. May take some minutes...
Traceback (most recent call last):
  File "C:\GithubRepository\Chat-with-PDF-Chatbot\ingest.py", line 33, in <module>
    main()
  File "C:\GithubRepository\Chat-with-PDF-Chatbot\ingest.py", line 26, in main
    db = Chroma.from_documents(texts, embeddings, persist_directory="db", client_settings=CHROMA_SETTINGS)
  File "C:\GithubRepository\Chat-with-PDF-Chatbot\my_venv\lib\site-packages\langchain\vectorstores\chroma.py", line 613, in from_documents
    return cls.from_texts(
  File "C:\GithubRepository\Chat-with-PDF-Chatbot\my_venv\lib\site-packages\langchain\vectorstores\chroma.py", line 568, in from_texts
    chroma_collection = cls(
  File "C:\GithubRepository\Chat-with-PDF-Chatbot\my_venv\lib\site-packages\langchain\vectorstores\chroma.py", line 126, in __init__
    self._collection = self._client.get_or_create_collection(
  File "C:\GithubRepository\Chat-with-PDF-Chatbot\my_venv\lib\site-packages\chromadb\api\local.py", line 141, in get_or_create_collection
    return self.create_collection(
  File "C:\GithubRepository\Chat-with-PDF-Chatbot\my_venv\lib\site-packages\chromadb\api\local.py", line 111, in create_collection
    return Collection(
  File "C:\GithubRepository\Chat-with-PDF-Chatbot\my_venv\lib\site-packages\chromadb\api\models\Collection.py", line 52, in __init__
    self._client = client
  File "C:\GithubRepository\Chat-with-PDF-Chatbot\my_venv\lib\site-packages\pydantic\main.py", line 768, in __setattr__
    if self.__pydantic_private__ is None or name not in self.__private_attributes__:
  File "C:\GithubRepository\Chat-with-PDF-Chatbot\my_venv\lib\site-packages\pydantic\main.py", line 756, in __getattr__
    return super().__getattribute__(item)  # Raises AttributeError if appropriate
AttributeError: 'Collection' object has no attribute '__pydantic_private__'. Did you mean: '__pydantic_complete__'?
(my_venv) PS C:\GithubRepository\Chat-with-PDF-Chatbot> 

I tried installing different versions of pydantic, pydantic_settings with chromadb Version: 0.3.26 but nothing worked. Would like to know the compatible versions of pydantic and pydantic_settings. I am using python 3.10

Upvotes: 0

Views: 1325

Answers (2)

Oscar Rangel
Oscar Rangel

Reputation: 1056

Downgrading to chromadb==0.5.3 worked for me

Upvotes: 1

j3ffyang
j3ffyang

Reputation: 2470

Lowering the version of pydantic might help

pip list | grep pydantic

pydantic                                 2.5.1
pydantic_core                            2.14.3
pydantic-settings                        2.1.0

Upvotes: 0

Related Questions