Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Commit
Β·
887de83
1
Parent(s):
f5f7856
Improve error handling in model information retrieval and enforce model size constraints
Browse files
utils.py
CHANGED
@@ -47,7 +47,7 @@ def get_model_info(model_id, verbose=False):
|
|
47 |
print(f"The model supports the following precisions: {supported_precisions}")
|
48 |
return num_downloads, num_likes, license, num_parameters, supported_precisions
|
49 |
except Exception as e:
|
50 |
-
|
51 |
return 0, 0, "Unknown", 0, []
|
52 |
|
53 |
def fetch_model_information(model_name):
|
@@ -61,11 +61,12 @@ def fetch_model_information(model_name):
|
|
61 |
return gr.update(choices=supported_precisions, value=supported_precisions[0]), license, num_parameters, num_downloads, num_likes
|
62 |
|
63 |
def submit_model(model_name, revision, precision, params, license, task, pending_gradio_df):
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
69 |
|
70 |
# Handle 'Missing' precision
|
71 |
if precision == 'Missing':
|
|
|
47 |
print(f"The model supports the following precisions: {supported_precisions}")
|
48 |
return num_downloads, num_likes, license, num_parameters, supported_precisions
|
49 |
except Exception as e:
|
50 |
+
print(f"Error: Could not fetch model information. {str(e)}")
|
51 |
return 0, 0, "Unknown", 0, []
|
52 |
|
53 |
def fetch_model_information(model_name):
|
|
|
61 |
return gr.update(choices=supported_precisions, value=supported_precisions[0]), license, num_parameters, num_downloads, num_likes
|
62 |
|
63 |
def submit_model(model_name, revision, precision, params, license, task, pending_gradio_df):
|
64 |
+
|
65 |
+
if float(params) == 0:
|
66 |
+
return "Model size cannot be zero. If the Auto Fetch feature failed and your model is suitable for evaluation, please open a community discussion for help.", pending_gradio_df
|
67 |
+
|
68 |
+
if float(params) > 5000:
|
69 |
+
return "Model size should be less than 5000 million parameters (5 billion) π", pending_gradio_df
|
70 |
|
71 |
# Handle 'Missing' precision
|
72 |
if precision == 'Missing':
|