422 mistake
oogxdd opened this issue · 5 comments
i'm getting 422 error when trying to fetch from my node server
do you know what might be the reason?
im assuming it might be something to do with cross-domain access as on your demo site it works fine
is there a way to play around gpt-j api (from my server) without running my own instance?
Hi @maximignatev!
The 422 error seems related to an ill-formed call to the API (https://stackoverflow.com/questions/59929028/python-fastapi-error-422-with-post-request).
How are you calling the API? I provide two alternatives that are working for me, from an external machine:
- Bash:
curl -X 'POST' \
'http://api.vicgalle.net:5000/generate?context=In%20a%20shocking%20finding%2C%20scientists%20discovered%20a%20herd%20of%20unicorns%20living%20in%20a%20remote%2C%20previously%20unexplored%20valley%2C%20in%20the%20Andes%20Mountains.%20Even%20more%20surprising%20to%20the%20researchers%20was%20the%20fact%20that%20the%20unicorns%20spoke%20perfect%20English.&token_max_length=512&temperature=1&top_p=0.9' \
-H 'accept: application/json' \
-d ''
- Python:
import requests
context = "In a shocking finding, scientist discovered a herd of unicorns living in a remote, previously unexplored valley, in the Andes Mountains. Even more surprising to the researchers was the fact that the unicorns spoke perfect English."
payload = {
"context": context,
"token_max_length": 512,
"temperature": 1.0,
"top_p": 0.9,
}
query = requests.post("http://api.vicgalle.net:5000/generate", params=payload)
response = query.json()
print(response)
Let me know if those work for you!
Hey. So I been trying to use the api from the node server (next.js api routes)
i'm not sure what was exact reason but i wasn't able to execute the request successfully when using axios
library for data fetching but it's working fine now with the default fetch
thanks for reaching out for me
that's an offtopic but do you know if i can use advanced parameters like start/stop_sequence and provide examples on how i want model to operate when using your api?
i want to achieve something similar to this: https://github.com/TheProtaganist/gpt-j/blob/main/advanced_usage_template.py
or would you recommend running my own instance and tweaking parameters there?
do you know if i can host it somewhere for free (or with a free trial period at least)?
that must be too many questions 😅 can't stop being curious..
Regarding implementing more options with the API, I'm waiting til the model is merged withing huggingface's library (see #1).
But yeah, I'm planing on implementing more features in the near future!
If you want to deploy your own server, you can get TPUs for free by filling this form: https://sites.research.google/trc/. They should answer in a few hours