Skip to content

Commit

Permalink
Fix some lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
holtskinner committed Jan 27, 2025
1 parent 8eb202b commit 6eb5e29
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions gemini/tuning/genai-mlops-tune-and-eval/pipeline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# pylint: disable=import-outside-toplevel,too-many-locals
# pylint: disable=import-outside-toplevel,too-many-locals,too-many-arguments,too-many-positional-arguments,unused-argument
from typing import NamedTuple

from kfp.v2 import dsl
from kfp.v2.dsl import component

Expand Down Expand Up @@ -55,7 +56,7 @@ def model_comparison_component(
location: str,
baseline_model_endpoint: str, # Baseline model name
candidate_model_endpoint: str, # Candidate model name
) -> NamedTuple('outputs', best_response=str, metrics=dict):
) -> NamedTuple:
"""Compares base model to newly tuned model"""
import functools
from functools import partial
Expand Down Expand Up @@ -241,8 +242,14 @@ def rank_responses(instruction: str, context: str, responses: list[str]) -> tupl

print(f"Best response: {best_response}")
print(f"Metrics: {metrics}")
outputs = NamedTuple("outputs", best_response=str, metrics=dict)
return outputs(best_response, metrics)

class ModelComparisonResponses(NamedTuple):
"""Response for model comparison component."""

best_response: str
metrics: dict

return ModelComparisonResponses(best_response, metrics)


@dsl.pipeline(name="gemini-tuning-pipeline")
Expand Down

0 comments on commit 6eb5e29

Please sign in to comment.