private-gpt icon indicating copy to clipboard operation
private-gpt copied to clipboard

OSError: It looks like the config file at 'models/ggml-model-q4_0.bin' is not a valid JSON file.

Open sandyrs9421 opened this issue 1 year ago • 1 comments

Hello All ,

when i run python3 ingest.py file on my MAC i am seeing below error. I saw one of the solution (https://github.com/imartinez/privateGPT/issues/564) where i updated with 2 lines of code post which as well i am seeing the same error. can anyone help guide me on this ?

Error - File "/usr/local/lib/python3.11/site-packages/transformers/configuration_utils.py", line 662, in _get_config_dict raise EnvironmentError OSError: It looks like the config file at 'models/ggml-model-q4_0.bin' is not a valid JSON file.

sandyrs9421 avatar Jun 14 '23 06:06 sandyrs9421

I have the same issue, I tried the 2 lines solution as well, but it did not help. Did someone find another solution for that problem?

EnesK55 avatar Jun 16 '23 16:06 EnesK55

I have similar problem in Ubuntu

python3 ingest.py No sentence-transformers model found with name models/ggml-gpt4all-j-v1.3-groovy.bin. Creating a new one with MEAN pooling. Traceback (most recent call last): File "/home/dell/.local/lib/python3.10/site-packages/transformers/configuration_utils.py", line 659, in _get_config_dict config_dict = cls._dict_from_json_file(resolved_config_file) File "/home/dell/.local/lib/python3.10/site-packages/transformers/configuration_utils.py", line 750, in _dict_from_json_file text = reader.read() File "/usr/lib/python3.10/codecs.py", line 322, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe0 in position 4: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/dell/dell/openAI/privateGPT/ingest.py", line 171, in main() File "/home/dell/dell/openAI/privateGPT/ingest.py", line 148, in main embeddings = HuggingFaceEmbeddings(model_name=embeddings_model_name) File "/home/dell/.local/lib/python3.10/site-packages/langchain/embeddings/huggingface.py", line 59, in init self.client = sentence_transformers.SentenceTransformer( File "/home/dell/.local/lib/python3.10/site-packages/sentence_transformers/SentenceTransformer.py", line 97, in init modules = self._load_auto_model(model_path) File "/home/dell/.local/lib/python3.10/site-packages/sentence_transformers/SentenceTransformer.py", line 806, in _load_auto_model transformer_model = Transformer(model_name_or_path) File "/home/dell/.local/lib/python3.10/site-packages/sentence_transformers/models/Transformer.py", line 28, in init config = AutoConfig.from_pretrained(model_name_or_path, **model_args, cache_dir=cache_dir) File "/home/dell/.local/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 944, in from_pretrained config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs) File "/home/dell/.local/lib/python3.10/site-packages/transformers/configuration_utils.py", line 574, in get_config_dict config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs) File "/home/dell/.local/lib/python3.10/site-packages/transformers/configuration_utils.py", line 662, in _get_config_dict raise EnvironmentError( OSError: It looks like the config file at 'models/ggml-gpt4all-j-v1.3-groovy.bin' is not a valid JSON file.

kirill01012020 avatar Jun 21 '23 11:06 kirill01012020

I partly solved the problem. I said partly because I had to change the embeddings_model_name from ggml-model-q4_0.bin to all-MiniLM-L6-v2. If you can switch to this one too, it should work with the following .env file:

PERSIST_DIRECTORY=db MODEL_TYPE=GPT4All MODEL_PATH=models/ggml-gpt4all-j-v1.3-groovy.bin EMBEDDINGS_MODEL_NAME=all-MiniLM-L6-v2 MODEL_N_CTX=1000 MODEL_N_BATCH=8 TARGET_SOURCE_CHUNKS=4

You do not have to download all-MiniLM-L6-v2, somehow it works without.

EnesK55 avatar Jun 21 '23 12:06 EnesK55

I've tried all the suggestions. I'm on MAC OS. This is my .env:

PERSIST_DIRECTORY=db
MODEL_TYPE=GPT4All
MODEL_PATH=/Users/myusername/devwrk/python/privateGPT/models/ggml-gpt4all-j-v1.3-groovy.bin
EMBEDDINGS_MODEL_NAME=all-MiniLM-L6-v2
MODEL_N_CTX=1000
MODEL_N_BATCH=8
TARGET_SOURCE_CHUNKS=4

It seemed to download the all-MiniLM-L6-v2 but now its saying:

python privateGPT.py
  File "/Users/myusername/devwrk/python/privateGPT/privateGPT.py", line 34
    match model_type:
          ^
SyntaxError: invalid syntax

PrivateGPT.py: image image

image

I'll try get the debugger working as I don't do Python stuff normally.

Update. I'm not getting the error now. Its running. Buuut very slow - need a decent GPU! I just commented out the case statement as per: image

outsidecoder avatar Jul 17 '23 18:07 outsidecoder