-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTrainer.py
50 lines (36 loc) · 1.38 KB
/
Trainer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Streamlit homepage to input dataset name and model name
"""
import streamlit
from pipeline import run_pipeline
def start_training(dataset: str, dataset_subset: str, models: str) -> None:
"""Start training pipeline
Args:
dataset: Dataset to use for training
dataset_subset: Subset of dataset to use for training
models: Model to train
Returns:
None
"""
if not dataset.strip():
streamlit.error("Please enter a dataset name")
return
if not models:
streamlit.error("Please select at least one model")
return
if not dataset_subset.strip():
# Just to make sure it is not None
dataset_subset = ""
run_job = run_pipeline(dataset, dataset_subset, models)
streamlit.balloons()
streamlit.success(f"Training is just started with the job name: {run_job.name}")
streamlit.title("Auto NLP Classification")
streamlit.subheader("Dataset Selection")
dataset_name = streamlit.text_input("Dataset Name from Huggingface",value="tweet_eval")
dataset_subset_name = streamlit.text_input("Name of the subset if any",value="emotion")
streamlit.subheader("Model Selection")
model_names = streamlit.text_input("Model name from Huggingface", value="google/electra-small-discriminator")
streamlit.button(
"Train",
on_click=lambda: start_training(dataset_name, dataset_subset_name, model_names),
)