"finish_reason": "length" --> how to increase max_new_tokens
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.5k
- Forks
- 4.8k
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
I am using the fastchat openai-like api to serve model but sometimes the model stops because of output length limit, even though the max size (4096) is not reached yet.
```
JSON: {
"id": "chatcmpl-aMCSDBC6eBQx74i9XWuCBt",
"object": "chat.completion",
"created": 1692929522,
"model": "vicuna-7b-v1.5",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "some long text"
},
*"finish_reason": "length"*
}
],
"usage": {
"prompt_tokens": 2623,
"total_tokens": 3134,
"completion_tokens": 511
}
}
```
I tried adding `max_new_tokens` to the request but it didn't work.
```
openai.api_key = "EMPTY"
openai.api_base = "http://localhost:8000/v1"
response = openai.ChatCompletion.create(
model='vicuna-7b-v1.5',
messages=messages,
max_new_tokens=2000
)
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named. Start by tracing the FastChat OpenAI-like API's handling of token-limit request parameters and compare the reported max_new_tokens request with the returned usage. Done means determining whether the behavior needs a code fix or clearer documentation of the supported parameter.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100