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

[python] Rolling batch support for flash models #865

Merged
merged 5 commits into from
Jun 28, 2023

Conversation

xyang16
Copy link
Contributor

@xyang16 xyang16 commented Jun 24, 2023

Description

Brief description of what this PR is about

  • If this change is a backward incompatible change, why must this change be made?
  • Interesting edge cases to note here

@xyang16 xyang16 requested a review from sindhuvahinis June 24, 2023 17:55
@xyang16 xyang16 marked this pull request as ready for review June 28, 2023 17:24
@xyang16 xyang16 requested review from zachgk, frankfliu and a team as code owners June 28, 2023 17:24
@xyang16 xyang16 changed the title [python] Add rolling batch for flash attention models [python] Rolling batch support for flash attention models Jun 28, 2023
@xyang16 xyang16 changed the title [python] Rolling batch support for flash attention models [python] Rolling batch support for flash models Jun 28, 2023
self.rolling_batch = SchedulerRollingBatch(model_id_or_path,
self.device, properties,
**kwargs)
if os.getenv('OMPI_COMM_WORLD_SIZE'):
Copy link
Contributor

Choose a reason for hiding this comment

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

check for engine, if engine != Python and tensor_parallel!=1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed.

if self.enable_rolling_batch and self.enable_rolling_batch.lower(
) == "false":
self.enable_rolling_batch = None
self.enable_rolling_batch = properties.get("rolling_batch") is not None
Copy link
Contributor

Choose a reason for hiding this comment

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

self.enable_rolling_batch = properties.get("rolling_batch", None)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

**kwargs)
if self.engine != "Python" and tp_degree != 1:
self.device = int(os.getenv("LOCAL_RANK", 0))
rolling_batch_type = properties.get("rolling_batch")
Copy link
Contributor

Choose a reason for hiding this comment

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

no need for this line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

self.device = int(os.getenv("LOCAL_RANK", 0))
rolling_batch_type = properties.get("rolling_batch")
model_config = AutoConfig.from_pretrained(model_id_or_path, **kwargs)
_rolling_batch_cls = get_rolling_batch_class_from_str(rolling_batch_type, model_config)
Copy link
Contributor

Choose a reason for hiding this comment

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

_rolling_batch_cls = get_rolling_batch_class_from_str(self.enable_rolling_batch, model_config)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@lanking520 lanking520 merged commit 9d98f2e into deepjavalibrary:master Jun 28, 2023
KexinFeng pushed a commit to KexinFeng/djl-serving-forked that referenced this pull request Aug 16, 2023
* [python] Add rolling batch for flash attention models

* Flash gptneox support

* fix py tests

* Set sharded to false for tp 1

* Review changes

---------

Co-authored-by: sindhuso <somasundaram.sindhu@gmail.com>
KexinFeng pushed a commit to KexinFeng/djl-serving-forked that referenced this pull request Aug 16, 2023
* [python] Add rolling batch for flash attention models

* Flash gptneox support

* fix py tests

* Set sharded to false for tp 1

* Review changes

---------

Co-authored-by: sindhuso <somasundaram.sindhu@gmail.com>
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.

3 participants