gpt-j
gpt-j copied to clipboard
context_setting.completion error
Hi,
I am getting the following error from context_setting.completion API. I have tried both basic and adv example but similar issue.
Any pointers on how to resolve this?
Thanks!
/usr/lib/python3.7/json/decoder.py in raw_decode(self, s, idx) 353 obj, end = self.scan_once(s, idx) 354 except StopIteration as err: --> 355 raise JSONDecodeError("Expecting value", s, err.value) from None 356 return obj, end
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
=================================================================
My code based on your example:
from gpt_j.Basic_api import simple_completion
In the prompt enter something you want to generate
prompt = "def perfect_square(num):"
Max length of completion
Max = 200
Temperature controls the creativity of the model
A low temperature means the model will take less changes when completing a prompt
A high temperature will make the model more creative
Both temperature and top probability must be a float
temperature = 0.6
top probability is an alternative way to control the randomness of the model
top_probability = 1.0
top_k is the number of top responses to return
This is the number of responses the model will return
top_k = 1
Rep is the number of times the model will repeat itself
This is the number of times the model will repeat itself when generating a response
rep = 0.216
Here you set query equal to the desired values
Note values higher that 512 tend to take more time to generate
res = context_setting.completion(prompt, user=User, bot=Bot, max_tokens=max_tokens, temperature=temperature, top_p=top_probability, top_k=top_k, rep=repetition)
Finally we print the result
print(res)
pls ignore this. I found an alternate way to achieve this.
The python package needs updating, I am very busy with school but I'll try to fix this when I get a chance
On Wed, Sep 21, 2022, 3:37 PM shivatmica @.***> wrote:
pls ignore this. I found an alternate way to achieve this.
— Reply to this email directly, view it on GitHub https://github.com/TheProtaganist/gpt-j/issues/9#issuecomment-1254143763, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK2ESRECH2WH7KZTO7EX4HTV7NPWLANCNFSM6AAAAAAQO42LII . You are receiving this because you are subscribed to this thread.Message ID: @.***>
How did you fix it?
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