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(components): Remove the unused generate_default_instruction and resolve_upload_location from function_based #10638

Merged
merged 1 commit into from
Apr 5, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -372,46 +372,6 @@ def convert_to_delimited_string(items: List[str], delimiter: str = ',') -> str:
return delimiter.join(items)


@dsl.component(base_image=_image.GCPC_IMAGE_TAG, install_kfp_package=False)
def generate_default_instruction(
task: str,
target_sequence_length: int,
instruction_override: str = '',
) -> str:
"""Generates a default instruction if no override is provided."""
if instruction_override:
return instruction_override
task = task.lower()
if task == 'summarization':
return f'Summarize in less than {target_sequence_length} words.'

elif task == 'question_answer':
return f'Answer the question in less than {target_sequence_length} words.'

else:
raise ValueError(
f'Task not recognized: {task}. Supported tasks are: "summarization",'
' "question_answer".'
)


@dsl.component(base_image=_image.GCPC_IMAGE_TAG, install_kfp_package=False)
def resolve_upload_location(upload_location: Optional[str] = None) -> str:
"""Gets the region to upload the model.

Args:
upload_location: User-specified region to upload the model to.

Returns:
Where to upload the model. If no location is specified, the model will be
uploaded to the region where the pipeline is running.
"""
# pylint: disable=g-import-not-at-top
import os
# pylint: enable=g-import-not-at-top
return upload_location or os.environ['CLOUD_ML_REGION']


@dsl.component(base_image=_image.GCPC_IMAGE_TAG, install_kfp_package=False)
def resolve_regional_endpoint(upload_location: str) -> str:
"""Gets the regional endpoint used to upload a model to the registry.
Expand Down
Loading