Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 使用gpt-4o模型时会出现错误 #4719

Closed
3 tasks
Dreamry2C opened this issue May 16, 2024 · 7 comments
Closed
3 tasks

[Bug] 使用gpt-4o模型时会出现错误 #4719

Dreamry2C opened this issue May 16, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@Dreamry2C
Copy link

Bug Description

Chinese:

使用gpt-4o模型发送信息会显示:
{
"error": {
"message": "max_tokens is too large: 59812. This model supports at most 4096 completion tokens, whereas you provided 59812.",
"type": null,
"param": "max_tokens",
"code": null
}
}
事实上我并没有设置和使用那么多tokens。
image
image
还有一点,我使用的是第三方的api,但我认为这有影响不大。
使用其他模型一切正常。

English:

Sending a message using the gpt-4o model displays:
{
"error": {
"message": "max_tokens is too large: 59812. This model supports at most 4096 completion tokens, whereas you provided 59812.",
"type": null,
"param": "max_tokens",
"code": null
}
}
I haven't actually set up and used that many tokens

Another point is that I use a third-party api, but I don't think it has much impact
other models are fine.

Steps to Reproduce

1.打开可执行程序(.exe)
2.设置选择gpt4o模型
3.发送任何消息
4.提示错误

  1. Open the executable program (.exe)
  2. Set the gpt4o model
  3. Send any message
  4. An error message is displayed

Expected Behavior

能够正常发送和接收消息

Messages can be sent and received normally

Screenshots

image
image
The Settings have not changed except as modified in the figure

Deployment Method

  • Docker
  • Vercel
  • Server

Desktop OS

Windows10

Desktop Browser

edge, But I'm using the executable file

Desktop Browser Version

124.0.2478.97

Smartphone Device

No response

Smartphone OS

No response

Smartphone Browser

No response

Smartphone Browser Version

No response

Additional Logs

No response

@Dreamry2C Dreamry2C added the bug Something isn't working label May 16, 2024
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Title: [Bug] An error occurs when using the gpt-4o model

@SpiralTower
Copy link

SpiralTower commented May 17, 2024

const requestPayload: RequestPayload = {
messages,
stream: options.config.stream,
model: modelConfig.model,
temperature: modelConfig.temperature,
presence_penalty: modelConfig.presence_penalty,
frequency_penalty: modelConfig.frequency_penalty,
top_p: modelConfig.top_p,
// max_tokens: Math.max(modelConfig.max_tokens, 1024),
// Please do not ask me why not send max_tokens, no reason, this param is just shit, I dont want to explain anymore.
};
// add max_tokens to vision model
if (visionModel && modelConfig.model.includes("preview")) {
requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000);
}

上传的请求不包含max_tokens可能导致此问题,aiproxy.io在不包含此值的情况下可能会冻结最大参数。
aiproxy文档
我的临时解决办法是模仿L131的vision model添加一个针对4o的max_tokens。
if (modelConfig.model.includes("4o")) { requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000); }

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


const requestPayload: RequestPayload = {
messages,
stream: options.config.stream,
model: modelConfig.model,
temperature: modelConfig.temperature,
presence_penalty: modelConfig.presence_penalty,
frequency_penalty: modelConfig.frequency_penalty,
top_p: modelConfig.top_p,
// max_tokens: Math.max(modelConfig.max_tokens, 1024),
// Please do not ask me why not send max_tokens, no reason, this param is just shit, I dont want to explain anymore.
};
// add max_tokens to vision model
if (visionModel && modelConfig.model.includes("preview")) {
requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000);
}

Uploading requests not containing max_tokens may cause this issue, aiproxy.io may freeze the max parameters without including this value https://docs.aiproxy.io/guide/deduction.
My temporary solution is to imitate the vision model of L131 and add a max_tokens for 4o.
if (modelConfig.model.includes("4o")) { requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000); }

@Dean-YZG
Copy link
Contributor

感谢反馈!max_tokens应该是与具体模型绑定在一起的参数,我们也意识到了这个问题,并将在下个大版本中提供给用户自定义模型的能力,支持自定义每个模型的max_tokens,但是,在目前这个版本上我们不打算修改回早期时在chat接口中传递max_tokens参数,原因是,对于大模型来说,这个参数是非必传参数,传递了这个参数返回会限制和影响很多大模型返回新消息的准确性和完整性

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Thanks for the feedback! max_tokens should be a parameter bound to a specific model. We are also aware of this problem and will provide users with the ability to customize models in the next major version, supporting the customization of max_tokens for each model. However, at present, this In terms of version, we do not plan to change back to the early days of passing the max_tokens parameter in the chat interface. The reason is that for large models, this parameter is a mandatory parameter. Passing this parameter will limit and affect the accuracy of new messages returned by many large models. sex and integrity

@mlkt
Copy link

mlkt commented May 23, 2024

建议

const requestPayload: RequestPayload = {
messages,
stream: options.config.stream,
model: modelConfig.model,
temperature: modelConfig.temperature,
presence_penalty: modelConfig.presence_penalty,
frequency_penalty: modelConfig.frequency_penalty,
top_p: modelConfig.top_p,
// max_tokens: Math.max(modelConfig.max_tokens, 1024),
// Please do not ask me why not send max_tokens, no reason, this param is just shit, I dont want to explain anymore.
};
// add max_tokens to vision model
if (visionModel && modelConfig.model.includes("preview")) {
requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000);
}

上传的请求不包含max_tokens可能导致此问题,aiproxy.io在不包含此值的情况下可能会冻结最大参数。
aiproxy文档
我的临时解决办法是模仿L131的vision model添加一个针对4o的max_tokens。
if (modelConfig.model.includes("4o")) { requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000); }

建议先加上这个临时解决方案,否则现在根本用不了 gpt-4o

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


suggestion

const requestPayload: RequestPayload = {
messages,
stream: options.config.stream,
model: modelConfig.model,
temperature: modelConfig.temperature,
presence_penalty: modelConfig.presence_penalty,
frequency_penalty: modelConfig.frequency_penalty,
top_p: modelConfig.top_p,
// max_tokens: Math.max(modelConfig.max_tokens, 1024),
// Please do not ask me why not send max_tokens, no reason, this param is just shit, I dont want to explain anymore.
};
// add max_tokens to vision model
if (visionModel && modelConfig.model.includes("preview")) {
requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000);
}

Uploaded requests not containing max_tokens may cause this issue, aiproxy.io may freeze the max parameters without including this value.
aiproxy documentation
My temporary solution is to imitate the vision model of L131 and add a max_tokens for 4o.
if (modelConfig.model.includes("4o")) { requestPayload["max_tokens"] = Math.max(modelConfig.max_tokens, 4000); }

It is recommended to add this temporary solution first, otherwise you will not be able to use gpt-4o at all now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants