Update app.py
Browse files
app.py
CHANGED
@@ -12,15 +12,18 @@ def add_model_to_list(new_model):
|
|
12 |
model_list.append(new_model) # Add the new model to the list.
|
13 |
return model_list
|
14 |
|
15 |
-
|
16 |
# Function to create a configuration for the selected model.
|
17 |
def create_config(model_name, num_labels, use_cache):
|
18 |
if isinstance(model_name, list):
|
19 |
model_name = model_name[0] # Take the first model name from the list if it's a list
|
20 |
-
|
|
|
|
|
|
|
21 |
# If the selected model is not in the list, add it (this is a safety check).
|
22 |
if model_name not in model_list:
|
23 |
model_list.append(model_name)
|
|
|
24 |
# Create a configuration for the selected model using AutoConfig.
|
25 |
config = AutoConfig.from_pretrained(model_name, num_labels=num_labels, use_cache=use_cache)
|
26 |
return str(config) # Return the configuration as a string.
|
|
|
12 |
model_list.append(new_model) # Add the new model to the list.
|
13 |
return model_list
|
14 |
|
|
|
15 |
# Function to create a configuration for the selected model.
|
16 |
def create_config(model_name, num_labels, use_cache):
|
17 |
if isinstance(model_name, list):
|
18 |
model_name = model_name[0] # Take the first model name from the list if it's a list
|
19 |
+
|
20 |
+
# Ensure num_labels is an integer
|
21 |
+
num_labels = int(num_labels)
|
22 |
+
|
23 |
# If the selected model is not in the list, add it (this is a safety check).
|
24 |
if model_name not in model_list:
|
25 |
model_list.append(model_name)
|
26 |
+
|
27 |
# Create a configuration for the selected model using AutoConfig.
|
28 |
config = AutoConfig.from_pretrained(model_name, num_labels=num_labels, use_cache=use_cache)
|
29 |
return str(config) # Return the configuration as a string.
|