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 preserve input text inference #267

Merged
merged 4 commits into from
Nov 15, 2023

Conversation

Ssukriti
Copy link
Collaborator

@Ssukriti Ssukriti commented Nov 9, 2023

for: #243

adds a flag to preserve or remove input text from output of CAUSAL models (local inferencing of prompt tuning and generation)

this will achieve functional parity with TGIS

The change will enable local evaluation of causal models without TGIS

"""For Causal LM task types, preserve_input_text set to False will
remove the input text from generated output.
"""
if task_type == "CAUSAL_LM":
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

HF pipeline has implemented this for Causal LMs generation pipelines https://github.com/huggingface/transformers/blob/main/src/transformers/pipelines/text_generation.py#L287

I took the same logic as it was suggested by other stack overflow posts too. I set the flag to True by default as generate() returns full text by default.

I have tested this with fine tuning on llama model with different texts and found it to work as expected. Unit tests show the same

@Ssukriti Ssukriti marked this pull request as draft November 9, 2023 15:51
@Ssukriti
Copy link
Collaborator Author

Ssukriti commented Nov 9, 2023

actually hold on, making some changes

Signed-off-by: Sukriti-Sharma4 <[email protected]>
@Ssukriti Ssukriti marked this pull request as ready for review November 9, 2023 16:25
@Ssukriti
Copy link
Collaborator Author

Ssukriti commented Nov 9, 2023

@gkumbhat its ready now when you have a chance, thanks

Copy link
Collaborator

@gkumbhat gkumbhat left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks Sukriti

@gkumbhat gkumbhat merged commit b35f910 into caikit:main Nov 15, 2023
4 checks passed
@gkumbhat gkumbhat deleted the add_preserve_input_text_inference branch November 15, 2023 03:23
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.

None yet

2 participants