File size: 2,925 Bytes
87248a0
a8a1b3d
 
87248a0
a8a1b3d
 
 
 
 
87248a0
 
a8a1b3d
 
 
 
87248a0
 
 
 
 
 
 
 
 
 
a8a1b3d
 
 
 
 
87248a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a8a1b3d
 
87248a0
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import pandas as pd
import streamlit as st
# Define color maps for both light and dark modes
COLOR_MAP = {
    "light": {
        "yellow": "background-color: rgba(255, 255, 204, 0.5)",  # Reasoning models
        "green": "background-color: rgba(227, 251, 233, 0.5)",   # Linear attention hybrid
        "blue": "background-color: rgba(230, 244, 255, 0.5)"     # SSM hybrid models
    },
}

def get_color_map():
    """Returns the appropriate color map based on the current theme."""
    return COLOR_MAP["light"]

def style_zero_context(df):
    """
    Similar approach to style_long_context:
    1) color rows based on model name
    2) numeric formatting
    """
    import pandas as pd

    # Example color dict, tweak as needed:
    color_mapping = {
        "minimax-text-01": get_color_map()["green"],
        "jamba-1.5-large": get_color_map()["blue"],
        "deepseek-r1": get_color_map()["yellow"],
        "o1-mini": get_color_map()["yellow"],
        "qwq-32b-preview": get_color_map()["yellow"],
        # Add any other special-cased models here
        # "o1-mini": COLOR_MAP["yellow"], etc.
    }
    styler = df.style.apply(
        lambda row: [color_mapping.get(row["Model"], "")]*len(row),
        axis=1
    )
    
    # # Attach custom tooltips (optional)
    # tooltips = pd.DataFrame("", index=df.index, columns=df.columns)
    # if "1st<50% op" in df.columns:
    #     tooltips["1st<50% op"] = "First operation number with accuracy <50%"
    # if "1st<10% op" in df.columns:
    #     tooltips["1st<10% op"] = "First operation number with accuracy <10%"
    # if "Avg. Acc op≤30" in df.columns:
    #     tooltips["Avg. Acc op≤30"] = "Average accuracy of first 30 operations"
    # styler = styler.set_tooltips(tooltips)

    # Apply numeric formatting
    styler = styler.format({
        "Symbolic": "{:,.2f}",       # Format as number with thousands separator and 1 decimal place
        "Medium": "{:,.2f}",        # Format as number with thousands separator and 2 decimal places
        "Hard": "{:,.2f}",          # Format as number with thousands separator and 2 decimal places
        "1st<50% op": "{:,.0f}",      # Format as plain integer (no decimal places)
        "1st<10% op": "{:,.0f}",      # Format as plain integer (no decimal places)
        "Avg. Acc op≤30": "{:.4f}",  # Format with 4 decimal places
        "Average↑": "{:,.2f}"      # Format as number with thousands separator and 2 decimal places
    })

    
    return styler
# Add styling for model types
def style_long_context(df):
    color_mapping = {
        "minimax-text-01": get_color_map()["green"],
        "jamba-1.5-large": get_color_map()["blue"]
    }
    
    return df.style.apply(
        lambda row: [color_mapping.get(row["Model"], "")]*len(row),
        axis=1
    ).format({
        "8K": "{:,.2f}",
        "16K": "{:,.2f}", 
        "32K": "{:,.2f}",
        "Average↑": "{:,.2f}"
    })