yonikremer
commited on
Commit
•
4267129
1
Parent(s):
f901672
improved readability
Browse files- supported_models.py +12 -9
supported_models.py
CHANGED
@@ -14,8 +14,8 @@ BLACKLISTED_MODEL_NAMES = {
|
|
14 |
"bigscience/mt0-base",
|
15 |
"bigscience/mt0-small",
|
16 |
}
|
17 |
-
|
18 |
-
|
19 |
|
20 |
|
21 |
def get_model_name(model_card: Tag) -> str:
|
@@ -24,16 +24,19 @@ def get_model_name(model_card: Tag) -> str:
|
|
24 |
return h4_tag.text
|
25 |
|
26 |
|
27 |
-
def is_a_number(
|
28 |
-
|
|
|
|
|
|
|
29 |
try:
|
30 |
-
float(
|
31 |
-
return True
|
32 |
except ValueError:
|
33 |
return False
|
|
|
34 |
|
35 |
|
36 |
-
def get_numeric_contents(model_card):
|
37 |
div: Union[Tag | NavigableString] = model_card.find(
|
38 |
"div",
|
39 |
class_="mr-1 flex items-center overflow-hidden whitespace-nowrap text-sm leading-tight text-gray-400",
|
@@ -122,8 +125,8 @@ def generate_supported_model_names(
|
|
122 |
|
123 |
|
124 |
def get_supported_model_names(
|
125 |
-
min_number_of_downloads: int =
|
126 |
-
min_number_of_likes: int =
|
127 |
) -> Set[str]:
|
128 |
return set(generate_supported_model_names(
|
129 |
min_number_of_downloads=min_number_of_downloads,
|
|
|
14 |
"bigscience/mt0-base",
|
15 |
"bigscience/mt0-small",
|
16 |
}
|
17 |
+
DEFAULT_MIN_NUMBER_OF_DOWNLOADS = 100
|
18 |
+
DEFAULT_MIN_NUMBER_OF_LIKES = 20
|
19 |
|
20 |
|
21 |
def get_model_name(model_card: Tag) -> str:
|
|
|
24 |
return h4_tag.text
|
25 |
|
26 |
|
27 |
+
def is_a_number(elem: PageElement) -> bool:
|
28 |
+
text = elem.text
|
29 |
+
lowered_text = text.strip().lower()
|
30 |
+
no_characters_text = lowered_text.replace("k", "").replace("m", "").replace("b", "")
|
31 |
+
elem = no_characters_text.replace(",", "").replace(".", "")
|
32 |
try:
|
33 |
+
float(elem)
|
|
|
34 |
except ValueError:
|
35 |
return False
|
36 |
+
return True
|
37 |
|
38 |
|
39 |
+
def get_numeric_contents(model_card: Tag) -> List[PageElement]:
|
40 |
div: Union[Tag | NavigableString] = model_card.find(
|
41 |
"div",
|
42 |
class_="mr-1 flex items-center overflow-hidden whitespace-nowrap text-sm leading-tight text-gray-400",
|
|
|
125 |
|
126 |
|
127 |
def get_supported_model_names(
|
128 |
+
min_number_of_downloads: int = DEFAULT_MIN_NUMBER_OF_DOWNLOADS,
|
129 |
+
min_number_of_likes: int = DEFAULT_MIN_NUMBER_OF_LIKES,
|
130 |
) -> Set[str]:
|
131 |
return set(generate_supported_model_names(
|
132 |
min_number_of_downloads=min_number_of_downloads,
|