jzbjyb / FLARE

Forward-Looking Active REtrieval-augmented generation (FLARE)
MIT License
545 stars 50 forks source link

So many errors about JSONDecodeError #14

Open Takeru0618 opened 8 months ago

Takeru0618 commented 8 months ago

I met so many errors about JSONDecodeError when I running ./openai.sh wikiasp configs/wikiasp_flare_config.json Did someone else meet the same question?

Process Process-3: Process Process-4: Process Process-2: Traceback (most recent call last): Traceback (most recent call last): Traceback (most recent call last): File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, kwargs) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, kwargs) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, **kwargs) json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/json/init.py", line 357, in loads return _default_decoder.decode(s) json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None

During handling of the above exception, another exception occurred:

File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/tenacity/init.py", line 382, in call result = fn(args, kwargs) File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/openai_api.py", line 200, in retrieve ctx_ids, ctx_texts = self.retriever.retrieve( Traceback (most recent call last): File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/retriever.py", line 98, in retrieve results: Dict[str, Dict[str, Tuple[float, str]]] = self.retriever.retrieve( File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/retriever.py", line 39, in retrieve all_results = search_bing_batch( File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/bing.py", line 47, in search_bing_batch results.append(search_bing_api(query, kwargs)) File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/bing.py", line 23, in search_bing_api response = response.json() File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/tenacity/init.py", line 382, in call result = fn(args, **kwargs)

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

File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/openai_api.py", line 200, in retrieve ctx_ids, ctx_texts = self.retriever.retrieve( File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/retriever.py", line 98, in retrieve results: Dict[str, Dict[str, Tuple[float, str]]] = self.retriever.retrieve( File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/retriever.py", line 39, in retrieve all_results = search_bing_batch( File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/bing.py", line 47, in search_bing_batch results.append(search_bing_api(query, **kwargs)) File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/bing.py", line 23, in search_bing_api response = response.json() Traceback (most recent call last): File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

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

File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() Traceback (most recent call last): File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, self._kwargs) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/tenacity/init.py", line 382, in call result = fn(*args, *kwargs) File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/openai_api.py", line 596, in query_agent_worker generations, probs, retrievals, traces = qagent.prompt(prompts, api_key=(get_key_func, return_key_func)) File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/openai_api.py", line 200, in retrieve ctx_ids, ctx_texts = self.retriever.retrieve( File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/openai_api.py", line 338, in prompt return self.ret_prompt(queries, api_key=api_key) File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/openai_api.py", line 378, in ret_prompt ctx_ids, ctx_texts = self.retrieve(queries_to_issue, is_question=first_ret) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/tenacity/init.py", line 289, in wrapped_f return self(f, args, kw) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/tenacity/init.py", line 379, in call do = self.iter(retry_state=retry_state) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/retriever.py", line 98, in retrieve results: Dict[str, Dict[str, Tuple[float, str]]] = self.retriever.retrieve( File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/tenacity/init.py", File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, *self._kwargs) line 326, in iter raise retry_exc from fut.exception() File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/retriever.py", line 39, in retrieve all_results = search_bing_batch( File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/openai_api.py", line 596, in query_agent_worker generations, probs, retrievals, traces = qagent.prompt(prompts, api_key=(get_key_func, return_key_func)) File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/openai_api.py", line 338, in prompt return self.ret_prompt(queries, api_key=api_key) File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/openai_api.py", line 378, in ret_prompt ctx_ids, ctx_texts = self.retrieve(queries_to_issue, is_question=first_ret) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/tenacity/init.py", line 289, in wrapped_f return self(f, args, kw) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/tenacity/init.py", line 379, in call do = self.iter(retry_state=retry_state) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/tenacity/init.py", line 326, in iter raise retry_exc from fut.exception() tenacity.RetryError: RetryError[<Future at 0x7faebc5a9bb0 state=finished raised JSONDecodeError>] File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/bing.py", line 47, in search_bing_batch results.append(search_bing_api(query, kwargs)) tenacity.RetryError: RetryError[<Future at 0x7f8f9bf6abb0 state=finished raised JSONDecodeError>] File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/bing.py", line 23, in search_bing_api response = response.json() File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

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

Traceback (most recent call last): File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/multiprocessing/process.py", line 108, in run self._target(*self._args, *self._kwargs) File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/openai_api.py", line 596, in query_agent_worker generations, probs, retrievals, traces = qagent.prompt(prompts, api_key=(get_key_func, return_key_func)) File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/openai_api.py", line 338, in prompt return self.ret_prompt(queries, api_key=api_key) File "/Users/takerufang/Desktop/MyProject/FLARE-main/src/openai_api.py", line 378, in ret_prompt ctx_ids, ctx_texts = self.retrieve(queries_to_issue, is_question=first_ret) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/tenacity/init.py", line 289, in wrapped_f return self(f, args, **kw) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/tenacity/init.py", line 379, in call do = self.iter(retry_state=retry_state) File "/Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/tenacity/init.py", line 326, in iter raise retry_exc from fut.exception() tenacity.RetryError: RetryError[<Future at 0x7fc435619b20 state=finished raised JSONDecodeError>] 0%| | 0/500 [00:05<?, ?it/s] INFO:root:keys performance /Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/numpy/core/fromnumeric.py:3432: RuntimeWarning: Mean of empty slice. return _methods._mean(a, axis=axis, dtype=dtype, /Users/takerufang/miniconda3/envs/torch/lib/python3.8/site-packages/numpy/core/_methods.py:190: RuntimeWarning: invalid value encountered in double_scalars ret = ret.dtype.type(ret / rcount)

Takeru0618 commented 8 months ago

The question has been solved.