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

[Perf] Evaluate API: Using threads to infer signatures for eval batch runs instead of processes. #3412

Merged
merged 20 commits into from
Jun 18, 2024

Conversation

ninghu
Copy link
Member

@ninghu ninghu commented Jun 13, 2024

Description

This change is related to #3380

All Promptflow Contribution checklist:

  • The pull request does not introduce [breaking changes].
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request to get dedicated review from promptflow team. Learn more: suggested workflow.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

ninghu added a commit that referenced this pull request Jun 17, 2024
… pf.run (#3380)

# Description

The change in this PR addresses the performance issues we were seeing
with the Evaluate API. This is the first step in optimizing performance.
The improvements include:

- Parallelizing the pf.run for evaluators. Previously, it ran
sequentially, contributing to most of the latency.
- Addressing the slowness of the import Evaluate API, which was due to
the import of MLClient.
- Using threads to infer signatures for eval batch runs instead of
processes. (This change has been moved to a seperated PR:
#3412)

**Improvements from this change:**
Windows OS, remote tracking disabled

- 4 evaluators, 100 rows:
    - Previous (pf.run without threadpool): 320 secs
    - Current (pf.run with threadpool): 78 secs (~75% improvement)

- 1 evaluator, 1 row:
   - Previous: 53 secs
   - Current: 17 secs (~68% improvement)

Investigation details can be found
[here](https://microsoft-my.sharepoint.com/:w:/p/ninhu/ETB_zdMkFrdAuf3Lcg9ssrUB6RVmyuFs5Un1G74O1HlwSA?e=23ngPm)


# All Promptflow Contribution checklist:
- [ ] **The pull request does not introduce [breaking changes].**
- [ ] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).**
- [ ] **Create an issue and link to the pull request to get dedicated
review from promptflow team. Learn more: [suggested
workflow](../CONTRIBUTING.md#suggested-workflow).**

## General Guidelines and Best Practices
- [ ] Title of the pull request is clear and informative.
- [ ] There are a small number of commits, each of which have an
informative message. This means that previously merged commits do not
appear in the history of the PR. For more information on cleaning up the
commits in your PR, [see this
page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).

### Testing Guidelines
- [ ] Pull request includes test coverage for the included changes.

---------

Co-authored-by: Clement Wang <[email protected]>
@ninghu ninghu merged commit dc84948 into main Jun 18, 2024
63 of 66 checks passed
@ninghu ninghu deleted the users/ninhu/load_in_subprocess branch June 18, 2024 01:45

def __exit__(self, exc_type, exc_val, exc_tb):
if isinstance(self.client, CodeClient):
recover_openai_api()

if isinstance(self.client, ProxyClient):
os.environ.pop(PF_FLOW_ENTRY_IN_TMP, None)
os.environ.pop(PF_FLOW_META_LOAD_IN_SUBPROCESS, None)
Copy link
Member

Choose a reason for hiding this comment

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

Should we restore it to it original value ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants