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

Fix stream api gen #143

Merged
merged 4 commits into from
Aug 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions caikit_nlp/modules/text_generation/peft_prompt_tuning.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from caikit import get_config
from caikit.core.data_model import DataStream
from caikit.core.modules import ModuleBase, ModuleConfig, ModuleSaver, module
from caikit.core.toolkit import error_handler, wip_decorator
from caikit.core.toolkit import error_handler
from caikit.interfaces.nlp.data_model import (
ClassificationTrainRecord,
GeneratedTextResult,
Expand Down Expand Up @@ -213,10 +213,13 @@ def run(
)
return GeneratedTextResult(generated_text=gen_text[0])

# NOTE: We need to disable wip decorator here otherwise we get issues in
# proto generation for streaming. We are keeping it commented out for now,
# to essentially document that this streaming function is WIP.
# @wip_decorator.work_in_progress(
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just remove it outright?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Super thanks for quick review. I just kept it to make a note that this function is "work in progress" and why we can't actually use the decorator.

# category=wip_decorator.WipCategory.WIP, action=wip_decorator.Action.WARNING
# )
@TextGenerationTask.taskmethod(output_streaming=True)
@wip_decorator.work_in_progress(
category=wip_decorator.WipCategory.WIP, action=wip_decorator.Action.WARNING
)
def run_stream_out(
self, text: str, max_new_tokens=20, min_new_tokens=0
) -> Iterable[GeneratedTextStreamResult]:
Expand Down