Skip to content

Commit c2b2531

Browse files
authored
Sync Fabric till 2cd1c3d (#1433)
* Sync Fabric till 2cd1c3d * Remove synapseml from tag names * Fix 'NoneType' object has no attribute 'DataFrame' * Deprecated 3.8 support * Fix 'NoneType' object has no attribute 'DataFrame' * Still use python 3.8 for pydoc * Don't run tests in parallel * Remove autofe and lowcode
1 parent 0f94205 commit c2b2531

29 files changed

Lines changed: 976 additions & 109 deletions

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
os: [ubuntu-latest, macos-latest, windows-2019]
33-
python-version: ["3.8", "3.9", "3.10", "3.11"]
33+
python-version: ["3.9", "3.10", "3.11"]
3434
steps:
3535
- uses: actions/checkout@v4
3636
- name: Set up Python ${{ matrix.python-version }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# basic setup
2-
FROM mcr.microsoft.com/devcontainers/python:3.8
2+
FROM mcr.microsoft.com/devcontainers/python:3.10
33
RUN apt-get update && apt-get -y update
44
RUN apt-get install -y sudo git npm
55

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ FLAML has a .NET implementation in [ML.NET](http://dot.net/ml), an open-source,
4040

4141
## Installation
4242

43-
FLAML requires **Python version >= 3.8**. It can be installed from pip:
43+
FLAML requires **Python version >= 3.9**. It can be installed from pip:
4444

4545
```bash
4646
pip install flaml

flaml/automl/automl.py

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import random
1111
import sys
1212
import time
13+
from concurrent.futures import as_completed
1314
from functools import partial
1415
from typing import Callable, List, Optional, Union
1516

@@ -187,7 +188,8 @@ def custom_metric(
187188
mem_thres: A float of the memory size constraint in bytes.
188189
pred_time_limit: A float of the prediction latency constraint in seconds.
189190
It refers to the average prediction time per row in validation data.
190-
train_time_limit: A float of the training time constraint in seconds.
191+
train_time_limit: None or a float of the training time constraint in seconds for each trial.
192+
Only valid for sequential search.
191193
verbose: int, default=3 | Controls the verbosity, higher means more
192194
messages.
193195
retrain_full: bool or str, default=True | whether to retrain the
@@ -1334,7 +1336,8 @@ def custom_metric(
13341336
mem_thres: A float of the memory size constraint in bytes.
13351337
pred_time_limit: A float of the prediction latency constraint in seconds.
13361338
It refers to the average prediction time per row in validation data.
1337-
train_time_limit: None or a float of the training time constraint in seconds.
1339+
train_time_limit: None or a float of the training time constraint in seconds for each trial.
1340+
Only valid for sequential search.
13381341
X_val: None or a numpy array or a pandas dataframe of validation data.
13391342
y_val: None or a numpy array or a pandas series of validation labels.
13401343
sample_weight_val: None or a numpy array of the sample weight of
@@ -1625,6 +1628,13 @@ def cv_score_agg_func(val_loss_folds, log_metrics_folds):
16251628
_ch.setFormatter(logger_formatter)
16261629
logger.addHandler(_ch)
16271630

1631+
if model_history:
1632+
logger.warning(
1633+
"With `model_history` set to `True` by default, all intermediate models are retained in memory, "
1634+
"which may significantly increase memory usage and slow down training. "
1635+
"Consider setting `model_history=False` to optimize memory and accelerate the training process."
1636+
)
1637+
16281638
if not use_ray and not use_spark and n_concurrent_trials > 1:
16291639
if ray_available:
16301640
logger.warning(
@@ -2717,16 +2727,42 @@ def _search(self):
27172727
):
27182728
if mlflow.active_run() is None:
27192729
mlflow.start_run(run_id=self.mlflow_integration.parent_run_id)
2720-
self.mlflow_integration.log_model(
2721-
self._trained_estimator.model,
2722-
self.best_estimator,
2723-
signature=self.estimator_signature,
2724-
)
2725-
self.mlflow_integration.pickle_and_log_automl_artifacts(
2726-
self, self.model, self.best_estimator, signature=self.pipeline_signature
2727-
)
2730+
if self.best_estimator.endswith("_spark"):
2731+
self.mlflow_integration.log_model(
2732+
self._trained_estimator.model,
2733+
self.best_estimator,
2734+
signature=self.estimator_signature,
2735+
run_id=self.mlflow_integration.parent_run_id,
2736+
)
2737+
else:
2738+
self.mlflow_integration.pickle_and_log_automl_artifacts(
2739+
self,
2740+
self.model,
2741+
self.best_estimator,
2742+
signature=self.pipeline_signature,
2743+
run_id=self.mlflow_integration.parent_run_id,
2744+
)
27282745
else:
2729-
logger.info("not retraining because the time budget is too small.")
2746+
logger.warning("not retraining because the time budget is too small.")
2747+
if self.mlflow_integration is not None:
2748+
logger.debug("Collecting results from submitted record_state tasks")
2749+
t1 = time.perf_counter()
2750+
for future in as_completed(self.mlflow_integration.futures):
2751+
_task = self.mlflow_integration.futures[future]
2752+
try:
2753+
result = future.result()
2754+
logger.debug(f"Result for record_state task {_task}: {result}")
2755+
except Exception as e:
2756+
logger.warning(f"Exception for record_state task {_task}: {e}")
2757+
for future in as_completed(self.mlflow_integration.futures_log_model):
2758+
_task = self.mlflow_integration.futures_log_model[future]
2759+
try:
2760+
result = future.result()
2761+
logger.debug(f"Result for log_model task {_task}: {result}")
2762+
except Exception as e:
2763+
logger.warning(f"Exception for log_model task {_task}: {e}")
2764+
t2 = time.perf_counter()
2765+
logger.debug(f"Collecting results from tasks submitted to executors costs {t2-t1} seconds.")
27302766

27312767
def __del__(self):
27322768
if (

0 commit comments

Comments
 (0)