sdp commited on
Commit ·
23fd3e6
1
Parent(s): 115341e
update auto_quant and auto_eval
Browse filesFiles changed (5)
45 unmodified lines4647484950515253323 unmodified lines37737837938038138238338438538638738838939039139239339413 unmodified lines4084094104114124131 unmodified line41541641741841942042142274 unmodified lines497498499500501502503504326 unmodified lines831832833834835836837172 unmodified lines1010101110121013101410153 unmodified lines10191020102110221023102436 unmodified lines10611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128243 unmodified lines1326132713281329133013311332117 unmodified lines14501451145214531454145514561457145814591460146114621463146414651466146714681469147021 unmodified lines14921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154258 unmodified lines16011602160316041605160616071608160916101611161216131614161516161617161816191620162121 unmodified lines164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693114 unmodified lines180818091810181118121813181418151816181714 unmodified lines18321833183418351836183744 unmodified lines18821883188418851886188718881889189018911892189318941895189618971898189945 unmodified linesCOLS,EVAL_COLS,EVAL_TYPES,QUANT_COLS,QUANT_TYPES,NUMERIC_INTERVALS,NUMERIC_MODELSIZE,TYPES,323 unmodified lines"""Called on page load (e.g. after OAuth redirect) to log user infoand conditionally show the hardware selector for SIZE_WHITELIST users."""show_hw = Falseif oauth_token is not None and oauth_token.token and SIZE_WHITELIST is not None:try:info = whoami(token=oauth_token.token)username = info.get("name", "unknown")orgs = [org["name"] for org in info.get("orgs", [])]logger.info("[Auth][PageLoad] user=%s orgs=%s", username, orgs)show_hw = username in SIZE_WHITELISTexcept Exception as e:logger.warning("[Auth][PageLoad] whoami failed: %s", e)return (gr.update(visible=show_hw), # hw_dropdown_quantgr.update(visible=show_hw), # hw_dropdown_eval)13 unmodified linesreturn "TRIGGER"def submit_model(signal, model, revision, private, compute_dtype, model_size_input, hardware_choice, gpu_count_choice, oauth_token: gr.OAuthToken | None = None):"""Wrapper that parses the optional model-size field and calls add_new_eval.1 unmodified linegiving the user real-time progress updates."""print(f"[DEBUG] submit_model called: signal={signal!r}, model={model!r}, oauth_token={oauth_token is not None}")if signal == "TRIGGER":print("[DEBUG] submit_model => skipped (TRIGGER)")yield ""return74 unmodified linesgiving the user real-time progress updates."""print(f"[DEBUG] submit_quant called: signal={signal!r}, model={model!r}, oauth_token={oauth_token is not None}")if signal == "TRIGGER":print("[DEBUG] submit_quant => skipped (TRIGGER)")yield ""return326 unmodified linesif col in filtered_df.columns and col not in final_cols:final_cols.append(col)filtered_df = filtered_df.sort_values(by=AUTO_PIPELINE_SORT_COL, ascending=False, na_position="last")filtered_df = prepare_auto_pipeline_display_df(filtered_df)return _add_row_numbers(filtered_df[final_cols])172 unmodified linesreturn token_map.get(prefix) or HF_TOKEN or ""demo = gr.Blocks(fill_width=True)with demo:# Hidden login button (CSS hidden, triggered by JS when auth needed)3 unmodified linessignal_box = gr.Textbox(visible=False, elem_id="auth-signal-box")# Per-user session state (replaces global mutable variables)filter_state = gr.State({"weightDtype": list(_DEFAULT_WEIGHT_DTYPES),"computeDtype": list(_DEFAULT_COMPUTE_DTYPES),36 unmodified lines)with gr.Column(elem_classes="main-content"):# ── Page: LLM Benchmark (hidden) ─────────────────────────────with gr.Column(visible=False, elem_id="page-benchmark", elem_classes=["page-hidden"]) as page_benchmark:# ── Search ───────────────────────────────────────────────with gr.Row():search_bar = gr.Textbox(placeholder="Search for your model (separate multiple queries with ; ) and press ENTER...",show_label=False,elem_id="search-bar",)# ── Filters (collapsible) ────────────────────────────────with gr.Accordion("Filters & Columns", open=False, elem_id="accordion-filters"):with gr.Group(elem_id="filter-panel"):# Row 1: size filters + quant type/precisionwith gr.Row(equal_height=True):with gr.Column(scale=1, min_width=260):filter_columns_parameters = gr.CheckboxGroup(label="Model parameters (billions)",choices=list(NUMERIC_INTERVALS.keys()),value=list(NUMERIC_INTERVALS.keys()),interactive=True,elem_id="filter-columns-size",)filter_columns_size = gr.CheckboxGroup(label="Model sizes (GB, int4)",choices=list(NUMERIC_MODELSIZE.keys()),value=list(NUMERIC_MODELSIZE.keys()),interactive=True,elem_id="filter-columns-size",)with gr.Column(scale=1, min_width=260):filter_columns_type = gr.CheckboxGroup(label="Quantization types",choices=[t.to_str() for t in QuantType if t != QuantType.QuantType_None],value=[t.to_str() for t in QuantType if t != QuantType.QuantType_None],interactive=True,elem_id="filter-columns-type",)filter_columns_precision = gr.CheckboxGroup(label="Weight precision",choices=[i.value.name for i in Precision],value=[i.value.name for i in Precision if i.value.name not in ('16bit', '32bit')],interactive=True,elem_id="filter-columns-precision",)with gr.Column(scale=1, min_width=260):with gr.Column(elem_id="quant-config-container"):gr.HTML("<div class='quant-config-header'>Quantization config</div>")with gr.Row():filter_columns_computeDtype = gr.Dropdown(choices=[i.value.name for i in ComputeDtype],label="Compute Dtype", value="All", interactive=True,)filter_columns_weightDtype = gr.Dropdown(choices=[i.value.name for i in WeightDtype],label="Weight Dtype", value="All", interactive=True,)with gr.Row():filter_columns_doubleQuant = gr.Dropdown(choices=["All", "True", "False"],label="Double Quant", value="All", interactive=True,)filter_columns_groupDtype = gr.Dropdown(choices=[i.value.name for i in GroupDtype],label="Group Size", value="All", interactive=True,)# Row 2: column visibilitywith gr.Row():shown_columns = gr.CheckboxGroup(choices=[c.namefor c in fields(auto_eval_cols)if not c.hidden and not c.never_hidden and not c.dummy],value=[c.namefor c in fields(auto_eval_cols)if c.displayed_by_default and not c.hidden and not c.never_hidden],label="Visible columns",elem_id="column-select",interactive=True,)# ── Leaderboard table ────────────────────────────────────never_hidden_cols = [c.name for c in fields(auto_eval_cols) if c.never_hidden]user_cols = [c.namefor c in fields(auto_eval_cols)if c.displayed_by_default and not c.hidden and not c.never_hidden]# Column order: model (never_hidden) first, then user_cols in COLS orderfinal_cols = never_hidden_cols + user_colsleaderboard_display_df = _add_row_numbers(leaderboard_df[final_cols + [auto_eval_cols.dummy.name]])leaderboard_table = gr.components.Dataframe(value=leaderboard_display_df,headers=[ROW_NUMBER_COL] + final_cols,datatype="markdown",elem_id="leaderboard-table",interactive=False,visible=True,)# ── Comparison bar (below table) ─────────────────────────with gr.Group(elem_id="compare-shell"):with gr.Group(elem_id="compare-bar"):with gr.Row():with gr.Column(scale=5):model_comparison = gr.CheckboxGroup(label="Accuracy Comparison (click rows in table to select models)",choices=[], value=[],interactive=True, elem_id="model_comparison",)with gr.Column(scale=1, min_width=120, elem_classes=["action-center-col"]):gr.HTML("<div class='action-spacer'></div>")spider_btn = gr.Button("Compare", variant="primary", elem_id="compare-button-full")gr.HTML("<div class='action-spacer'></div>")# ── Event wiring ─────────────────────────────────────────leaderboard_table.select(select, [leaderboard_table, selection_state], [model_comparison, selection_state])spider_btn.click(fn=show_modal,outputs=modal_window).then(fn=generate_spider_chart,inputs=[leaderboard_table, model_comparison, selection_state],outputs=[comparison_plot_inside, comparison_df_inside])close_btn.click(fn=close_modal_logic,outputs=modal_window)demo.load(init_comparison_data, [selection_state], model_comparison)if "Weight type" not in original_df.columns:original_df["Weight type"] = "Unknown"# Hidden componentshidden_leaderboard_table_for_search = gr.components.Dataframe(value=original_df[COLS],headers=COLS,datatype=TYPES,visible=False,)hide_models = gr.Textbox(placeholder="", show_label=False,elem_id="search-bar", value="", visible=False,)search_bar.submit(update_table,[hidden_leaderboard_table_for_search,shown_columns,filter_columns_type,filter_columns_precision,filter_columns_parameters,filter_columns_size,hide_models,search_bar,filter_columns_computeDtype,filter_columns_weightDtype,filter_columns_doubleQuant,filter_columns_groupDtype,filter_state,],leaderboard_table,)filter_columns_type.change(update_quantization_types,[filter_columns_type, filter_state],[filter_columns_weightDtype, filter_columns_computeDtype, filter_columns_precision, filter_state])filter_columns_precision.change(update_Weight_Precision,[filter_columns_precision, filter_state],[filter_columns_weightDtype, filter_columns_computeDtype, filter_columns_precision, filter_columns_type, filter_state])filter_columns_weightDtype.change(update_Weight_Dtype,[filter_columns_weightDtype, filter_state],[filter_columns_precision, filter_state])for selector in [shown_columns, filter_columns_type, filter_columns_precision, filter_columns_size, filter_columns_parameters, hide_models, filter_columns_computeDtype, filter_columns_weightDtype, filter_columns_doubleQuant, filter_columns_groupDtype]:selector.change(update_table,[hidden_leaderboard_table_for_search,shown_columns,filter_columns_type,filter_columns_precision,filter_columns_parameters,filter_columns_size,hide_models,search_bar,filter_columns_computeDtype,filter_columns_weightDtype,filter_columns_doubleQuant,filter_columns_groupDtype,filter_state,],leaderboard_table,queue=True,)# ── Page: Auto Pipeline Results ───────────────────────────────with gr.Column(visible=True, elem_id="page-pipeline-results") as page_pipeline_results:43 unmodified linesauto_pipeline_initial_cols.append(col)auto_pipeline_display_df = prepare_auto_pipeline_display_df(auto_pipeline_all_df)auto_pipeline_table = gr.components.Dataframe(value=_add_row_numbers(auto_pipeline_display_df[auto_pipeline_initial_cols]),headers=[ROW_NUMBER_COL] + auto_pipeline_initial_cols,117 unmodified lineselem_classes=["submit-action-btn"],)submission_result = gr.Markdown()submit_button.click(_check_auth_for_submit,inputs=[],outputs=signal_box,js="""() => {// Save tab + model name to sessionStorage before auth checkvar modelInput = document.querySelector('#model-input-quant input, #model-input-quant textarea');var modelVal = modelInput ? modelInput.value : '';sessionStorage.setItem('pending_submit', JSON.stringify({tab: 'quant',model: modelVal}));return [];}""",).then(submit_quant,[21 unmodified lines) # revision_name_textbox is hidden, always "main"with gr.Column():with gr.Accordion(f"Finished Quantizations ({len(finished_quant_queue_df)})",open=False, elem_id="accordion-finished-quant",):finished_quant_table = gr.components.Dataframe(value=finished_quant_queue_df,headers=QUANT_COLS,datatype=QUANT_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(QUANT_COLS) - 2),)with gr.Accordion(f"Running Quantization Queue ({len(running_quant_queue_df)})",open=False, elem_id="accordion-running-quant",):running_quant_table = gr.components.Dataframe(value=running_quant_queue_df,headers=QUANT_COLS,datatype=QUANT_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(QUANT_COLS) - 2),)with gr.Accordion(f"Pending Quantization Queue ({len(pending_quant_queue_df)})",open=False, elem_id="accordion-pending-quant",):pending_quant_table = gr.components.Dataframe(value=pending_quant_queue_df,headers=QUANT_COLS,datatype=QUANT_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(QUANT_COLS) - 2),)with gr.Accordion(f"Failed Quantizations ({len(failed_quant_queue_df)})",open=False, elem_id="accordion-failed-quant",):failed_quant_table = gr.components.Dataframe(value=failed_quant_queue_df,headers=QUANT_COLS,datatype=QUANT_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(QUANT_COLS) - 2),)# ── Page: Auto Eval ──────────────────────────────────────────58 unmodified lineselem_classes=["submit-action-btn"],)submission_result_auto_eval = gr.Markdown()submit_button_auto_eval.click(_check_auth_for_submit,inputs=[],outputs=signal_box,js="""() => {// Save tab + model name to sessionStorage before auth checkvar modelInput = document.querySelector('#model-input-eval input, #model-input-eval textarea');var modelVal = modelInput ? modelInput.value : '';sessionStorage.setItem('pending_submit', JSON.stringify({tab: 'eval',model: modelVal}));return [];}""",).then(submit_model,[21 unmodified lines)with gr.Column():with gr.Accordion(f"Finished Evaluations ({len(finished_eval_queue_df)})",open=False, elem_id="accordion-finished-eval",):finished_eval_table_auto_eval = gr.components.Dataframe(value=finished_eval_queue_df,headers=EVAL_COLS,datatype=EVAL_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(EVAL_COLS) - 2),)with gr.Accordion(f"Running Evaluation Queue ({len(running_eval_queue_df)})",open=False, elem_id="accordion-running-eval",):running_eval_table_auto_eval = gr.components.Dataframe(value=running_eval_queue_df,headers=EVAL_COLS,datatype=EVAL_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(EVAL_COLS) - 2),)with gr.Accordion(f"Pending Evaluation Queue ({len(pending_eval_queue_df)})",open=False, elem_id="accordion-pending-eval",):pending_eval_table_auto_eval = gr.components.Dataframe(value=pending_eval_queue_df,headers=EVAL_COLS,datatype=EVAL_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(EVAL_COLS) - 2),)with gr.Accordion(f"Failed Evaluations ({len(failed_eval_queue_df)})",open=False, elem_id="accordion-failed-eval",):failed_eval_table_auto_eval = gr.components.Dataframe(value=failed_eval_queue_df,headers=EVAL_COLS,datatype=EVAL_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(EVAL_COLS) - 2),)# ── Page: Metrics ────────────────────────────────────────────114 unmodified lines# ── Sidebar → page switching (handled entirely in client-side JS) ──# Log user info on page load; show hardware dropdown for whitelisted usersdemo.load(fn=_process_user_on_load,inputs=None,outputs=[hw_col_quant, hw_col_eval],)# When signal_box changes to "TRIGGER", redirect to OAuth login14 unmodified lines}""",)# Load Lucide icons + sidebar branding + page switching_SIDEBAR_HEAD = """<style>44 unmodified lines<script>(function() {var BRAND_LOGO = "https://imgur.com/cu4lW7q.png";var PAGE_IDS = ['benchmark', 'pipeline-results', 'quant', 'eval', 'metrics', 'about', 'faq'];var HERO_COPY = {benchmark: {title: 'Low-precision Open LLM Leaderboard',subtitle: 'Track, compare and benchmark quantized language models across 3 standard evaluation tasks',badges: [{ icon: '🏆', text: 'Open Source Model' },{ icon: '⚡', text: 'INT4 (W4A16) / MXFP4 / NVFP4' },{ icon: '📊', text: 'Open Source Benchmark' },{ icon: '🤖', text: 'Agentic AI for AutoQuant / AutoEvaluate' }]},'pipeline-results': {title: 'Leaderboard',subtitle: 'AI-driven quantization and evaluation — autonomous low-bit compression and benchmarking of open-source LLMs',45 unmodified lines464748495051525354555657323 unmodified lines38138238338438538638738838939039139239339439539639739839940040140240340440513 unmodified lines4194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395401 unmodified line54254354454554654754854974 unmodified lines624625626627628629630631326 unmodified lines958959960961962963964965966967968172 unmodified lines11411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912103 unmodified lines12141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124336 unmodified lines12801281128212831284128543 unmodified lines1329133013311332133313341335133613371338133913401341117 unmodified lines145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149221 unmodified lines1514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157258 unmodified lines163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166421 unmodified lines16861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744114 unmodified lines18591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202014 unmodified lines2035203620372038203920402041204220432044204520462047204844 unmodified lines2093209420952096209720982099210045 unmodified linesCOLS,EVAL_COLS,EVAL_TYPES,EVAL_DISPLAY_COLS,EVAL_DISPLAY_TYPES,QUANT_COLS,QUANT_TYPES,QUANT_DISPLAY_COLS,QUANT_DISPLAY_TYPES,NUMERIC_INTERVALS,NUMERIC_MODELSIZE,TYPES,323 unmodified lines"""Called on page load (e.g. after OAuth redirect) to log user infoand conditionally show the hardware selector for SIZE_WHITELIST users."""show_hw = Falseusername = ""if oauth_token is not None and oauth_token.token:try:info = whoami(token=oauth_token.token)username = info.get("name", "")orgs = [org["name"] for org in info.get("orgs", [])]logger.info("[Auth][PageLoad] user=%s orgs=%s", username, orgs)if SIZE_WHITELIST is not None:show_hw = username in SIZE_WHITELISTexcept Exception as e:logger.warning("[Auth][PageLoad] whoami failed: %s", e)user_label = f"👤 **{username}**" if username else "_(未登录)_"return (gr.update(visible=show_hw), # hw_col_quantgr.update(visible=show_hw), # hw_col_evalusername, # username_stategr.update(value=user_label), # current_user_quantgr.update(value=user_label), # current_user_eval)13 unmodified linesreturn "TRIGGER"def _check_auth_if_not_dup(dup_found: bool, oauth_token: gr.OAuthToken | None = None) -> str:"""Skip auth check if a duplicate was already detected (modal is shown instead)."""if dup_found:return "DUP"return _check_auth_for_submit(oauth_token)def _sync_username(oauth_token: gr.OAuthToken | None = None) -> str:"""Auth 通过后把用户名同步到 username_state。如果 token 不可用或调用失败,返回 gr.update() 保持现有值不变。"""if oauth_token is None or not oauth_token.token:return gr.update()try:info = whoami(token=oauth_token.token)return info.get("name", "")except Exception:return gr.update()def _pre_check_duplicate(model: str, queue_type: str):"""Check if *model* already exists in the queue for *queue_type* ('quant'|'eval').Returns (dup_found, modal_gr_update, message_text, accordion_elem_id)."""if not model or not model.strip():return False, gr.update(visible=False), "", ""model_clean = model.strip()if queue_type == "quant":dfs = get_evaluation_queue_df(GIT_STATUS_PATH, QUANT_COLS, request_type="quant", results_path=GIT_RESULTS_PATH)queue_label = "Quantization"acc_ids = ["accordion-finished-quant","accordion-running-quant","accordion-pending-quant","accordion-failed-quant",]else:dfs = get_evaluation_queue_df(GIT_STATUS_PATH, EVAL_COLS, request_type="eval", results_path=GIT_RESULTS_PATH)queue_label = "Evaluation"acc_ids = ["accordion-finished-eval","accordion-running-eval","accordion-pending-eval","accordion-failed-eval",]status_labels = ["Finished", "Running", "Pending", "Failed"]for status_label, df, acc_id in zip(status_labels, dfs, acc_ids):if df.empty or "model" not in df.columns:continuefor cell in df["model"]:# model 列存的是 HTML <a> 标签,剥离所有 HTML 后取纯文本plain = re.sub(r"<[^>]+>", "", str(cell)).strip()# 去掉末尾 📑 及多余空白,只保留第一个 token(即 org/model)plain = re.split(r"\s{2,}|📑", plain)[0].strip()if plain.lower() == model_clean.lower():msg = (f"### ⚠️ Model already in queue\n\n"f"**`{model_clean}`** is currently in the **{status_label} {queue_label}** queue.\n\n"f"Click **View in Queue** to scroll to it, or **Submit Anyway** to re-submit.")return True, gr.update(visible=True), msg, acc_idreturn False, gr.update(visible=False), "", ""def _pre_check_quant(model: str):return _pre_check_duplicate(model, "quant")def _pre_check_eval(model: str):return _pre_check_duplicate(model, "eval")def _inline_dup_check(model: str, queue_type: str):"""实时内联重复检测(用户输入时触发)。仅当 model 包含 '/' 时才查询,避免每次击键都读磁盘。返回 gr.update 用于更新输入框下方的警告条 Markdown。"""model = (model or "").strip()if not model or "/" not in model:return gr.update(visible=False, value="")dup_found, _, _, acc_id = _pre_check_duplicate(model, queue_type)if not dup_found:return gr.update(visible=False, value="")queue_label = "Quantization" if queue_type == "quant" else "Evaluation"status_map = {"accordion-finished-quant": "Finished","accordion-running-quant": "Running","accordion-pending-quant": "Pending","accordion-failed-quant": "Failed","accordion-finished-eval": "Finished","accordion-running-eval": "Running","accordion-pending-eval": "Pending","accordion-failed-eval": "Failed",}status_label = status_map.get(acc_id, "queue")msg = f"⚠️ **`{model}`** is already in the {queue_label} queue — status: **{status_label}**."return gr.update(visible=True, value=msg)def _inline_dup_check_quant(model: str):return _inline_dup_check(model, "quant")def _inline_dup_check_eval(model: str):return _inline_dup_check(model, "eval")def submit_model(signal, model, revision, private, compute_dtype, model_size_input, hardware_choice, gpu_count_choice, oauth_token: gr.OAuthToken | None = None):"""Wrapper that parses the optional model-size field and calls add_new_eval.1 unmodified linegiving the user real-time progress updates."""print(f"[DEBUG] submit_model called: signal={signal!r}, model={model!r}, oauth_token={oauth_token is not None}")if signal in ("TRIGGER", "DUP"):print(f"[DEBUG] submit_model => skipped ({signal})")yield ""return74 unmodified linesgiving the user real-time progress updates."""print(f"[DEBUG] submit_quant called: signal={signal!r}, model={model!r}, oauth_token={oauth_token is not None}")if signal in ("TRIGGER", "DUP"):print(f"[DEBUG] submit_quant => skipped ({signal})")yield ""return326 unmodified linesif col in filtered_df.columns and col not in final_cols:final_cols.append(col)avg_col = "Average"if avg_col in filtered_df.columns:filtered_df = filtered_df.sort_values(by=avg_col, ascending=False, na_position="last")else:filtered_df = filtered_df.sort_values(by=AUTO_PIPELINE_SORT_COL, ascending=False, na_position="last")filtered_df = prepare_auto_pipeline_display_df(filtered_df)return _add_row_numbers(filtered_df[final_cols])172 unmodified linesreturn token_map.get(prefix) or HF_TOKEN or ""def refresh_queue_tables(show_mine_quant=False, show_mine_eval=False, username=""):"""Re-read queue JSON files from disk and return updated DataFrames + accordion labels.Called by gr.Timer every 60 s and after each successful submission so thequeue tables and their counts stay current without requiring a full restart.When show_mine_quant/show_mine_eval is True and username is set, only rowssubmitted by that user are returned for the respective page."""def _filt(df, show_mine):if show_mine and username and "submitted_by" in df.columns:return df[df["submitted_by"] == username].reset_index(drop=True)return dfdef _quant_display(df):"""Drop submitted_by before sending to the quant table (hidden column)."""cols = [c for c in QUANT_DISPLAY_COLS if c in df.columns]return df[cols] if cols else dfdef _eval_display(df):"""Drop submitted_by before sending to the eval table (hidden column)."""cols = [c for c in EVAL_DISPLAY_COLS if c in df.columns]return df[cols] if cols else df(new_finished_eval, new_running_eval, new_pending_eval, new_failed_eval,) = get_evaluation_queue_df(GIT_STATUS_PATH, EVAL_COLS, request_type="eval", results_path=GIT_RESULTS_PATH)(new_finished_quant, new_running_quant, new_pending_quant, new_failed_quant,) = get_evaluation_queue_df(GIT_STATUS_PATH, QUANT_COLS, request_type="quant", results_path=GIT_RESULTS_PATH)fin_q = _filt(new_finished_quant, show_mine_quant)run_q = _filt(new_running_quant, show_mine_quant)pen_q = _filt(new_pending_quant, show_mine_quant)fail_q = _filt(new_failed_quant, show_mine_quant)fin_e = _filt(new_finished_eval, show_mine_eval)run_e = _filt(new_running_eval, show_mine_eval)pen_e = _filt(new_pending_eval, show_mine_eval)fail_e = _filt(new_failed_eval, show_mine_eval)return (_quant_display(fin_q),_quant_display(run_q),_quant_display(pen_q),_quant_display(fail_q),_eval_display(fin_e),_eval_display(run_e),_eval_display(pen_e),_eval_display(fail_e),gr.update(label=f"Finished Quantizations ({len(fin_q)})"),gr.update(label=f"Running Quantization Queue ({len(run_q)})"),gr.update(label=f"Pending Quantization Queue ({len(pen_q)})"),gr.update(label=f"Failed Quantizations ({len(fail_q)})"),gr.update(label=f"Finished Evaluations ({len(fin_e)})"),gr.update(label=f"Running Evaluation Queue ({len(run_e)})"),gr.update(label=f"Pending Evaluation Queue ({len(pen_e)})"),gr.update(label=f"Failed Evaluations ({len(fail_e)})"),)demo = gr.Blocks(fill_width=True)with demo:# Hidden login button (CSS hidden, triggered by JS when auth needed)3 unmodified linessignal_box = gr.Textbox(visible=False, elem_id="auth-signal-box")# Per-user session state (replaces global mutable variables)username_state = gr.State(value="")# ── Duplicate-warning modal: Auto Quant ──────────────────────────dup_state_quant = gr.State(False)dup_accordion_id_quant = gr.State("")with gr.Column(elem_classes="custom-modal", visible=False, elem_id="dup-modal-quant") as dup_modal_quant:with gr.Column(elem_classes="modal-content"):dup_msg_quant = gr.Markdown("", elem_id="dup-msg-quant")with gr.Row(elem_classes="dup-modal-buttons"):dup_dismiss_quant = gr.Button("Cancel", variant="secondary", elem_id="dup-dismiss-quant")dup_goto_quant = gr.Button("View in Queue ↓", variant="secondary", elem_id="dup-goto-quant")dup_confirm_quant = gr.Button("Submit Anyway", variant="primary", elem_id="dup-confirm-quant")# ── Duplicate-warning modal: Auto Eval ───────────────────────────dup_state_eval = gr.State(False)dup_accordion_id_eval = gr.State("")with gr.Column(elem_classes="custom-modal", visible=False, elem_id="dup-modal-eval") as dup_modal_eval:with gr.Column(elem_classes="modal-content"):dup_msg_eval = gr.Markdown("", elem_id="dup-msg-eval")with gr.Row(elem_classes="dup-modal-buttons"):dup_dismiss_eval = gr.Button("Cancel", variant="secondary", elem_id="dup-dismiss-eval")dup_goto_eval = gr.Button("View in Queue ↓", variant="secondary", elem_id="dup-goto-eval")dup_confirm_eval = gr.Button("Submit Anyway", variant="primary", elem_id="dup-confirm-eval")filter_state = gr.State({"weightDtype": list(_DEFAULT_WEIGHT_DTYPES),"computeDtype": list(_DEFAULT_COMPUTE_DTYPES),36 unmodified lines)with gr.Column(elem_classes="main-content"):# ── Page: Auto Pipeline Results ───────────────────────────────with gr.Column(visible=True, elem_id="page-pipeline-results") as page_pipeline_results:43 unmodified linesauto_pipeline_initial_cols.append(col)_avg_sort_col = "Average"_sorted_pipeline_df = (auto_pipeline_all_df.sort_values(by=_avg_sort_col, ascending=False, na_position="last")if _avg_sort_col in auto_pipeline_all_df.columnselse auto_pipeline_all_df.sort_values(by=AUTO_PIPELINE_SORT_COL, ascending=False, na_position="last"))auto_pipeline_display_df = prepare_auto_pipeline_display_df(_sorted_pipeline_df)auto_pipeline_table = gr.components.Dataframe(value=_add_row_numbers(auto_pipeline_display_df[auto_pipeline_initial_cols]),headers=[ROW_NUMBER_COL] + auto_pipeline_initial_cols,117 unmodified lineselem_classes=["submit-action-btn"],)submission_result = gr.Markdown()dup_inline_quant = gr.Markdown(visible=False,elem_id="dup-inline-quant",elem_classes=["dup-inline-warning"],)_quant_submit_evt = submit_button.click(_pre_check_quant,inputs=[model_name_textbox],outputs=[dup_state_quant, dup_modal_quant, dup_msg_quant, dup_accordion_id_quant],js="""(model) => {// Save tab + model name to sessionStorage before auth checkvar modelInput = document.querySelector('#model-input-quant input, #model-input-quant textarea');var modelVal = modelInput ? modelInput.value.trim() : (model || '');sessionStorage.setItem('pending_submit', JSON.stringify({tab: 'quant',model: modelVal}));return [modelVal];}""",).then(_check_auth_if_not_dup,inputs=[dup_state_quant],outputs=signal_box,).then(_sync_username,inputs=[],outputs=[username_state],).then(submit_quant,[21 unmodified lines) # revision_name_textbox is hidden, always "main"with gr.Column():with gr.Row(elem_classes=["filter-row"]):my_submissions_quant_cb = gr.Checkbox(label="Only show my submissions",value=False,interactive=True,elem_id="my-submissions-quant",)current_user_quant = gr.Markdown(visible=False, elem_id="current-user-quant")with gr.Accordion(f"Finished Quantizations ({len(finished_quant_queue_df)})",open=False, elem_id="accordion-finished-quant",) as accordion_finished_quant:finished_quant_table = gr.components.Dataframe(value=finished_quant_queue_df[QUANT_DISPLAY_COLS] if not finished_quant_queue_df.empty else finished_quant_queue_df,headers=QUANT_DISPLAY_COLS,datatype=QUANT_DISPLAY_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(QUANT_DISPLAY_COLS) - 2),)with gr.Accordion(f"Running Quantization Queue ({len(running_quant_queue_df)})",open=False, elem_id="accordion-running-quant",) as accordion_running_quant:running_quant_table = gr.components.Dataframe(value=running_quant_queue_df[QUANT_DISPLAY_COLS] if not running_quant_queue_df.empty else running_quant_queue_df,headers=QUANT_DISPLAY_COLS,datatype=QUANT_DISPLAY_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(QUANT_DISPLAY_COLS) - 2),)with gr.Accordion(f"Pending Quantization Queue ({len(pending_quant_queue_df)})",open=False, elem_id="accordion-pending-quant",) as accordion_pending_quant:pending_quant_table = gr.components.Dataframe(value=pending_quant_queue_df[QUANT_DISPLAY_COLS] if not pending_quant_queue_df.empty else pending_quant_queue_df,headers=QUANT_DISPLAY_COLS,datatype=QUANT_DISPLAY_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(QUANT_DISPLAY_COLS) - 2),)with gr.Accordion(f"Failed Quantizations ({len(failed_quant_queue_df)})",open=False, elem_id="accordion-failed-quant",) as accordion_failed_quant:failed_quant_table = gr.components.Dataframe(value=failed_quant_queue_df[QUANT_DISPLAY_COLS] if not failed_quant_queue_df.empty else failed_quant_queue_df,headers=QUANT_DISPLAY_COLS,datatype=QUANT_DISPLAY_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(QUANT_DISPLAY_COLS) - 2),)# ── Page: Auto Eval ──────────────────────────────────────────58 unmodified lineselem_classes=["submit-action-btn"],)submission_result_auto_eval = gr.Markdown()dup_inline_eval = gr.Markdown(visible=False,elem_id="dup-inline-eval",elem_classes=["dup-inline-warning"],)_eval_submit_evt = submit_button_auto_eval.click(_pre_check_eval,inputs=[model_name_textbox_auto_eval],outputs=[dup_state_eval, dup_modal_eval, dup_msg_eval, dup_accordion_id_eval],js="""(model) => {// Save tab + model name to sessionStorage before auth checkvar modelInput = document.querySelector('#model-input-eval input, #model-input-eval textarea');var modelVal = modelInput ? modelInput.value.trim() : (model || '');sessionStorage.setItem('pending_submit', JSON.stringify({tab: 'eval',model: modelVal}));return [modelVal];}""",).then(_check_auth_if_not_dup,inputs=[dup_state_eval],outputs=signal_box,).then(_sync_username,inputs=[],outputs=[username_state],).then(submit_model,[21 unmodified lines)with gr.Column():with gr.Row(elem_classes=["filter-row"]):my_submissions_eval_cb = gr.Checkbox(label="Only show my submissions",value=False,interactive=True,elem_id="my-submissions-eval",)current_user_eval = gr.Markdown(visible=False, elem_id="current-user-eval")with gr.Accordion(f"Finished Evaluations ({len(finished_eval_queue_df)})",open=False, elem_id="accordion-finished-eval",) as accordion_finished_eval:finished_eval_table_auto_eval = gr.components.Dataframe(value=finished_eval_queue_df[EVAL_DISPLAY_COLS] if not finished_eval_queue_df.empty else finished_eval_queue_df,headers=EVAL_DISPLAY_COLS,datatype=EVAL_DISPLAY_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(EVAL_DISPLAY_COLS) - 2),)with gr.Accordion(f"Running Evaluation Queue ({len(running_eval_queue_df)})",open=False, elem_id="accordion-running-eval",) as accordion_running_eval:running_eval_table_auto_eval = gr.components.Dataframe(value=running_eval_queue_df[EVAL_DISPLAY_COLS] if not running_eval_queue_df.empty else running_eval_queue_df,headers=EVAL_DISPLAY_COLS,datatype=EVAL_DISPLAY_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(EVAL_DISPLAY_COLS) - 2),)with gr.Accordion(f"Pending Evaluation Queue ({len(pending_eval_queue_df)})",open=False, elem_id="accordion-pending-eval",) as accordion_pending_eval:pending_eval_table_auto_eval = gr.components.Dataframe(value=pending_eval_queue_df[EVAL_DISPLAY_COLS] if not pending_eval_queue_df.empty else pending_eval_queue_df,headers=EVAL_DISPLAY_COLS,datatype=EVAL_DISPLAY_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(EVAL_DISPLAY_COLS) - 2),)with gr.Accordion(f"Failed Evaluations ({len(failed_eval_queue_df)})",open=False, elem_id="accordion-failed-eval",) as accordion_failed_eval:failed_eval_table_auto_eval = gr.components.Dataframe(value=failed_eval_queue_df[EVAL_DISPLAY_COLS] if not failed_eval_queue_df.empty else failed_eval_queue_df,headers=EVAL_DISPLAY_COLS,datatype=EVAL_DISPLAY_TYPES,row_count=5,column_widths=["40%", "20%"] + ["auto"] * (len(EVAL_DISPLAY_COLS) - 2),)# ── Page: Metrics ────────────────────────────────────────────114 unmodified lines# ── Sidebar → page switching (handled entirely in client-side JS) ──# Log user info on page load; show hardware dropdown for whitelisted users_USER_OUTPUTS = [hw_col_quant, hw_col_eval, username_state, current_user_quant, current_user_eval]demo.load(fn=_process_user_on_load,inputs=None,outputs=_USER_OUTPUTS,)# ── Refresh queues immediately after a successful submission ────_REFRESH_OUTPUTS = [finished_quant_table, running_quant_table, pending_quant_table, failed_quant_table,finished_eval_table_auto_eval, running_eval_table_auto_eval,pending_eval_table_auto_eval, failed_eval_table_auto_eval,accordion_finished_quant, accordion_running_quant,accordion_pending_quant, accordion_failed_quant,accordion_finished_eval, accordion_running_eval,accordion_pending_eval, accordion_failed_eval,]_REFRESH_INPUTS = [my_submissions_quant_cb, my_submissions_eval_cb, username_state]_quant_submit_evt.then(fn=refresh_queue_tables, inputs=_REFRESH_INPUTS, outputs=_REFRESH_OUTPUTS)_eval_submit_evt.then(fn=refresh_queue_tables, inputs=_REFRESH_INPUTS, outputs=_REFRESH_OUTPUTS)# ── Duplicate-warning modal button handlers ──────────────────────# Quant: Canceldup_dismiss_quant.click(fn=lambda: gr.update(visible=False),inputs=[],outputs=[dup_modal_quant],)# Quant: View in Queue (close modal + scroll to the relevant accordion)dup_goto_quant.click(fn=lambda acc_id: gr.update(visible=False),inputs=[dup_accordion_id_quant],outputs=[dup_modal_quant],js="""(acc_id) => {setTimeout(() => {if (acc_id) {var el = document.getElementById(acc_id);if (el) {el.scrollIntoView({behavior: 'smooth', block: 'start'});var openBtn = el.querySelector('button[aria-expanded="false"]');if (openBtn) openBtn.click();}}}, 200);return [acc_id];}""",)# Quant: Submit Anyway (close modal then run normal auth + submit chain)_quant_confirm_evt = dup_confirm_quant.click(fn=lambda: gr.update(visible=False),inputs=[],outputs=[dup_modal_quant],js="""() => {var modelInput = document.querySelector('#model-input-quant input, #model-input-quant textarea');var modelVal = modelInput ? modelInput.value.trim() : '';sessionStorage.setItem('pending_submit', JSON.stringify({tab: 'quant', model: modelVal}));return [];}""",).then(_check_auth_for_submit,inputs=[],outputs=signal_box,).then(submit_quant,[signal_box, model_name_textbox, revision_name_textbox, private,compute_type, model_size_input, hw_dropdown_quant, gpu_count_quant],submission_result,js="""(signal, model, revision, priv, scheme, size, hw, cnt) => {if (signal !== 'TRIGGER') sessionStorage.removeItem('pending_submit');if (!model || model.trim() === '') {var input = document.querySelector('#model-input-quant input, #model-input-quant textarea');if (input && input.value.trim()) model = input.value.trim();}return [signal, model, revision, priv, scheme, size, hw, cnt];}""",)_quant_confirm_evt.then(fn=refresh_queue_tables, inputs=_REFRESH_INPUTS, outputs=_REFRESH_OUTPUTS)# Eval: Canceldup_dismiss_eval.click(fn=lambda: gr.update(visible=False),inputs=[],outputs=[dup_modal_eval],)# Eval: View in Queuedup_goto_eval.click(fn=lambda acc_id: gr.update(visible=False),inputs=[dup_accordion_id_eval],outputs=[dup_modal_eval],js="""(acc_id) => {setTimeout(() => {if (acc_id) {var el = document.getElementById(acc_id);if (el) {el.scrollIntoView({behavior: 'smooth', block: 'start'});var openBtn = el.querySelector('button[aria-expanded="false"]');if (openBtn) openBtn.click();}}}, 200);return [acc_id];}""",)# Eval: Submit Anyway_eval_confirm_evt = dup_confirm_eval.click(fn=lambda: gr.update(visible=False),inputs=[],outputs=[dup_modal_eval],js="""() => {var modelInput = document.querySelector('#model-input-eval input, #model-input-eval textarea');var modelVal = modelInput ? modelInput.value.trim() : '';sessionStorage.setItem('pending_submit', JSON.stringify({tab: 'eval', model: modelVal}));return [];}""",).then(_check_auth_for_submit,inputs=[],outputs=signal_box,).then(submit_model,[signal_box, model_name_textbox_auto_eval, revision_name_textbox_auto_eval, private_auto_eval,compute_type_auto_eval, model_size_input_auto_eval, hw_dropdown_eval, gpu_count_eval],submission_result_auto_eval,js="""(signal, model, revision, priv, compute, size, hw, cnt) => {if (signal !== 'TRIGGER') sessionStorage.removeItem('pending_submit');if (!model || model.trim() === '') {var input = document.querySelector('#model-input-eval input, #model-input-eval textarea');if (input && input.value.trim()) model = input.value.trim();}return [signal, model, revision, priv, compute, size, hw, cnt];}""",)_eval_confirm_evt.then(fn=refresh_queue_tables, inputs=_REFRESH_INPUTS, outputs=_REFRESH_OUTPUTS)# Checkbox filters — instantly re-filter the queue tablesmy_submissions_quant_cb.change(fn=refresh_queue_tables,inputs=_REFRESH_INPUTS,outputs=_REFRESH_OUTPUTS,)my_submissions_eval_cb.change(fn=refresh_queue_tables,inputs=_REFRESH_INPUTS,outputs=_REFRESH_OUTPUTS,)# ── 实时内联重复检测:用户输入 model 名称时即时提示 ──────────────model_name_textbox.change(fn=_inline_dup_check_quant,inputs=[model_name_textbox],outputs=[dup_inline_quant],)model_name_textbox_auto_eval.change(fn=_inline_dup_check_eval,inputs=[model_name_textbox_auto_eval],outputs=[dup_inline_eval],)# When signal_box changes to "TRIGGER", redirect to OAuth login14 unmodified lines}""",)# ── Live queue refresh (every 60 s, transparent to the user) ─────────_queue_timer = gr.Timer(value=60)_queue_timer.tick(fn=refresh_queue_tables,inputs=_REFRESH_INPUTS,outputs=_REFRESH_OUTPUTS,)# Load Lucide icons + sidebar branding + page switching_SIDEBAR_HEAD = """<style>44 unmodified lines<script>(function() {var BRAND_LOGO = "https://imgur.com/cu4lW7q.png";var PAGE_IDS = ['pipeline-results', 'quant', 'eval', 'metrics', 'about', 'faq'];var HERO_COPY = {'pipeline-results': {title: 'Leaderboard',subtitle: 'AI-driven quantization and evaluation — autonomous low-bit compression and benchmarking of open-source LLMs',
313 unmodified lines314315316317318319313 unmodified lineswidth: 100% !important;}.modal-content .gradio-dataframe {height: auto !important;min-height: 50px !important;313 unmodified lines314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359313 unmodified lineswidth: 100% !important;}/* ── Duplicate-warning modal ───────────────────────────────────── */#dup-modal-quant .modal-content,#dup-modal-eval .modal-content {max-width: 560px !important;min-height: unset !important;padding: 36px 40px !important;text-align: left !important;}.dup-modal-buttons {margin-top: 20px !important;display: flex !important;gap: 10px !important;justify-content: flex-end !important;}/* ── 内联实时重复警告条 ─────────────────────────────────────────── */.dup-inline-warning {background: #fff8e1 !important;border-left: 4px solid #f59e0b !important;border-radius: 6px !important;padding: 10px 14px !important;margin-top: 6px !important;font-size: 0.92em !important;color: #92400e !important;}/* ── 过滤行:checkbox + 当前用户标签 ───────────────────────────── */.filter-row {align-items: center !important;gap: 16px !important;flex-wrap: nowrap !important;}.current-user-label {font-size: 0.88em !important;color: #6b7280 !important;margin: 0 !important;padding: 0 !important;white-space: nowrap !important;}.modal-content .gradio-dataframe {height: auto !important;min-height: 50px !important;
62 unmodified lines6364656667686962 unmodified linesdef styled_progress(step: int, total: int, message: str) -> str:"""Return a styled progress indicator (HTML)."""pct = int(step / total * 100) if total > 0 else 0# Dots indicator: filled for completed steps, hollow for remainingdots = "".join("<span style='display:inline-block;width:10px;height:10px;border-radius:50%;"62 unmodified lines6364656667686962 unmodified linesdef styled_progress(step: int, total: int, message: str) -> str:"""Return a styled progress indicator (HTML)."""pct = min(int(step / total * 100) if total > 0 else 0, 95)# Dots indicator: filled for completed steps, hollow for remainingdots = "".join("<span style='display:inline-block;width:10px;height:10px;border-radius:50%;"
135 unmodified lines1361371381391401417 unmodified lines149150151152153154186 unmodified lines341342343344345346135 unmodified linesweight_type = ColumnContent("weight_type", "str", False)status = ColumnContent("status", "str", True)eta = ColumnContent("eta", "str", True)eval_queue_cols = EvalQueueColumn()7 unmodified linesinput_dtype = ColumnContent("input_dtype", "str", True)status = ColumnContent("status", "str", True)eta = ColumnContent("eta", "str", True)quant_queue_cols = QuantQueueColumn()186 unmodified linesQUANT_COLS = [c.name for c in fields(QuantQueueColumn)]QUANT_TYPES = [c.type for c in fields(QuantQueueColumn)]BENCHMARK_COLS = [t.value.col_name for t in Tasks]NUMERIC_INTERVALS = {135 unmodified lines1361371381391401411427 unmodified lines150151152153154155156186 unmodified lines343344345346347348349350351352353354135 unmodified linesweight_type = ColumnContent("weight_type", "str", False)status = ColumnContent("status", "str", True)eta = ColumnContent("eta", "str", True)submitted_by = ColumnContent("submitted_by", "str", True)eval_queue_cols = EvalQueueColumn()7 unmodified linesinput_dtype = ColumnContent("input_dtype", "str", True)status = ColumnContent("status", "str", True)eta = ColumnContent("eta", "str", True)submitted_by = ColumnContent("submitted_by", "str", True)quant_queue_cols = QuantQueueColumn()186 unmodified linesQUANT_COLS = [c.name for c in fields(QuantQueueColumn)]QUANT_TYPES = [c.type for c in fields(QuantQueueColumn)]# Display-only column lists (submitted_by kept internally for filtering but hidden in UI)QUANT_DISPLAY_COLS = [c for c in QUANT_COLS if c != "submitted_by"]QUANT_DISPLAY_TYPES = [t for c, t in zip(QUANT_COLS, QUANT_TYPES) if c != "submitted_by"]EVAL_DISPLAY_COLS = [c for c in EVAL_COLS if c != "submitted_by"]EVAL_DISPLAY_TYPES = [t for c, t in zip(EVAL_COLS, EVAL_TYPES) if c != "submitted_by"]BENCHMARK_COLS = [t.value.col_name for t in Tasks]NUMERIC_INTERVALS = {
246 unmodified lines247248249250251252253254255256257258259260261262263264246 unmodified linesdef _build_queue_dfs(pending: list, running: list, finished: list, failed: list,cols: list) -> tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame]:"""Build DataFrames from split lists, keeping only the requested *cols*."""all_records = pending + running + finished + failedif all_records:existing_cols = [c for c in cols if c in all_records[0]]else:existing_cols = colsdf_finished = pd.DataFrame.from_records(finished, columns=existing_cols)df_running = pd.DataFrame.from_records(running, columns=existing_cols)df_pending = pd.DataFrame.from_records(pending, columns=existing_cols)df_failed = pd.DataFrame.from_records(failed, columns=existing_cols)return df_finished[existing_cols], df_running[existing_cols], df_pending[existing_cols], df_failed[existing_cols]def _inject_eta(pending: list[dict], running: list[dict], concurrency: int = 2):246 unmodified lines247248249250251252253254255256257258259260261262263264265266267268269270271272273274246 unmodified linesdef _build_queue_dfs(pending: list, running: list, finished: list, failed: list,cols: list) -> tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame]:"""Build DataFrames from split lists, keeping only the requested *cols*."""# Determine which requested cols actually exist across ALL records so we# never drop a column just because the first entry happens to be old/missing it.all_records = pending + running + finished + failedif all_records:present_keys: set[str] = set()for rec in all_records:present_keys.update(rec.keys())existing_cols = [c for c in cols if c in present_keys]else:existing_cols = colsdef _to_df(records):if not records:return pd.DataFrame(columns=existing_cols)return pd.DataFrame.from_records(records, columns=existing_cols)df_finished = _to_df(finished)df_running = _to_df(running)df_pending = _to_df(pending)df_failed = _to_df(failed)return df_finished, df_running, df_pending, df_faileddef _inject_eta(pending: list[dict], running: list[dict], concurrency: int = 2):
app.py+494-293
src/display/css_html_js.py+40
src/display/formatting.py+1-1
src/display/utils.py+8
src/populate.py+16-6