[go: nahoru, domu]

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

增加对文心一言的支持,支持文心一言的三个主要模型。 #931

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

XudongLiu
Copy link
Contributor
@XudongLiu XudongLiu commented Nov 8, 2023

刘旭东

描述

增加了对百度文心一言模型的支持,主要支持百度三个主要模型ERNIE-Bot、ERNIE-Bot-4、ERNIE-Bot-Tubor
截屏2023-11-08 15 09 16

相关问题

[功能请求]: 请问什么时候能够支持文心一言呢 #928

补充信息

Copilot4PR

🤖 Generated by Copilot at 5a27151

Summary

🗣️🌐🐼

This pull request adds support for using ERNIE, a pre-trained dialogue model from Baidu Cloud, as an online service for generating chat responses. It updates the base model class, the presets module, the config files, and the models module to handle the ERNIE model type and its parameters. It also adds a new module ERNIE.py that defines a class to interact with the ERNIE model service.

To chat with ERNIE online
We need some keys to access its mind
We read them from config
Or env vars if we pick
And use ERNIE_Client of a kind

Walkthrough

  • Add two new fields to config_example.json for ERNIE API key and secret key (link)
  • Read ERNIE keys from config file or environment variables in modules/config.py and set them as global variables (link)
  • Add a new enum value ERNIE to the ModelType class in modules/models/base_model.py to represent the ERNIE model type (link)
  • Add a new condition to the get_type method of the ModelType class to check if the model name contains "ernie" and return the ERNIE model type (link)
  • Add a new module modules/models/ERNIE.py that defines a class ERNIE_Client that inherits from the BaseLLMModel class and implements the methods to interact with the ERNIE model service (link)
  • Add a new branch to the get_model function in modules/models/models.py that imports the ERNIE_Client class and creates an instance of it with the given model name and the ERNIE keys (link)
  • Add the three ERNIE model names to the ONLINE_MODELS list in modules/presets.py to check if a model is an online service or a local file (link)
  • Add the metadata for the three ERNIE models to the MODEL_METADATA dictionary in modules/presets.py to store information such as the model name and the token limit for each model (link)

@XudongLiu
Copy link
Contributor Author
截屏2023-11-08 15 26 48 这个是正确的截图

@Keldos-Li Keldos-Li added 🚀 enhancement 🤖 model 与特定大语言模型LLM相关 labels Nov 8, 2023
@Keldos-Li Keldos-Li linked an issue Nov 8, 2023 that may be closed by this pull request
1 task
@Keldos-Li
Copy link
Collaborator

我测试了一下,大部分情况没有问题,但是在切换对话之后好像往往不能得到最新的一组对话,尝试切换对话后继续对话往往会提示

ValueError: ('Unable to parse text', 'or_code":33***6,"error_msg":"the role of first message must be user","id":"as-5buh********"}')

或者

ValueError: ('Unable to parse text', 'or_code":33***6,"error_msg":"the length of messages must be an odd number","id":"as-tf7********"}')

或者长久不反应……这时的报错反馈在前端体验也不好。

我不太确定这是我们本身base model的history就有点小问题,还是百度模型的问题。唔。

@GaiZhenbiao GaiZhenbiao merged commit e17e77b into GaiZhenbiao:main Nov 17, 2023
1 check passed
@XudongLiu
Copy link
Contributor Author

我看看后续调整一下,这个文心一言的接口要求基数的内容必须是user的问题,这个有点变态,我再调整一下吧。

@saisaizhou
Copy link

请问文心一言应该用哪个access_token呢?尝试了以下用百度飞桨平台AI studio提供的文心一言access_token会报错

@XudongLiu
Copy link
Contributor Author

@saisaizhou 可以使用百度云那里提供的文心的服务,里面有一个生成access_token的地方

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 enhancement 🤖 model 与特定大语言模型LLM相关
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[功能请求]: 请问什么时候能够支持文心一言呢
4 participants