Parallel execution of model training throws StopIteration Exception
- Dominant language
- Jupyter Notebook
- Stars
- 4.4k
- Forks
- 565
- Avg merge
- 5d 8m
- Merged PRs (30d)
- 17
Description
I am trying to use flaml with gradio for model training task. Below is the python function and gradio code.
```
from sklearn.model_selection import train_test_split
import pandas as pd
import numpy as np
from flaml import AutoML
def train_model():
# Set up FLAML's AutoML object
automl = AutoML()
# Set problem type and evaluation metric
automl_settings = {
"time_budget": 20, # time budget in seconds
"metric": "auto", # set the metric to auto, FLAML will automatically select the appropriate metric based on the problem type
"task": 'regression',
"n_jobs": -1
}
df = pd.read_csv('Titanic_data_set.csv')
# Train model with FLAML
X = df.drop('Survived', axis=1)
y = df['Survived']
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=42)
automl.fit(X_train, y_train,
**automl_settings)
return automl.model.estimator
import gradio as gr
from flaml import AutoML
import gradio as gr
import warnings
warnings.filterwarnings('ignore')
model_training_interface = gr.Interface(
fn=train_model,
inputs=[],
outputs=[gr.outputs.Textbox(label="Best model selected")],
title="Model Training",
description="Generate model file, test file and train file for evaluation.",
allow_flagging=False
)
# Create a Gradio app with the interfaces and launch it
model_training_interface.launch()
```
After executing the code I open the link in two browser and try to execute the code parallel like below (url is generated by gradio).

if I execute the above code with "n_jobs": -1 I get below error

If I execute removing "n_jobs": -1 then I get below error

Just trying to understand that is it feasible to execute flaml code parallelly?
File used in program:
[Titanic_data_set.csv](https://github.com/microsoft/FLAML/files/11238294/Titanic_data_set.csv)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.