SillyTavern / SillyTavern-Extras

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

AttributeError: module 'chromadb' has no attribute 'PersistentClient' #208

Open HowlWolf1209 opened 10 months ago

HowlWolf1209 commented 10 months ago

When I ran Extras with the chromadb module enabled: python server.py --enable-modules=chromadb, an error occurred: (extras) D:\AI_writer\SillyTavern-Launcher\SillyTavern-extras>python server.py --enable-modules=chromadb Using torch device: cpu Initializing ChromaDB Traceback (most recent call last): File "D:\AI_writer\SillyTavern-Launcher\SillyTavern-extras\server.py", line 282, in chromadb_client = chromadb.PersistentClient(path=args.chroma_folder, settings=Settings(anonymized_telemetry=False)) ^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'chromadb' has no attribute 'PersistentClient'

I‘ve tried to run pip install --upgrade chromadb, and it doesn't work I‘ve tried to run python server.py --enable-modules=chromadb, and it doesn't work neither I tried to install a later version of chromadb, pip install chromadb==0.4.X, and python server.py --enable-modules=chromadb a new error occurred:

Initializing ChromaDB ChromaDB is running in-memory with persistence. Persistence is stored in .chroma_db. Can be cleared by deleting the folder or purging db. Traceback (most recent call last): File "D:\AI_writer\SillyTavern-Launcher\SillyTavern-extras\server.py", line 294, in chromadb_embed_fn = embedding_functions.SentenceTransformerEmbeddingFunction(embedding_model, device=device_string) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HowlWolf\miniconda3\envs\extras\Lib\site-packages\chromadb\utils\embedding_functions.py", line 41, in init self.models[model_name] = SentenceTransformer(model_name, device=device) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HowlWolf\miniconda3\envs\extras\Lib\site-packages\sentence_transformers\SentenceTransformer.py", line 95, in init modules = self._load_sbert_model(model_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HowlWolf\miniconda3\envs\extras\Lib\site-packages\sentence_transformers\SentenceTransformer.py", line 840, in _load_sbert_model module = module_class.load(os.path.join(model_path, module_config['path'])) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HowlWolf\miniconda3\envs\extras\Lib\site-packages\sentence_transformers\models\Transformer.py", line 137, in load return Transformer(model_name_or_path=input_path, **config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HowlWolf\miniconda3\envs\extras\Lib\site-packages\sentence_transformers\models\Transformer.py", line 29, in init self._load_model(model_name_or_path, config, cache_dir) File "C:\Users\HowlWolf\miniconda3\envs\extras\Lib\site-packages\sentence_transformers\models\Transformer.py", line 49, in _load_model self.auto_model = AutoModel.from_pretrained(model_name_or_path, config=config, cache_dir=cache_dir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HowlWolf\miniconda3\envs\extras\Lib\site-packages\transformers\models\auto\auto_factory.py", line 566, in from_pretrained return model_class.from_pretrained( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HowlWolf\miniconda3\envs\extras\Lib\site-packages\transformers\modeling_utils.py", line 3706, in from_pretrained ) = cls._load_pretrained_model( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HowlWolf\miniconda3\envs\extras\Lib\site-packages\transformers\modeling_utils.py", line 4166, in _load_pretrained_model raise RuntimeError(f"Error(s) in loading state_dict for {model.class.name}:\n\t{error_msg}") RuntimeError: Error(s) in loading state_dict for MPNetModel: size mismatch for embeddings.word_embeddings.weight: copying a param with shape torch.Size([28996, 768]) from checkpoint, the shape in current model is torch.Size([30527, 768]). size mismatch for embeddings.position_embeddings.weight: copying a param with shape torch.Size([512, 768]) from checkpoint, the shape in current model is torch.Size([514, 768]). You may consider adding ignore_mismatched_sizes=True in the model from_pretrained method.

Anyone know any solutions if you have ran into this problem yourselves???

Technologicat commented 9 months ago

The old Smart Context extension has been superseded by the built-in Vector Storage extension.

Vector Storage does not need ChromaDB.

To upgrade: