8000 fix: llm palm score tests by ashleyxuu · Pull Request #643 · googleapis/python-bigquery-dataframes · GitHub
[go: up one dir, main page]

Skip to content
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: 6 additions & 5 deletions tests/system/load/test_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ def llm_remote_text_df(session, llm_remote_text_pandas_df):
return session.read_pandas(llm_remote_text_pandas_df)


@pytest.mark.flaky(retries=2)
def test_llm_palm_configure_fit(llm_fine_tune_df_default_index, llm_remote_text_df):
model = bigframes.ml.llm.PaLM2TextGenerator(
model_name="text-bison", max_iterations=1
)

df = llm_fine_tune_df_default_index.dropna()
df = llm_fine_tune_df_default_index.dropna().sample(n=100)
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's add retry for experimental features.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

Choose a reason for hiding this comment

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

curious how much run time reduction with sampling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It didn't improve much. It still takes the same amount of time around 30-40 mins, and the durations has some variations.

X_train = df[["prompt"]]
y_train = df[["label"]]
model.fit(X_train, y_train)
Expand All @@ -70,6 +71,7 @@ def test_llm_palm_configure_fit(llm_fine_tune_df_default_index, llm_remote_text_
# TODO(ashleyxu b/335492787): After bqml rolled out version control: save, load, check parameters to ensure configuration was kept


@pytest.mark.flaky(retries=2)
def test_llm_palm_score(llm_fine_tune_df_default_index):
model = bigframes.ml.llm.PaLM2TextGenerator(model_name="text-bison")

Expand All @@ -89,6 +91,7 @@ def test_llm_palm_score(llm_fine_tune_df_default_index):
assert all(col in score_result_col for col in expected_col)


@pytest.mark.flaky(retries=2)
def test_llm_palm_score_params(llm_fine_tune_df_default_index):
model = bigframes.ml.llm.PaLM2TextGenerator(
model_name="text-bison", max_iterations=1
Expand All @@ -102,12 +105,10 @@ def test_llm_palm_score_params(llm_fine_tune_df_default_index):
).to_pandas()
score_result_col = score_result.columns.to_list()
expected_col = [
"trial_id",
"precision",
"recall",
"accuracy",
"f1_score",
"log_loss",
"roc_auc",
"label",
"evaluation_status",
]
assert all(col in score_result_col for col in expected_col)
0