Support very small models on CPU
Browse files
app.py
CHANGED
@@ -4,6 +4,15 @@ from transformer_ranker import TransformerRanker, prepare_popular_models
|
|
4 |
|
5 |
st.title("Choose Your Transformer")
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
# 1) Select dataset names (from text classification or token classification subcategory)
|
8 |
dataset_options = ['trec', 'conll2003'] # Example datasets; you can expand this list
|
9 |
selected_dataset = st.selectbox("Select Dataset", dataset_options)
|
@@ -13,9 +22,9 @@ downsample_values = [0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
|
|
13 |
downsample_ratio = st.select_slider("Dataset Downsample Ratio", options=downsample_values, value=0.2)
|
14 |
|
15 |
# 3) Select multiple models from HuggingFace model hub
|
16 |
-
|
17 |
-
|
18 |
-
selected_models =
|
19 |
|
20 |
# 4) Select the parameter for layer selection with layermean as the default
|
21 |
layer_options = ['lastlayer', 'layermean', 'bestlayer']
|
|
|
4 |
|
5 |
st.title("Choose Your Transformer")
|
6 |
|
7 |
+
model_options = {
|
8 |
+
'bert-tiny': 'prajjwal1/bert-tiny',
|
9 |
+
'bert-small': 'prajjwal1/bert-small',
|
10 |
+
'electra-small': 'google/electra-small-discriminator',
|
11 |
+
'deberta-small': 'microsoft/deberta-v3-small',
|
12 |
+
'distilbert-cased': 'distilbert-base-cased',
|
13 |
+
'distilbert-uncased': 'distilbert-base-uncased',
|
14 |
+
}
|
15 |
+
|
16 |
# 1) Select dataset names (from text classification or token classification subcategory)
|
17 |
dataset_options = ['trec', 'conll2003'] # Example datasets; you can expand this list
|
18 |
selected_dataset = st.selectbox("Select Dataset", dataset_options)
|
|
|
22 |
downsample_ratio = st.select_slider("Dataset Downsample Ratio", options=downsample_values, value=0.2)
|
23 |
|
24 |
# 3) Select multiple models from HuggingFace model hub
|
25 |
+
model_names = list(model_options.keys())
|
26 |
+
selected_models = st.multiselect("Select Models", model_names, default=['bert-tiny', 'electra-small'])
|
27 |
+
selected_models = [model_options[model_name] for model_name in selected_models]
|
28 |
|
29 |
# 4) Select the parameter for layer selection with layermean as the default
|
30 |
layer_options = ['lastlayer', 'layermean', 'bestlayer']
|