Spaces:
Running
Running
Download constants.py from TabArena/leaderboard: direct link, hf CLI and curl.
- Browser
- Download file 3.69 kB
-
https://huggingface.co/spaces/TabArena/leaderboard/resolve/main/constants.py
- Command line
-
hf download hf://spaces/TabArena/leaderboard/constants.py
-
curl -L -o constants.py https://huggingface.co/spaces/TabArena/leaderboard/resolve/main/constants.py
3.69 kB
| class Constants: | |
| col_name: str = "method_type" | |
| tree: str = "Tree-based" | |
| foundational: str = "Foundation Model" | |
| neural_network: str ="Neural Network" | |
| baseline: str = "Baseline" | |
| # Whole pipelines rather than single models: AutoGluon, TabFM+, an agent, a hosted API. | |
| # Set upstream from MethodMetadata.method_class, never inferred from the name. | |
| system: str = "System" | |
| # Not Used | |
| other: str = "Other" | |
| # Order here defines the display order of the type legend and filters. | |
| model_type_emoji = { | |
| Constants.foundational: "π§ β‘", | |
| Constants.neural_network:"π§ π", | |
| Constants.tree: "π³", | |
| Constants.baseline: "π", | |
| # Not used | |
| Constants.other: "β", | |
| Constants.system:"π", | |
| } | |
| # Per-tag chip shown next to a system's name, from the `Tags` column of | |
| # website_leaderboard.csv (MethodTag in tabarena/models/_method_metadata.py). Keys must match | |
| # the tag strings that pipeline writes. | |
| tag_emoji = { | |
| "with-llm": "π€", | |
| "closed-source-api": "π", | |
| } | |
| tag_label = { | |
| "with-llm": "with LLMs", | |
| "closed-source-api": "closed-source API", | |
| } | |
| tag_tooltip = { | |
| "with-llm": ( | |
| "An LLM is involved somewhere in this system, which may include an agent. Its results " | |
| "depend on a model whose training data we cannot inspect and which may already have " | |
| "seen the test data." | |
| ), | |
| "closed-source-api": ( | |
| "This system runs behind a remote API we cannot inspect, and whose behaviour can change " | |
| "between runs." | |
| ), | |
| } | |
| # Per-variant accent color, taken from the interactive Leaderboard Overview | |
| # explorer's --var-* (dark theme) so its variant toggles and the leaderboard | |
| # table's agree. Keys must match views.VARIANT_VALUES. | |
| variant_color = { | |
| "default": "#4386d5", | |
| "tuned": "#c05f38", | |
| "tuned + ensembled": "#289972", | |
| } | |
| # Per-type accent color (readable as text/border on the dark theme). Used for the | |
| # type legend and to color-code model names in the cross-subset overview. | |
| model_type_color = { | |
| Constants.foundational: "#b07cf0", # purple | |
| Constants.neural_network: "#5aa9e6", # blue | |
| Constants.tree: "#5cb85c", # green | |
| Constants.baseline: "#9e9e9e", # gray | |
| Constants.other: "#9e9e9e", # gray | |
| Constants.system: "#f0a35a", # orange | |
| } | |
| # A system's color by the tag that shades it: the System orange, one step darker the less of | |
| # the system can be inspected. In precedence order, so a system with both tags takes the API | |
| # shade. Mirrors SYSTEM_SHADE_COLORS / SYSTEM_SHADE_TAGS in tabarena, which the generated | |
| # explorers and table use. | |
| system_shade_color = { | |
| "closed-source-api": "#b85c22", # rust | |
| "with-llm": "#dc8540", # darker orange | |
| } | |
| system_shade_label = { | |
| "closed-source-api": "Closed-source API system", | |
| "with-llm": "System with LLMs", | |
| } | |
| def system_shade(type_name: str, tags: object) -> str | None: | |
| """The tag that shades a system's color, from its `Tags` cell (NaN when empty), or None.""" | |
| if type_name != Constants.system or not isinstance(tags, str): | |
| return None | |
| present = set(tags.split(";")) | |
| return next((tag for tag in system_shade_color if tag in present), None) | |
| def type_symbols(emoji: str, shade: str | None = None) -> str: | |
| """A row's Type pill: its family symbol, plus the chip of the tag that shades it.""" | |
| return emoji + tag_emoji.get(shade, "") if shade else emoji | |
| def type_color(type_name: str, shade: str | None = None) -> str: | |
| """A row's accent color: its system shade when it has one, its family color otherwise.""" | |
| return system_shade_color.get(shade) or model_type_color.get(type_name, "#9e9e9e") | |