Closed InfiniteCod3 closed 4 months ago
Just realized its a duplicate of #124
I don't think it's a duplicate of #124
So it seems to have failed in querying the model (model.query
), in particular these few lines
prompt = self.history_to_messages(history)
completion = together.Complete.create(
model=self.api_model,
prompt=prompt,
max_tokens=self.model_metadata["max_context"],
stop="<human>",
temperature=self.args.temperature,
top_p=self.args.top_p,
)
what version of the together
package are you running?
I'm now working on #185 .
This is because ChatCompletionRequest.stop
requires List[str]
, but feed str
.
https://github.com/togethercomputer/together-python/blob/main/src/together/types/chat_completions.py#L83 https://github.com/princeton-nlp/SWE-agent/blob/main/sweagent/agent/models.py#L569
But even if we fix this, another error will be occured.
together.error.InvalidRequestError: Error code: 400 - {"message": "Input validation error: `inputs` tokens + `max_new_tokens` must be <= 4097. Given: 14 `inputs` tokens and 4096 `max_new_tokens`", "type_": "invalid_request_error", "param": "max_tokens", "code": null}
This will work if we modify the max_context
of Model
.
e.g. https://github.com/princeton-nlp/SWE-agent/blob/main/sweagent/agent/models.py#L496
Next time we will fails with a KeyError
for response. It seems like this is because output
is missing from ChatCompletionResponse
.
https://github.com/togethercomputer/together-python/blob/main/src/together/types/chat_completions.py#L113-L127 https://github.com/princeton-nlp/SWE-agent/blob/main/sweagent/agent/models.py#L574-L576
It looks like we can directly access choices
and usage
instead.
This series of errors is due to big changes that were introduced in the new major version released last week. If you want to use it right away, rolling back the Together version to v0.2.11 might work well.
I'm now working on https://github.com/princeton-nlp/SWE-agent/issues/185 . This is because ChatCompletionRequest.stop requires List[str], but feed str.
https://github.com/togethercomputer/together-python/blob/main/src/together/types/chat_completions.py#L83 https://github.com/princeton-nlp/SWE-agent/blob/main/sweagent/agent/models.py#L569
thank you. yes, stop
is supposed to be a List[str]
on the Together API: https://docs.together.ai/reference/chat-completions
But even if we fix this, another error will be occured.
together.error.InvalidRequestError: Error code: 400 - {"message": "Input validation error:
inputs
tokens +max_new_tokens
must be <= 4097. Given: 14inputs
tokens and 4096max_new_tokens
", "type_": "invalid_request_error", "param": "max_tokens", "code": null} This will work if we modify the max_context of Model.e.g. https://github.com/princeton-nlp/SWE-agent/blob/main/sweagent/agent/models.py#L496
Input token count + max_tokens needs to be less than the context length of the model. Model context lengths can be found here.
You can also set max_tokens=None to avoid the error if you don't know how many input tokens you have.
Next time we will fails with a KeyError for response. It seems like this is because output is missing from ChatCompletionResponse.
https://github.com/togethercomputer/together-python/blob/main/src/together/types/chat_completions.py#L113-L127 https://github.com/princeton-nlp/SWE-agent/blob/main/sweagent/agent/models.py#L574-L576
It looks like we can directly access choices and usage instead.
This series of errors is due to big changes that were introduced in the new major version released last week. If you want to use it right away, rolling back the Together version to v0.2.11 might work well.
Yes. v1.0.0 brought in breaking changes. Hardcoding v0.2.11 until these changes have been made to this repo would be my suggestion. v1.2.0 will have backwards compatibility to v0.2.11.
p.s. I'm a maintainer of the Together Python SDK.
@orangetin Thank you very much for providing the information! It's really helpful!
In particular, below your comment will help me fix the issue quickly!
You can also set max_tokens=None to avoid the error if you don't know how many input tokens you have.
Describe the bug
I encountered an error when running the docker container for amd64. The main part of the error is as follows: "WARNING ❌ Failed on pvlib__pvlib-python-i1603: 1 validation error for CompletionRequest stop Input should be a valid list [type=list_type, input_value='', input_type=str] For further information visit https://errors.pydantic.dev/2.6/v/list_type" After this, it attempts to start over but fails again.
Steps/Code to Reproduce
Expected Results
No error thrown and it working fine
Actual Results
INFO DEMONSTRATION:
trajectories/demonstrations/replaymarshmallow-codemarshmallow-1867defaultt-0.20p-0.95c-2.00__install-1_install_from_source/marshmallow-codemarshma llow-1867.traj
INFO 🤖 MODEL INPUT
We're currently solving the following issue within our repository. Here's the issue text:
ISSUE:
golden-section search fails when upper and lower bounds are equal
Describe the bug
I was using pvlib for sometime now and until now I was always passing a big dataframe containing readings of a long period. Because of some changes in our
software architecture, I need to pass the weather readings as a single reading (a dataframe with only one row) and I noticed that for readings that GHI-DHI are
zero pvlib fails to calculate the output and returns below error while the same code executes correctly with weather information that has non-zero GHI-DHI:
/usr/local/lib/python3.9/site-packages/together/legacy/complete.py:23: UserWarning: The use of together.api_key is deprecated and will be removed in the next major release. Please set the TOGETHER_API_KEY environment variable instead. warnings.warn(API_KEY_WARNING) Traceback (most recent call last): File "/app/run.py", line 136, in main info, trajectory = agent.run( File "/app/sweagent/agent/agents.py", line 645, in run thought, action, output = self.forward( File "/app/sweagent/agent/agents.py", line 373, in forward thought, action, output = self.forward_with_error_check(observation, state) File "/app/sweagent/agent/agents.py", line 513, in forward_with_error_check output = self.forward_model(observation, state) File "/app/sweagent/agent/agents.py", line 427, in forward_model return self.model.query(self.local_history) File "/usr/local/lib/python3.9/site-packages/tenacity/init.py", line 289, in wrapped_f return self(f, *args, kw) File "/usr/local/lib/python3.9/site-packages/tenacity/init.py", line 379, in call do = self.iter(retry_state=retry_state) File "/usr/local/lib/python3.9/site-packages/tenacity/init.py", line 325, in iter raise retry_exc.reraise() File "/usr/local/lib/python3.9/site-packages/tenacity/init.py", line 158, in reraise raise self.last_attempt.result() File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 439, in result return self.get_result() File "/usr/local/lib/python3.9/concurrent/futures/_base.py", line 391, in get_result raise self._exception File "/usr/local/lib/python3.9/site-packages/tenacity/init.py", line 382, in call result = fn(*args, *kwargs) File "/app/sweagent/agent/models.py", line 563, in query completion = together.Complete.create( File "/usr/local/lib/python3.9/site-packages/together/legacy/base.py", line 25, in new_func return func(args, kwargs) File "/usr/local/lib/python3.9/site-packages/together/legacy/complete.py", line 28, in create return client.completions.create( File "/usr/local/lib/python3.9/site-packages/together/resources/completions.py", line 79, in create parameter_payload = CompletionRequest( File "/usr/local/lib/python3.9/site-packages/pydantic/main.py", line 171, in init self.pydantic_validator__.validate_python(data, self_instance=self) pydantic_core._pydantic_core.ValidationError: 1 validation error for CompletionRequest stop Input should be a valid list [type=list_type, input_value='', input_type=str]
For further information visit https://errors.pydantic.dev/2.6/v/list_type
WARNING ❌ Failed on pvlib pvlib-python-i1603: 1 validation error for CompletionRequest', input_type=str]
stop
Input should be a valid list [type=list_type, input_value='
For further information visit https://errors.pydantic.dev/2.6/v/list_type
INFO Beginning environment shutdown...
INFO Agent container stopped