Spaces:
Runtime error
Runtime error
Clémentine
commited on
Commit
•
a244751
1
Parent(s):
de891db
add submission field
Browse files- src/submission/submit.py +19 -8
src/submission/submit.py
CHANGED
@@ -75,6 +75,9 @@ def add_new_eval(
|
|
75 |
architectures = getattr(model_config, "architectures", None)
|
76 |
if architectures:
|
77 |
architecture = ";".join(architectures)
|
|
|
|
|
|
|
78 |
|
79 |
|
80 |
# Is the model info correctly filled?
|
@@ -95,23 +98,29 @@ def add_new_eval(
|
|
95 |
if not modelcard_OK:
|
96 |
return styled_error(error_msg)
|
97 |
|
|
|
|
|
|
|
|
|
98 |
# Storing the model tags
|
99 |
tags = []
|
100 |
-
|
101 |
-
model_card = ModelCard.load(model)
|
102 |
-
is_merge_from_metadata = False
|
103 |
if model_card.data.tags:
|
104 |
-
is_merge_from_metadata = "merge" in model_card.data.tags
|
105 |
-
|
106 |
-
tags.append("moe")
|
107 |
-
|
108 |
merge_keywords = ["mergekit", "merged model", "merge model", "merging"]
|
109 |
# If the model is a merge but not saying it in the metadata, we flag it
|
110 |
is_merge_from_model_card = any(keyword in model_card.text.lower() for keyword in merge_keywords)
|
111 |
-
if is_merge_from_model_card:
|
112 |
tags.append("merge")
|
113 |
if not is_merge_from_metadata:
|
114 |
tags.append("flagged:undisclosed_merge")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
|
116 |
|
117 |
# Seems good, creating the eval
|
@@ -138,6 +147,8 @@ def add_new_eval(
|
|
138 |
"license": license,
|
139 |
"still_on_hub": True,
|
140 |
"tags": tags,
|
|
|
|
|
141 |
}
|
142 |
|
143 |
# Check for duplicate submission
|
|
|
75 |
architectures = getattr(model_config, "architectures", None)
|
76 |
if architectures:
|
77 |
architecture = ";".join(architectures)
|
78 |
+
downloads = getattr(model_config, 'downloads', 0)
|
79 |
+
created_at = getattr(model_config, 'created_at', '')
|
80 |
+
|
81 |
|
82 |
|
83 |
# Is the model info correctly filled?
|
|
|
98 |
if not modelcard_OK:
|
99 |
return styled_error(error_msg)
|
100 |
|
101 |
+
is_merge_from_metadata = False
|
102 |
+
is_moe_from_metadata = False
|
103 |
+
model_card = ModelCard.load(model)
|
104 |
+
|
105 |
# Storing the model tags
|
106 |
tags = []
|
|
|
|
|
|
|
107 |
if model_card.data.tags:
|
108 |
+
is_merge_from_metadata = "merge" in model_card.data.tags
|
109 |
+
is_moe_from_metadata = "moe" in model_card.data.tags
|
|
|
|
|
110 |
merge_keywords = ["mergekit", "merged model", "merge model", "merging"]
|
111 |
# If the model is a merge but not saying it in the metadata, we flag it
|
112 |
is_merge_from_model_card = any(keyword in model_card.text.lower() for keyword in merge_keywords)
|
113 |
+
if is_merge_from_model_card or is_merge_from_metadata:
|
114 |
tags.append("merge")
|
115 |
if not is_merge_from_metadata:
|
116 |
tags.append("flagged:undisclosed_merge")
|
117 |
+
moe_keywords = ["moe", "mixture of experts"]
|
118 |
+
is_moe_from_model_card = any(keyword in model_card.text.lower() for keyword in moe_keywords)
|
119 |
+
is_moe_from_name = "moe" in model.lower().replace("/", "-").replace("_", "-").split("-")
|
120 |
+
if is_moe_from_model_card or is_moe_from_name or is_moe_from_metadata:
|
121 |
+
tags.append("moe")
|
122 |
+
if not is_moe_from_metadata:
|
123 |
+
tags.append("flagged:undisclosed_moe")
|
124 |
|
125 |
|
126 |
# Seems good, creating the eval
|
|
|
147 |
"license": license,
|
148 |
"still_on_hub": True,
|
149 |
"tags": tags,
|
150 |
+
"downloads": downloads,
|
151 |
+
"created_at": created_at
|
152 |
}
|
153 |
|
154 |
# Check for duplicate submission
|