Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONDecodeError when trying to execute basic and advanced python scripts #12

Open
NamburiSrinath opened this issue Nov 3, 2022 · 4 comments

Comments

@NamburiSrinath
Copy link

Can you update how to fix this issue?

I am working on GPT-J to generate prompts and I am unable to run the code.

During handling of the above exception, another exception occurred:

I am getting the following error when I tried running python basic_usage_template.py and python advanced_usage_template.py

Traceback (most recent call last):
  File "/hdd2/srinath/gpt-j/advanced_usage_template.py", line 58, in <module>
    response = context_setting.completion(prompt,
  File "/hdd2/srinath/anaconda3/envs/SD_Aug/lib/python3.10/site-packages/gpt_j/gptj_api.py", line 67, in completion
    self.response = generate(f"{self.new_prompt} {user}: {self.main_intention}", token_max_length=max_tokens, temperature=temperature, top_p=top_p, top_k=top_k, rep=rep)
  File "/hdd2/srinath/anaconda3/envs/SD_Aug/lib/python3.10/site-packages/gpt_j/Gptj.py", line 12, in generate
    result = URL.json()
  File "/hdd2/srinath/anaconda3/envs/SD_Aug/lib/python3.10/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)

My python version is 3.10.6

@TheProtaganist
Copy link
Owner

Try https://www.banana.dev/ I'm sorry tried to create an open source libary for python although it looks like it's very hard to find a working gptj api.

@kiritoyu
Copy link

kiritoyu commented Mar 4, 2023

how to fix it?i run demo throw the same exception.

@anrahman4
Copy link

anrahman4 commented Mar 15, 2023

I am also trying to run the basic usage and also have the same error posted by @NamburiSrinath.

Is there any fix to this?

Traceback (most recent call last):
  File "C:\Users\rahmaa\PycharmProjects\chatgpt\venv\lib\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\rahmaa\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\rahmaa\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\rahmaa\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
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 "C:\Users\rahmaa\PycharmProjects\chatgpt\venv\test.py", line 11, in <module>
    query = simple_completion(prompt, length=max_length, temp=temperature, top_p=top_probability, top_k=top_k, rep=repetition)
  File "C:\Users\rahmaa\PycharmProjects\chatgpt\venv\lib\site-packages\gpt_j\Basic_api.py", line 13, in simple_completion
    return generate(Prompt, length, temperature=temp, top_p=top_p, top_k=top_k, rep=rep).strip() if Prompt else "Empty Prompt detected"
  File "C:\Users\rahmaa\PycharmProjects\chatgpt\venv\lib\site-packages\gpt_j\Gptj.py", line 12, in generate
    result = URL.json()
  File "C:\Users\rahmaa\PycharmProjects\chatgpt\venv\lib\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) 

@NamburiSrinath
Copy link
Author

I am unable to find any fix so far!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants