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

[Chat pipeline] session context manager #1276

Merged
merged 1 commit into from
Sep 25, 2023
Merged

[Chat pipeline] session context manager #1276

merged 1 commit into from
Sep 25, 2023

Conversation

bfineran
Copy link
Contributor

updated implementation of #1239

includes small bug fix for text gen input parsing due to behavior with pydantic aliases

requested UX:

with chat_pipeline.session():
    first_result = chat_pipeline(prompt=PROMPT, *args, **kwargs)
    second_result = chat_pipeline(prompt=PROMPT, *args, **kwargs)

test_plan:
unit test included and ran locally, but disabled due to overhead in GHA

manual verification as well:

from deepsparse import Pipeline

pipeline = Pipeline.create(
    "chat",
    model_path="/home/benjamin/neuralmagic/models/codegen_mono-350m-bigpython_bigquery_thepile-pruned50/deployment",
    engine_type="onnxruntime"
)

with pipeline.session():
    output_1 = pipeline(prompt="first", generation_config=dict(max_new_tokens=1))
    output_2 = pipeline(prompt="second", generation_config=dict(max_new_tokens=1))

output_3 = pipeline(prompt="third", generation_config=dict(max_new_tokens=1))

output_2.session_ids == output_1.session_ids  # expected True
output_3.session_ids == output_1.session_ids  # expected False

Co-authored-by: @rahul-tuli

Co-authored-by: rahul-tuli
@dsikka dsikka merged commit d13cc2d into main Sep 25, 2023
13 checks passed
@dsikka dsikka deleted the chat-session-manager branch September 25, 2023 19:06
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