Spaces:
Running
Running
yangzhitao
commited on
Commit
·
9b36a13
1
Parent(s):
b2443f5
fix: initialize model_config to None in EvalResult class to prevent potential reference errors
Browse files- src/display/formatting.py +14 -2
- src/leaderboard/read_evals.py +1 -0
src/display/formatting.py
CHANGED
|
@@ -1,16 +1,28 @@
|
|
| 1 |
import typing
|
|
|
|
| 2 |
|
| 3 |
if typing.TYPE_CHECKING:
|
| 4 |
import pandas as pd
|
| 5 |
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
def model_hyperlink(link: str, model_name: str) -> str:
|
| 8 |
-
return
|
| 9 |
|
| 10 |
|
| 11 |
def make_clickable_model(model_name: str, link: str | None = None) -> str:
|
|
|
|
| 12 |
if not link:
|
| 13 |
-
org, _, model = model_name.rpartition("/")
|
| 14 |
if not org:
|
| 15 |
# Not a full model name, cannot be clicked
|
| 16 |
return model_name
|
|
|
|
| 1 |
import typing
|
| 2 |
+
from textwrap import dedent
|
| 3 |
|
| 4 |
if typing.TYPE_CHECKING:
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
|
| 8 |
+
MODEL_HYPERLINK_TEMPLATE = dedent("""
|
| 9 |
+
<a
|
| 10 |
+
target="_blank"
|
| 11 |
+
href="{link}"
|
| 12 |
+
style="color: var(--link-text-color); text-decoration: underline; text-decoration-style: dotted;"
|
| 13 |
+
>
|
| 14 |
+
{model_name}
|
| 15 |
+
</a>
|
| 16 |
+
""").strip()
|
| 17 |
+
|
| 18 |
+
|
| 19 |
def model_hyperlink(link: str, model_name: str) -> str:
|
| 20 |
+
return MODEL_HYPERLINK_TEMPLATE.format(link=link, model_name=model_name)
|
| 21 |
|
| 22 |
|
| 23 |
def make_clickable_model(model_name: str, link: str | None = None) -> str:
|
| 24 |
+
org, _, model = model_name.rpartition("/")
|
| 25 |
if not link:
|
|
|
|
| 26 |
if not org:
|
| 27 |
# Not a full model name, cannot be clicked
|
| 28 |
return model_name
|
src/leaderboard/read_evals.py
CHANGED
|
@@ -119,6 +119,7 @@ class EvalResult(BaseModel):
|
|
| 119 |
)
|
| 120 |
else:
|
| 121 |
still_on_hub = False
|
|
|
|
| 122 |
architecture: str = "?"
|
| 123 |
if model_config is not None:
|
| 124 |
architectures: list[str] | None = getattr(model_config, "architectures", None)
|
|
|
|
| 119 |
)
|
| 120 |
else:
|
| 121 |
still_on_hub = False
|
| 122 |
+
model_config = None
|
| 123 |
architecture: str = "?"
|
| 124 |
if model_config is not None:
|
| 125 |
architectures: list[str] | None = getattr(model_config, "architectures", None)
|