Spaces:
Runtime error
Runtime error
Commit ·
61885ca
1
Parent(s): 7d20cd0
udpate submit mechanism
Browse filesFiles changed (5)
- app.py+18-12
- src/display/utils.py+14-14
- src/leaderboard/read_evals.py+1-1
- src/populate.py+1-1
- src/submission/submit.py+26-12
153 unmodified lines15415515615715815916016116216316416516616716813 unmodified lines182183184185186187188189190191192193194195196197198153 unmodified lineswith gr.Row():with gr.Column():submitter_textbox = gr.Textbox(label="Submitter Name")# revision_name_textbox = gr.Textbox(label="Revision commit", placeholder="main")# model_type = gr.Dropdown(# choices=[t.to_str(" : ") for t in ModelType if t != ModelType.Unknown],# label="Model type",# multiselect=False,# value=None,# interactive=True,# )# with gr.Column():submission_file = gr.File(label="JSONL solutions file", file_types=[".jsonl"])13 unmodified lines# )# base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)")logger.info("Submut button")submit_button = gr.Button("Submit")submission_result = gr.Markdown()def add_solution_cbk(submitter, submission_path):return add_new_solutions(lbdb, submitter, submission_path)submit_button.click(add_solution_cbk,[submitter_textbox,submission_file,],submission_result,153 unmodified lines15415515615715815916016116216316416516616716816917013 unmodified lines184185186187188189190191192193194195196197198199200201202203204153 unmodified lineswith gr.Row():with gr.Column():system_name_textbox = gr.Textbox(label=AutoEvalColumn.system.name)org_textbox = gr.Textbox(label=AutoEvalColumn.organization.name)# revision_name_textbox = gr.Textbox(label="Revision commit", placeholder="main")sys_type_dropdown = gr.Dropdown(choices=[t.to_str(" : ") for t in ModelType],label=AutoEvalColumn.system_type.name,multiselect=False,value=ModelType.LLM.to_str(" : "),interactive=True,)# with gr.Column():submission_file = gr.File(label="JSONL solutions file", file_types=[".jsonl"])13 unmodified lines# )# base_model_name_textbox = gr.Textbox(label="Base model (for delta or adapter weights)")logger.info("Submit button")submit_button = gr.Button("Submit")submission_result = gr.Markdown()def add_solution_cbk(system_name,org,sys_type, submission_path):return add_new_solutions(lbdb, system_name, org, sys_type, submission_path)submit_button.click(add_solution_cbk,[system_name_textbox,org_textbox,sys_type_dropdown,submission_file,],submission_result,
85 unmodified lines868788899091929394959697989910010110210310410510610710810911011185 unmodified linesclass ModelType(Enum):PT = ModelDetails(name="pretrained", symbol="🟢")FT = ModelDetails(name="fine-tuned", symbol="🔶")IFT = ModelDetails(name="instruction-tuned", symbol="⭕")RL = ModelDetails(name="RL-tuned", symbol="🟦")Unknown = ModelDetails(name="", symbol="?")def to_str(self, separator=" "):return f"{self.value.symbol}{separator}{self.value.name}"@staticmethoddef from_str(type):if "fine-tuned" in type or "🔶" in type:return ModelType.FTif "pretrained" in type or "🟢" in type:return ModelType.PTif "RL-tuned" in type or "🟦" in type:return ModelType.RLif "instruction-tuned" in type or "⭕" in type:return ModelType.IFTreturn ModelType.Unknownclass WeightType(Enum):85 unmodified lines868788899091929394959697989910010110210310410510610710810911011185 unmodified linesclass ModelType(Enum):LLM = ModelDetails(name="LLM", symbol="🟢")AgenticLLM = ModelDetails(name="AgenticLLM", symbol="🔶")# IFT = ModelDetails(name="instruction-tuned", symbol="⭕")# RL = ModelDetails(name="RL-tuned", symbol="🟦")Other = ModelDetails(name="Other", symbol="?")def to_str(self, separator=" "):return f"{self.value.symbol}{separator}{self.value.name}"@staticmethoddef from_str(type):if "AgenticLLM" in type or "🔶" in type:return ModelType.AgenticLLMif "LLM" in type or "🟢" in type:return ModelType.LLM# if "RL-tuned" in type or "🟦" in type:# return ModelType.RL# if "instruction-tuned" in type or "⭕" in type:# return ModelType.IFTreturn ModelType.Otherclass WeightType(Enum):
22 unmodified lines2324252627282922 unmodified linesrevision: str # commit hash, "" if mainresults: dictprecision: Precision = Precision.Unknownmodel_type: ModelType = ModelType.Unknown # Pretrained, fine tuned, ...weight_type: WeightType = WeightType.Original # Original or Adapterarchitecture: str = "Unknown"license: str = "?"22 unmodified lines2324252627282922 unmodified linesrevision: str # commit hash, "" if mainresults: dictprecision: Precision = Precision.Unknownmodel_type: ModelType = ModelType.LLM # Pretrained, fine tuned, ...weight_type: WeightType = WeightType.Original # Original or Adapterarchitecture: str = "Unknown"license: str = "?"
13 unmodified lines1415161718192013 unmodified linesall_data_json = [v.to_dict() for v in raw_data]df = pd.DataFrame.from_records(all_data_json)df = df.sort_values(by=[AutoEvalColumn.average.name], ascending=False)df = df[cols].round(decimals=2)# filter out if any of the benchmarks have not been produced13 unmodified lines1415161718192013 unmodified linesall_data_json = [v.to_dict() for v in raw_data]df = pd.DataFrame.from_records(all_data_json)df = df.sort_values(by=[AutoEvalColumn.success_rate.name], ascending=False)df = df[cols].round(decimals=2)# filter out if any of the benchmarks have not been produced
7 unmodified lines89101112137 unmodified lines21222324252627289 unmodified lines383940414243444546474849505152535455565758596061626364656667686970717273747 unmodified linesfrom src.datamodel.data import F1Datafrom src.display.formatting import styled_error, styled_message, styled_warningfrom src.envs import API, SUBMISSIONS_REPO, TOKENfrom src.logger import get_logger# from src.submission.check_validity import (7 unmodified linesdef validate_submission(lbdb: F1Data, pd_ds: pd.DataFrame) -> str | None:logger.info("Validating DS size %d columns %s set %s", len(pd_ds), pd_ds.columns, set(pd_ds.columns))if set(pd_ds.columns) != set(["formula_name", "solution"]):return "Bad format of submission"if any(type(v) != str for v in pd_ds["formula_name"]):return "Not all formula_name values are of type str"if any(type(v) != str for v in pd_ds["solution"]):9 unmodified linesdef add_new_solutions(lbdb: F1Data,submitter: str,submission_path: str,):logger.info("ADD SUBMISSION! submitter %s path %s", submitter, submission_path)if not submitter:return styled_error("Please fill submitter name")if not submission_path:return styled_error("Please upload JSONL solutions file")try:pd_ds = pd.read_json(submission_path, lines=True)except Exception as e:return styled_error(f"Cannot read uploaded JSONL file: {str(e)}")validation_error = validate_submission(lbdb, pd_ds)if validation_error:return styled_error(validation_error)submission_id = datetime.now().strftime("%Y%m%d%H%M%S")# Seems good, creating the evalprint(f"Adding new submission {submission_id} from {submitter}")submission_ts = time.time_ns()def add_info(row):row["submitter"] = submitterrow["submission_id"] = submission_idrow["submission_ts"] = submission_tsds = Dataset.from_pandas(pd_ds).map(add_info)ds.push_to_hub(SUBMISSIONS_REPO, submission_id, private=True)# print("Creating eval file")7 unmodified lines8910111213147 unmodified lines2223242526272829309 unmodified lines404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687887 unmodified linesfrom src.datamodel.data import F1Datafrom src.display.formatting import styled_error, styled_message, styled_warningfrom src.display.utils import ModelTypefrom src.envs import API, SUBMISSIONS_REPO, TOKENfrom src.logger import get_logger# from src.submission.check_validity import (7 unmodified linesdef validate_submission(lbdb: F1Data, pd_ds: pd.DataFrame) -> str | None:logger.info("Validating DS size %d columns %s set %s", len(pd_ds), pd_ds.columns, set(pd_ds.columns))expected_cols = ["formula_name", "solution"]if set(pd_ds.columns) != set(expected_cols):return f"Expected attributes: {expected_cols}, Got: {pd_ds.columns.tolist()}"if any(type(v) != str for v in pd_ds["formula_name"]):return "Not all formula_name values are of type str"if any(type(v) != str for v in pd_ds["solution"]):9 unmodified linesdef add_new_solutions(lbdb: F1Data,system_name : str,org: str,sys_type: str,submission_path: str,):logger.info("ADD SUBMISSION! %s path %s", str((system_name, org, sys_type)), submission_path)if not system_name:return styled_error("Please fill system name")if not org:return styled_error("Please fill organization name")if not sys_type:return styled_error("Please select system type")sys_type = ModelType.from_str(sys_type).nameif not submission_path:return styled_error("Please upload JSONL solutions file")try:submission_df = pd.read_json(submission_path, lines=True)except Exception as e:return styled_error(f"Cannot read uploaded JSONL file: {str(e)}")validation_error = validate_submission(lbdb, submission_df)if validation_error:return styled_error(validation_error)submission_id = f"{system_name}_{org}_{sys_type}_{datetime.now(timezone.utc).strftime('%Y%m%d_%H%M%S')}"# Seems good, creating the evalprint(f"Adding new submission: {submission_id}")submission_ts = time.time_ns()def add_info(row):row["system_name"] = system_namerow["organization"] = orgrow["system_type"] = sys_typerow["submission_id"] = submission_idrow["submission_ts"] = submission_tsds = Dataset.from_pandas(submission_df).map(add_info)ds.push_to_hub(SUBMISSIONS_REPO, submission_id, private=True)# print("Creating eval file")
app.py+18-12
src/display/utils.py+14-14
src/leaderboard/read_evals.py+1-1
src/populate.py+1-1
src/submission/submit.py+26-12