pre-commit: update config (#925)

* update config

* apply precommit
This commit is contained in:
Jirka Borovec 2023-02-22 01:49:38 +01:00 committed by GitHub
parent c18dd456c7
commit 6aa1d16ebc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 22 additions and 30 deletions

View File

@ -1,19 +1,28 @@
default_language_version:
python: python3
ci:
autofix_prs: true
autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions'
autoupdate_schedule: 'quarterly'
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.1.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-yaml
- id: check-toml
- id: check-json
- id: check-byte-order-marker
- id: check-merge-conflict
- id: detect-private-key

View File

@ -1104,7 +1104,6 @@ class AutoML(BaseEstimator):
groups_val=None,
groups=None,
):
if X_train_all is not None and y_train_all is not None:
assert (
isinstance(X_train_all, np.ndarray)
@ -1266,7 +1265,6 @@ class AutoML(BaseEstimator):
self._state.groups = groups
def _prepare_data(self, eval_method, split_ratio, n_splits):
X_val, y_val = self._state.X_val, self._state.y_val
if issparse(X_val):
X_val = X_val.tocsr()

View File

@ -439,7 +439,6 @@ def get_val_loss(
fit_kwargs={},
free_mem_ratio=0,
):
start = time.time()
# if groups_val is not None:
# fit_kwargs['groups_val'] = groups_val

View File

@ -175,7 +175,6 @@ class BaseEstimator:
return X
def _fit(self, X_train, y_train, **kwargs):
current_time = time.time()
if "groups" in kwargs:
kwargs = kwargs.copy()
@ -447,7 +446,7 @@ class TransformersEstimator(BaseEstimator):
def _set_training_args(self, **kwargs):
from .nlp.utils import date_str, Counter
for (key, val) in kwargs.items():
for key, val in kwargs.items():
assert key not in self.params, (
"Since {} is in the search space, it cannot exist in 'custom_fit_kwargs' at the same time."
"If you need to fix the value of {} to {}, the only way is to add a single-value domain in the search "

View File

@ -112,7 +112,6 @@ class TrainingArgumentsForAuto(TrainingArguments):
@dataclass
class Seq2SeqTrainingArgumentsForAuto(TrainingArgumentsForAuto):
model_path: str = field(
default="t5-small",
metadata={

View File

@ -135,7 +135,6 @@ def tokenize_and_align_labels(
def tokenize_text_tokclassification(X, Y, tokenizer, hf_args=None):
# If the label_all_tokens flag is True, prepare two dicts label_to_id and b_to_i_label to convert the B- labels to I- labels
label_to_id = {i: i for i in range(len(hf_args.label_list))}
b_to_i_label = []
@ -275,7 +274,6 @@ def tokenize_row(
def tokenize_text_multiplechoice(X, tokenizer, hf_args=None):
t = X[["sent1", "sent2", "ending0", "ending1", "ending2", "ending3"]]
_, tokenized_column_names = tokenize_swag(
t.iloc[0],

View File

@ -11,7 +11,6 @@ from flaml.automl.data import (
def load_default_huggingface_metric_for_task(task):
if task == SEQCLASSIFICATION:
return "accuracy"
elif task == SEQREGRESSION:

View File

@ -647,5 +647,4 @@ def qrandn(mean: float, sd: float, q: float):
def polynomial_expansion_set(
init_monomials: set, highest_poly_order: int = None, allow_self_inter: bool = False
):
return PolynomialExpansionSet(init_monomials, highest_poly_order, allow_self_inter)

View File

@ -282,9 +282,9 @@ def _split_resolved_unresolved_values(
_resolved_children,
_unresolved_children,
) = _split_resolved_unresolved_values(v)
for (path, value) in _resolved_children.items():
for path, value in _resolved_children.items():
resolved_vars[(k,) + path] = value
for (path, value) in _unresolved_children.items():
for path, value in _unresolved_children.items():
unresolved_vars[(k,) + path] = value
elif isinstance(v, list):
# Recurse into a list
@ -293,9 +293,9 @@ def _split_resolved_unresolved_values(
_resolved_children,
_unresolved_children,
) = _split_resolved_unresolved_values({i: elem})
for (path, value) in _resolved_children.items():
for path, value in _resolved_children.items():
resolved_vars[(k,) + path] = value
for (path, value) in _unresolved_children.items():
for path, value in _unresolved_children.items():
unresolved_vars[(k,) + path] = value
else:
resolved_vars[(k,)] = v

View File

@ -142,7 +142,6 @@ class ExperimentAnalysis(EA):
def report(_metric=None, **kwargs):
"""A function called by the HPO application to report final or intermediate
results.

View File

@ -11,7 +11,6 @@ from flaml.automl.training_log import training_log_reader
class MyRegularizedGreedyForest(SKLearnEstimator):
def __init__(self, task="binary", **config):
super().__init__(task, **config)
if task in CLASSIFICATION:

View File

@ -10,11 +10,9 @@ import io
class TestLogging(unittest.TestCase):
def test_logging_level(self):
from flaml import logger, logger_formatter
with tempfile.TemporaryDirectory() as d:
training_log = os.path.join(d, "training.log")
# Configure logging for the FLAML logger

View File

@ -12,7 +12,6 @@ class TestTrainingLog(unittest.TestCase):
def test_training_log(
self, path="test_training_log.log", estimator_list="auto", use_ray=False
):
with TemporaryDirectory() as d:
filename = os.path.join(d, path)

View File

@ -1574,7 +1574,6 @@ def get_toy_data_tokenclassification_tokenlabel():
def get_automl_settings(estimator_name="transformer"):
automl_settings = {
"gpu_per_trial": 0,
"max_iter": 3,

View File

@ -101,7 +101,7 @@ def get_oml_to_vw(did, max_ns_num, ds_dir=VW_DS_DIR):
target_attribute = ds.default_target_attribute
# if target_attribute is None and did in OML_target_attribute_dict:
# target_attribute = OML_target_attribute_dict[did]
except (SSLError) as e:
except SSLError as e:
print(e)
return

View File

@ -17,7 +17,6 @@ def rosenbrock_function(config: dict):
def test_record_incumbent(method="BlendSearch"):
if method != "CFOCat":
search_space = {
"x1": tune.randint(1, 9),

View File

@ -35,7 +35,6 @@ def test_tune(externally_setup_searcher=False, use_ray=False, use_raytune=False)
"height": tune.uniform(-100, 100),
}
if externally_setup_searcher is True:
searcher = BlendSearch(
space=search_space,
time_budget_s=5,