Closed hargup closed 1 year ago
Oh hi @hargup! Welcome to our little place. So far, we've been using Python 3.10 and I think @dalmaer made it run on 3.11. I am pretty sure there will be bits that break on 3.8.
@dglazkov appreciate the quick response :) Getting a different error with Python 3.10
python -m sample.main "How does building a platform differ from building a product?"
Token indices sequence length is longer than the specified maximum sequence length for this model (18994 > 1024). Running this sequence through the model will result in indexing errors
Traceback (most recent call last):
File "/Users/harshwork/opt/anaconda3/envs/py310/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/harshwork/opt/anaconda3/envs/py310/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/harshwork/code/polymath/sample/main.py", line 22, in <module>
print(ask(query, context))
File "/Users/harshwork/code/polymath/polymath/ask_embeddings.py", line 124, in ask
return get_completion_with_context(query, context, answer_length=answer_length, completion_model=completion_model), library.unique_infos
File "/Users/harshwork/code/polymath/polymath/ask_embeddings.py", line 111, in get_completion_with_context
return get_completion(prompt, answer_length=answer_length, completion_model=completion_model)
File "/Users/harshwork/code/polymath/polymath/ask_embeddings.py", line 95, in get_completion
response : Any = openai.Completion.create(
File "/Users/harshwork/opt/anaconda3/envs/py310/lib/python3.10/site-packages/openai/api_resources/completion.py", line 25, in create
return super().create(*args, **kwargs)
File "/Users/harshwork/opt/anaconda3/envs/py310/lib/python3.10/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 115, in create
response, _, api_key = requestor.request(
File "/Users/harshwork/opt/anaconda3/envs/py310/lib/python3.10/site-packages/openai/api_requestor.py", line 181, in request
resp, got_stream = self._interpret_response(result, stream)
File "/Users/harshwork/opt/anaconda3/envs/py310/lib/python3.10/site-packages/openai/api_requestor.py", line 396, in _interpret_response
self._interpret_response_line(
File "/Users/harshwork/opt/anaconda3/envs/py310/lib/python3.10/site-packages/openai/api_requestor.py", line 429, in _interpret_response_line
raise self.handle_error_response(
openai.error.InvalidRequestError: -14994 is less than the minimum of 0 - 'max_tokens'
Aha! I was able to reproduce.
Oh, man, That was a fun rabbit hole. The problem was stale documentation! It was pointing you to sample.main
, which was an older and no longer functional way of invoking polymath. I am updating the docs to use sample.client
.
Thank you for reporting the bug, @hargup!
@dglazkov thanks for quickly resolving the bug ☺️
Running sample locally fails with following error, enviornment, python=3.8
command:
python -m sample.main "How does building a platform differ from building a product?"