SillyTavern / SillyTavern-Extras

Extensions API for SillyTavern.
GNU Affero General Public License v3.0
563 stars 133 forks source link

ChromaDB Not working. #102

Closed Tomolasthill closed 1 year ago

Tomolasthill commented 1 year ago

Yes, I've seen there are two other open issues. Posting a new one here to bring more transparency to it and to provide information. I don't know when it broke, as I have auto-connect for Extra API. But today I noticed it was broken and has probably been for some time.

When trying to start SillyTavern Extra, it gave the following error when initializing ChromaDB:

Initializing ChromaDB
Traceback (most recent call last):
  File "F:\LLM\TavernExtra\[server.py](http://server.py/)", line 268, in <module>
    chromadb_client = chromadb.PersistentClient(path=args.chroma_folder, settings=Settings(anonymized_telemetry=False))
AttributeError: module 'chromadb' has no attribute 'PersistentClient'

F:\LLM\TavernExtra>pause
Press any key to continue . . .

I checked here and saw someone having same issue and had it fixed by upgrading it:

pip install --upgrade chromadb` 
This upgraded my ChromaDB from 0.3.3 or something to 0.4.4
`PS F:\LLM> pip show chromadb
Name: chromadb
Version: 0.4.4
Summary: Chroma.
Home-page:
Author:
Author-email: Jeff Huber <jeff@trychroma.com>, Anton Troynikov <anton@trychroma.com>
License:
Location: c:\python\python310\lib\site-packages
Requires: chroma-hnswlib, fastapi, importlib-resources, numpy, onnxruntime, overrides, posthog, pulsar-client, pydantic, pypika, requests, tokenizers, tqdm, typing-extensions, uvicorn
Required-by:

However, this didn't help. It did, however, give me a new error message log:

F:\LLM\TavernExtra>python server.py --enable-modules=chromadb
Using torch device: cpu
Initializing ChromaDB
Traceback (most recent call last):
  File "F:\LLM\TavernExtra\server.py", line 268, in <module>
    chromadb_client = chromadb.PersistentClient(path=args.chroma_folder, settings=Settings(anonymized_telemetry=False))
  File "C:\Python\Python310\lib\site-packages\chromadb\__init__.py", line 73, in PersistentClient
    return Client(settings)
  File "C:\Python\Python310\lib\site-packages\chromadb\__init__.py", line 110, in Client
    api = system.instance(API)
  File "C:\Python\Python310\lib\site-packages\chromadb\config.py", line 195, in instance
    impl = type(self)
  File "C:\Python\Python310\lib\site-packages\chromadb\api\segment.py", line 82, in __init__
    self._manager = self.require(SegmentManager)
  File "C:\Python\Python310\lib\site-packages\chromadb\config.py", line 134, in require
    inst = self._system.instance(type)
  File "C:\Python\Python310\lib\site-packages\chromadb\config.py", line 195, in instance
    impl = type(self)
  File "C:\Python\Python310\lib\site-packages\chromadb\segment\impl\manager\local.py", line 73, in __init__
    // PersistentLocalHnswSegment.get_file_handle_count()
  File "C:\Python\Python310\lib\site-packages\chromadb\segment\impl\vector\local_persistent_hnsw.py", line 398, in get_file_handle_count
    hnswlib_count = hnswlib.Index.file_handle_count
AttributeError: type object 'hnswlib.Index' has no attribute 'file_handle_count

F:\LLM\TavernExtra>pause
Press any key to continue . . .

PersistentClient is still.. Persistent issue. But I now have more errors. I tried to just re-install the requirement for SillyTavern Extra pip install -r requirements-complete.txt and I uninstalled chromaDB and reinstalled it:

pip uninstall chromadb
pip install chromadb

I still have the same issue and can't use chromadb (main reason I use Extras).. Hope this is an ChromaDB issue with Extras, and not a python dependencies issue and/or is difficult to solve.

Anyhow, heading to bed. May not reply for a while.

Cohee1207 commented 1 year ago

Create a new conda env and reinstall dependencies. System Python installs are not recommended, they are hard to diagnose.

Acruid commented 1 year ago

Removing and reinstalling the entire conda environment from the beginning worked for me.

EriIaz commented 1 year ago

Removing and reinstalling the entire conda environment from the beginning worked for me.

But it didn't work for me, sadly. Can you share the process please? The version of python, the version of libraries, the contents of your requirements.txt and requirements-complete.txt?

Tomolasthill commented 1 year ago

Create a new conda env and reinstall dependencies. System Python installs are not recommended, they are hard to diagnose.

I see.. Though, I'd rather not install Conda atm. I'll do it later if the issue doesn't 'magically' resolve itself after a while. For now I've 'fixed' the issue by just reverting to a previous state with git checkout command. ChromaDB works for now.

Sanicoke commented 1 year ago

Create a new conda env and reinstall dependencies. System Python installs are not recommended, they are hard to diagnose.

I've tried everything and am currently following the new install guide with conda on Arch Linux and I currently get this error constantly with nothing actually being stored. I've deleted the conda environment multiple times having it always giving me a similar error.

Queried empty/missing collection for 'CharacterHere - 2023-8-8 @10h 08m 04s 142ms'.
127.0.0.1 - - [08/Aug/2023 04:02:27] "POST /api/chromadb/query HTTP/1.1" 200 -
Cohee1207 commented 1 year ago

@Sanicoke collection only populates when the chat crosses a specific threshold. Please, screenshot your extension settings. And let me know how long is your chat.

rosx27 commented 1 year ago

Create a new conda env and reinstall dependencies. System Python installs are not recommended, they are hard to diagnose.

I've tried everything and am currently following the new install guide with conda on Arch Linux and I currently get this error constantly with nothing actually being stored. I've deleted the conda environment multiple times having it always giving me a similar error.

Queried empty/missing collection for 'CharacterHere - 2023-8-8 @10h 08m 04s 142ms'.
127.0.0.1 - - [08/Aug/2023 04:02:27] "POST /api/chromadb/query HTTP/1.1" 200 -

same here

Cohee1207 commented 1 year ago

Cleaning up ChromaDB issues into one: https://github.com/SillyTavern/SillyTavern-Extras/issues/110