Spaces:
Sleeping
Sleeping
Upload 4 files
Browse files- app.py +17 -69
- models-table-free.csv +0 -0
- redact.py +117 -0
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -1,77 +1,25 @@
|
|
| 1 |
-
# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
|
| 2 |
-
|
| 3 |
-
# %% auto 0
|
| 4 |
-
__all__ = ['columns_to_click', 'title', 'description', 'dtypes', 'get_data']
|
| 5 |
-
|
| 6 |
-
# %% app.ipynb 0
|
| 7 |
import gradio as gr
|
| 8 |
import pandas as pd
|
| 9 |
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
columns_to_click = ["Paper / Repo", "Playground"]
|
| 13 |
-
|
| 14 |
-
def get_data():
|
| 15 |
-
# Load the CSV file into a DataFrame
|
| 16 |
-
df = pd.read_csv(
|
| 17 |
-
#test "https://docs.google.com/spreadsheets/d/e/2PACX-1vTmhqd7F40mODp2OeQLAn0t_IUd2tjGx0XIWt98HsKORKlejOGsrk6RP9rjjLF7k4krAkrce1FzlluT/pub?output=csv",
|
| 18 |
-
"https://docs.google.com/spreadsheets/d/e/2PACX-1vSC40sszorOjHfozmNqJT9lFiJhG94u3fbr3Ss_7fzcU3xqqJQuW1Ie_SNcWEB-uIsBi9NBUK7-ddet/pub?output=csv",
|
| 19 |
-
skiprows=1,
|
| 20 |
-
)
|
| 21 |
-
|
| 22 |
-
print("df.columns: ", df.columns)
|
| 23 |
-
|
| 24 |
-
# Drop rows where the 'Model' column is NaN
|
| 25 |
-
df.dropna(subset=['Model'], inplace=True)
|
| 26 |
-
|
| 27 |
-
# Drop rows where the 'Parameters \n(B)' column is 'TBA'
|
| 28 |
-
df = df[df["Announced\n▼"] != "TBA"]
|
| 29 |
-
|
| 30 |
-
# Apply make_clickable_cell to the specified columns
|
| 31 |
-
for col in columns_to_click:
|
| 32 |
-
df[col] = df[col].apply(make_clickable_cell)
|
| 33 |
-
|
| 34 |
-
return df
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
# %% app.ipynb 2
|
| 38 |
-
# Drop footers
|
| 39 |
-
df = df.copy()[~df["Model"].isna()]
|
| 40 |
|
| 41 |
-
|
| 42 |
-
# %% app.ipynb 3
|
| 43 |
-
# Drop TBA models
|
| 44 |
-
df = df.copy()[df["Announced\n▼"] != "TBA"]
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
# %% app.ipynb 6
|
| 48 |
-
def make_clickable_cell(cell):
|
| 49 |
-
if pd.isnull(cell):
|
| 50 |
-
return ""
|
| 51 |
-
else:
|
| 52 |
-
return f'<a target="_blank" href="{cell}">{cell}</a>'
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
# Load the data to get the columns for setting up datatype
|
| 56 |
-
dataframe = get_data()
|
| 57 |
-
dtypes = ["str" if c not in columns_to_click else "html" for c in dataframe.columns]
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
# %% app.ipynb 2
|
| 61 |
-
title = """<h1 align="center">The Large Language Models Landscape</h1>"""
|
| 62 |
-
description = """Large Language Models (LLMs) today come in a variety architectures and capabilities. This interactive landscape provides a visual overview of the most important LLMs, including their training data, size, release date, and whether they are openly accessible or not. It also includes notes on each model to provide additional context. This landscape is derived from data compiled by Dr. Alan D. Thompson at [LifeArchitect.ai/models-table](https://lifearchitect.ai/models-table/).
|
| 63 |
"""
|
| 64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
-
|
| 67 |
-
dtypes = ["str" if c not in columns_to_click else "markdown" for c in get_data().columns]
|
| 68 |
-
print("dtypes: ", dtypes)
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
# %% app.ipynb 4
|
| 72 |
-
with gr.Blocks() as demo:
|
| 73 |
-
gr.Markdown(title)
|
| 74 |
-
gr.Markdown(description)
|
| 75 |
-
gr.DataFrame(get_data, datatype=dtypes, every=60)
|
| 76 |
-
|
| 77 |
-
demo.queue().launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
+
DESCRIPTION = """
|
| 5 |
+
# LifeArchitect.ai Models Table Pro (Free Preview)
|
| 6 |
|
| 7 |
+
Browse 880+ AI models with parameters, benchmarks, and metadata.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
**███ = redacted** — upgrade to [Models Table Pro](https://lifearchitect.ai/models-table-pro/) for full access to all cells plus 18 additional columns (training hardware, compute estimates, energy/CO2, and more).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
"""
|
| 11 |
|
| 12 |
+
df = pd.read_csv("models-table-free.csv", dtype=str, keep_default_na=False)
|
| 13 |
+
|
| 14 |
+
with gr.Blocks(title="Models Table Pro — Free Preview") as demo:
|
| 15 |
+
gr.Markdown(DESCRIPTION)
|
| 16 |
+
gr.Dataframe(
|
| 17 |
+
value=df,
|
| 18 |
+
headers=list(df.columns),
|
| 19 |
+
datatype=["str"] * len(df.columns),
|
| 20 |
+
interactive=False,
|
| 21 |
+
wrap=True,
|
| 22 |
+
max_height=800,
|
| 23 |
+
)
|
| 24 |
|
| 25 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
models-table-free.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
redact.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Redact Models Table Pro CSV for the free HuggingFace version.
|
| 4 |
+
|
| 5 |
+
- Drops metadata row 1 (Google Sheets cruft)
|
| 6 |
+
- Cleans multi-line headers into single-line
|
| 7 |
+
- Drops columns 29+ (Training hardware, Compute, H100/B200/Rubin blocks)
|
| 8 |
+
- Drops Audit and 3 confidence columns
|
| 9 |
+
- Always redacts H100 cost to train
|
| 10 |
+
- Blacks out 1 cell per row via hash(model_name), plus 1 extra in last 3 cols
|
| 11 |
+
- Identity columns (Model, Lab, Announced) are never redacted
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
import csv
|
| 15 |
+
import hashlib
|
| 16 |
+
import sys
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
|
| 19 |
+
LAST_VISIBLE_COL = 28 # Country
|
| 20 |
+
REDACT_MARKER = "███"
|
| 21 |
+
|
| 22 |
+
# Columns dropped entirely from output
|
| 23 |
+
DROP_COLS = {22, 23, 24, 25} # Audit, Params total confidence, Params active confidence, Tokens confidence
|
| 24 |
+
|
| 25 |
+
# Columns always redacted (every row)
|
| 26 |
+
ALWAYS_REDACT = {8} # H100 cost to train
|
| 27 |
+
|
| 28 |
+
# Columns that are never redacted (identity / navigation)
|
| 29 |
+
NEVER_REDACT = {0, 1, 15} # Model, Lab, Announced
|
| 30 |
+
|
| 31 |
+
# Last 3 visible cols get double redaction
|
| 32 |
+
DOUBLE_REDACT_COLS = {26, 27, 28} # License, Context window, Country
|
| 33 |
+
|
| 34 |
+
# Columns eligible for the per-row hash redaction
|
| 35 |
+
REDACTABLE = [i for i in range(LAST_VISIBLE_COL + 1)
|
| 36 |
+
if i not in NEVER_REDACT and i not in DROP_COLS and i not in ALWAYS_REDACT]
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
def redact_cols(model_name: str) -> list[int]:
|
| 40 |
+
h = hashlib.sha256(model_name.encode()).hexdigest()
|
| 41 |
+
# First hash-picked column (from all redactable)
|
| 42 |
+
idx1 = int(h[:8], 16) % len(REDACTABLE)
|
| 43 |
+
col1 = REDACTABLE[idx1]
|
| 44 |
+
# Second hash-picked column (from last 3 only)
|
| 45 |
+
double_list = sorted(DOUBLE_REDACT_COLS)
|
| 46 |
+
idx2 = int(h[8:16], 16) % len(double_list)
|
| 47 |
+
col2 = double_list[idx2]
|
| 48 |
+
return [col1, col2]
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def clean_header(h: str) -> str:
|
| 52 |
+
return " ".join(h.split()).strip()
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
def main():
|
| 56 |
+
if len(sys.argv) < 2:
|
| 57 |
+
print(f"Usage: {sys.argv[0]} <input.csv> [output.csv]")
|
| 58 |
+
sys.exit(1)
|
| 59 |
+
|
| 60 |
+
infile = Path(sys.argv[1])
|
| 61 |
+
outfile = Path(sys.argv[2]) if len(sys.argv) > 2 else infile.with_name("models-table-free.csv")
|
| 62 |
+
|
| 63 |
+
with open(infile, newline="", encoding="utf-8") as f:
|
| 64 |
+
reader = csv.reader(f)
|
| 65 |
+
metadata_row = next(reader) # row 1: "(886 models), License:, ..."
|
| 66 |
+
header_row = next(reader) # row 2: actual headers
|
| 67 |
+
data_rows = list(reader)
|
| 68 |
+
|
| 69 |
+
# Clean headers, keep only visible cols (drop DROP_COLS)
|
| 70 |
+
keep_cols = [i for i in range(LAST_VISIBLE_COL + 1) if i not in DROP_COLS]
|
| 71 |
+
headers = [clean_header(header_row[i]) for i in keep_cols]
|
| 72 |
+
|
| 73 |
+
out_rows = []
|
| 74 |
+
for row in data_rows:
|
| 75 |
+
model_name = row[0].strip() if row else ""
|
| 76 |
+
if not model_name:
|
| 77 |
+
continue
|
| 78 |
+
|
| 79 |
+
# Pad short rows
|
| 80 |
+
full = row[: LAST_VISIBLE_COL + 1]
|
| 81 |
+
while len(full) < LAST_VISIBLE_COL + 1:
|
| 82 |
+
full.append("")
|
| 83 |
+
|
| 84 |
+
# Always-redact columns
|
| 85 |
+
for c in ALWAYS_REDACT:
|
| 86 |
+
full[c] = REDACT_MARKER
|
| 87 |
+
|
| 88 |
+
# Hash-based redaction: 1 from general pool + 1 from last 3
|
| 89 |
+
for c in redact_cols(model_name):
|
| 90 |
+
full[c] = REDACT_MARKER
|
| 91 |
+
|
| 92 |
+
# Keep only non-dropped columns
|
| 93 |
+
visible = [full[i] for i in keep_cols]
|
| 94 |
+
out_rows.append(visible)
|
| 95 |
+
|
| 96 |
+
with open(outfile, "w", newline="", encoding="utf-8") as f:
|
| 97 |
+
writer = csv.writer(f)
|
| 98 |
+
writer.writerow(headers)
|
| 99 |
+
writer.writerows(out_rows)
|
| 100 |
+
|
| 101 |
+
print(f"Wrote {len(out_rows)} rows to {outfile}")
|
| 102 |
+
print(f"Columns: {len(headers)} (dropped {len(header_row) - len(headers)} columns)")
|
| 103 |
+
|
| 104 |
+
# Show distribution of redacted columns
|
| 105 |
+
from collections import Counter
|
| 106 |
+
dist = Counter()
|
| 107 |
+
for row in out_rows:
|
| 108 |
+
for i, v in enumerate(row):
|
| 109 |
+
if v == REDACT_MARKER:
|
| 110 |
+
dist[headers[i]] += 1
|
| 111 |
+
print("\nRedaction distribution:")
|
| 112 |
+
for col, count in dist.most_common():
|
| 113 |
+
print(f" {col}: {count}")
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
if __name__ == "__main__":
|
| 117 |
+
main()
|
requirements.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
|
|
| 1 |
pandas
|
| 2 |
-
nbdev
|
|
|
|
| 1 |
+
gradio>=5.0
|
| 2 |
pandas
|
|
|