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

Add performance test lib & Dataset.stress_test function #500

Merged
merged 18 commits into from
May 9, 2024

Conversation

sujubaima
Copy link
Contributor

  • Description: Add a locust-based library for performance testing and a Dataset.stress_test interface which allows users to start a performance test task.
  • Dependencies: locust>=2.20.0, urllib3<=1.26.15

python/qianfan/dataset/stress_test/qianfan_llm_load.py Outdated Show resolved Hide resolved
python/qianfan/dataset/stress_test/qianfan_llm_load.py Outdated Show resolved Hide resolved

start_time = time.time()
start_perf_counter = time.perf_counter()
responses = self.chat_comp.do(messages=messages, **kwargs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里解出来是拿到 hyperparameters={},底层请求的组件并不会接收这一参数,需要传的是 **(hyperparameters 的值)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

model: str,
data_column: str = "prompt",
hyperparameters: Dict[str, Any] = None,
) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

函数返回值应该是一个 Dataset 对象?即会把单条的请求信息,包括请求的参数、回包、错误码、Token 延迟、总延迟等信息全部记录下来,最后形成一个数据集?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前暂时只保留了抽样和聚合数据的csv

python/qianfan/dataset/dataset.py Outdated Show resolved Hide resolved
python/qianfan/dataset/stress_test/qianfan_llm_load.py Outdated Show resolved Hide resolved
python/qianfan/dataset/stress_test/qianfan_llm_load.py Outdated Show resolved Hide resolved
python/qianfan/dataset/stress_test/qianfan_llm_load.py Outdated Show resolved Hide resolved
python/qianfan/dataset/dataset.py Show resolved Hide resolved
user=self,
pool_manager=self.pool_manager,
)
else:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后面可以考虑text2image等模型的场景

@stonekim stonekim added the doc Improvements or additions to documentation label May 9, 2024
Copy link
Collaborator

@danielhjz danielhjz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@danielhjz danielhjz merged commit 804dd94 into baidubce:main May 9, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Improvements or additions to documentation language/python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants