mirror of
https://github.com/microsoft/autogen.git
synced 2025-09-15 19:23:36 +00:00

* rm classification head in nlp * rm classification head in nlp * rm classification head in nlp * adding test cases for switch classification head * adding test cases for switch classification head * Update test/nlp/test_autohf_classificationhead.py Co-authored-by: Chi Wang <wang.chi@microsoft.com> * adding test cases for switch classification head * run each test separately * skip classification head test on windows * disabling wandb reporting * fix test nlp custom metric * fix test nlp custom metric * fix test nlp custom metric * fix test nlp custom metric * fix test nlp custom metric * fix test nlp custom metric * fix test nlp custom metric * fix test nlp custom metric * fix test nlp custom metric * fix test nlp custom metric * fix test nlp custom metric * Update website/docs/Examples/AutoML-NLP.md Co-authored-by: Chi Wang <wang.chi@microsoft.com> * Update website/docs/Examples/AutoML-NLP.md Co-authored-by: Chi Wang <wang.chi@microsoft.com> * fix test nlp custom metric Co-authored-by: Chi Wang <wang.chi@microsoft.com>
59 lines
1.5 KiB
Python
59 lines
1.5 KiB
Python
import sys
|
|
import pytest
|
|
import requests
|
|
from utils import get_toy_data_summarization, get_automl_settings
|
|
import os
|
|
import shutil
|
|
|
|
|
|
@pytest.mark.skipif(
|
|
sys.platform == "darwin" or sys.version < "3.7",
|
|
reason="do not run on mac os or py3.6",
|
|
)
|
|
def test_summarization():
|
|
# TODO: manual test for how effective postprocess_seq2seq_prediction_label is
|
|
from flaml import AutoML
|
|
|
|
X_train, y_train, X_val, y_val, X_test = get_toy_data_summarization()
|
|
|
|
automl = AutoML()
|
|
automl_settings = get_automl_settings()
|
|
|
|
automl_settings["task"] = "summarization"
|
|
automl_settings["metric"] = "rouge1"
|
|
automl_settings["time_budget"] = 2 * automl_settings["time_budget"]
|
|
automl_settings["fit_kwargs_by_estimator"]["transformer"][
|
|
"model_path"
|
|
] = "patrickvonplaten/t5-tiny-random"
|
|
|
|
try:
|
|
automl.fit(
|
|
X_train=X_train,
|
|
y_train=y_train,
|
|
X_val=X_val,
|
|
y_val=y_val,
|
|
**automl_settings
|
|
)
|
|
except requests.exceptions.HTTPError:
|
|
return
|
|
|
|
automl_settings.pop("max_iter", None)
|
|
automl_settings.pop("use_ray", None)
|
|
automl_settings.pop("estimator_list", None)
|
|
|
|
automl.retrain_from_log(
|
|
X_train=X_train,
|
|
y_train=y_train,
|
|
train_full=True,
|
|
record_id=0,
|
|
**automl_settings
|
|
)
|
|
automl.predict(X_test)
|
|
|
|
if os.path.exists("test/data/output/"):
|
|
shutil.rmtree("test/data/output/")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_summarization()
|