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

Refactor pipeline parallel multi-stage implementation #11286

Merged
merged 5 commits into from
Jun 13, 2024

Conversation

plusbang
Copy link
Contributor

@plusbang plusbang commented Jun 12, 2024

Description

Background: https://github.com/analytics-zoo/nano/issues/1405

Support multi-stage PP for both inference and serving, and solve installation problems.

TODO: Has verified multi-stage PP serving locally and will update it later.

2. User API changes

from ipex_llm.transformers import AutoModelForCausalLM, init_pipeline_parallel

init_pipeline_parallel()

model = AutoModelForCausalLM.from_pretrained(model_path,
                                             load_in_4bit=True,
                                             optimize_model=True,
                                             trust_remote_code=True,
                                             use_cache=True,
                                             pipeline_parallel_stages=2)

3. Summary of the change

  • Replace model layers with dummy layer in from_pretrained and add pipeline_parallel_generate to pretrained model dynamically
  • Update PP inference example

4. How to test?

  • Unit test
  • Local test

@plusbang plusbang requested review from sgwhat and jason-dai June 12, 2024 10:00
@@ -5,90 +5,43 @@ This example demonstrates how to run IPEX-LLM optimized low-bit model vertically
## Requirements
Copy link
Contributor

Choose a reason for hiding this comment

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

Please document which models have been verified.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please document which models have been verified.

Have updated verified model list.

Copy link
Contributor

@jason-dai jason-dai left a comment

Choose a reason for hiding this comment

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

See comments inline; otherwise LGTM

@plusbang plusbang requested a review from jason-dai June 12, 2024 10:21
Copy link
Contributor

@jason-dai jason-dai left a comment

Choose a reason for hiding this comment

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

LGTM

@plusbang plusbang merged commit 220151e into intel-analytics:main Jun 13, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants