Spaces:
Runtime error
Runtime error
fix about and submit
Browse filesFiles changed (4)
- .DS_Store
- app.py+47-58
- src/about.py+8-1
- src/display/utils.py+15-21
30 unmodified lines3132333435363738394041424344454647484950515253545556575859606162636465346768693536377138394041424344454674757677784748808182495051525354555657585960616263646566676885868788899091929394697071727374757677787980812 unmodified lines8485861031048788899091108929394959697989910011210110210310430 unmodified lines
def submit_model_request(model_id: str, contact: str = "") -> str: """Submit a model evaluation request""" if not model_id or not model_id.strip(): return "❌ Please provide a model ID" model_id = model_id.strip() # Validate format (should have provider/model) if "/" not in model_id: return "❌ Model ID must include provider (e.g., `anthropic/claude-3-opus`)" provider, model_name = model_id.split("/", 1) # Check if already exists request_filename = f"{model_id.replace('/', '_')}_eval_request_False_float16_Original.json" # Create request object request_data = { "model": model_id, "provider": provider, "base_model": "", "revision": "main", "precision": "float16", "weight_type": "Original", "status": "PENDING", "submitted_time": datetime.now().isoformat() + "Z", "submitted_by": contact if contact else "anonymous", "model_type": "pretrained", "likes": 0, "params": 0, "license": "?", "private": False, } try: # Save to requests path provider_dir = os.path.join(EVAL_REQUESTS_PATH, provider) os.makedirs(provider_dir, exist_ok=True) if not model_id or not model_id.strip(): return "❌ Please provide a model ID" request_path = os.path.join(provider_dir, request_filename) model_id = model_id.strip() # Validate format (should have provider/model) if "/" not in model_id: return "❌ Model ID must include provider (e.g., `anthropic/claude-3-opus`)" provider, model_name = model_id.split("/", 1) # Check if already exists if os.path.exists(request_path): with open(request_path, 'r') as f: existing = json.load(f) if existing.get("status") in ["FINISHED", "RUNNING"]: return f"❌ Model `{model_id}` is already {existing['status'].lower()}" request_filename = f"{model_id.replace('/', '_')}_eval_request_False_float16_Original.json" # Write request file with open(request_path, 'w') as f: json.dump(request_data, f, indent=2) # Create request object request_data = { "model": model_id, "provider": provider, "base_model": "", "revision": "main", "precision": "float16", "weight_type": "Original", "status": "PENDING", "submitted_time": datetime.now().isoformat() + "Z", "submitted_by": contact if contact else "anonymous", "model_type": "pretrained", "likes": 0, "params": 0, "license": "?", "private": False, } # Try to push to HF (if token available) if TOKEN: try: hf_api = HfApi(token=TOKEN) hf_api.upload_file( path_or_fileobj=request_path, path_in_repo=f"{provider}/{request_filename}", repo_id=QUEUE_REPO, repo_type="dataset", commit_message=f"Add evaluation request for {model_id}" ) return f"""✅ **Request submitted successfully!** try: hf_api = HfApi(token=TOKEN) hf_api.upload_file( path_or_fileobj=json.dumps(request_data, indent=2).encode(), path_in_repo=f"{provider}/{request_filename}", repo_id=QUEUE_REPO, repo_type="dataset", commit_message=f"Add evaluation request for {model_id}" ) return f"""✅ **Request submitted successfully!**
**Model:** `{model_id}` **Provider:** {provider} 2 unmodified linesWe'll run the benchmark and update the leaderboard within a few days.{f"We'll contact you at: {contact}" if contact else ""}""" except Exception as e: return f"""⚠️ **Request saved locally but failed to upload to HuggingFace** except Exception as e: return f"""❌ **Failed to submit request**
Error: {str(e)}
The request has been saved but needs manual upload. Please contact the maintainers.Please try again or contact the maintainers directly.""" else: return """❌ **Submission not configured** The leaderboard is not configured to accept submissions yet. Please contact the maintainers directly to request a model evaluation.""" except Exception as e: return f"❌ Failed to submit request: {str(e)}" return f"❌ Failed to process request: {str(e)}"
### Space initialisationtry:42 unmodified lines434445464647484938 unmodified lines888990919293949596979842 unmodified lines"""
# Which evaluations are you running? how can people reproduce what you have?LLM_BENCHMARKS_TEXT = f"""LLM_BENCHMARKS_TEXT = """## How it works
Models are prompted with ASCII maze representations and must output a sequence of directional moves (N, S, E, W) to navigate from Start (S) to End (E).38 unmodified lines
CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results"CITATION_BUTTON_TEXT = r"""@misc{pathfinding-benchmark-2025, title={Pathfinding Benchmark: Evaluating LLMs on ASCII Maze Navigation}, author={Fallom AI}, year={2025}, url={https://huggingface.co/spaces/Fallomai/pathfinding-leaderboard}, note={90 maze problems of varying complexity (5x5 to 20x20) generated using Prim's, Recursive Backtracker, and Cellular Automata algorithms}}"""11 unmodified lines12131415151617182 unmodified lines2122232425262728293031323334353637383940414243242526272829303132333435363738394011 unmodified lines# These classes are for user facing column names,# to avoid having to change them all around the code# when a modif is needed@dataclass@dataclass(frozen=True)class ColumnContent: name: str type: str2 unmodified lines never_hidden: bool = False
## Leaderboard columnsauto_eval_column_dict = []# Initauto_eval_column_dict.append(["model_type_symbol", ColumnContent, ColumnContent("T", "str", True, never_hidden=True)])auto_eval_column_dict.append(["model", ColumnContent, ColumnContent("Model", "markdown", True, never_hidden=True)])auto_eval_column_dict.append(["provider", ColumnContent, ColumnContent("Provider", "str", True)])# Main metricsauto_eval_column_dict.append(["completion_rate", ColumnContent, ColumnContent(Tasks.completion_rate.value.col_name, "number", True)])auto_eval_column_dict.append(["accuracy", ColumnContent, ColumnContent(Tasks.accuracy.value.col_name, "number", True)])auto_eval_column_dict.append(["avg_duration", ColumnContent, ColumnContent(Tasks.avg_duration.value.col_name, "number", True)])auto_eval_column_dict.append(["avg_tokens", ColumnContent, ColumnContent(Tasks.avg_tokens.value.col_name, "number", True)])auto_eval_column_dict.append(["total_cost", ColumnContent, ColumnContent(Tasks.total_cost.value.col_name, "number", True)])# Optional metricsauto_eval_column_dict.append(["optimal_rate", ColumnContent, ColumnContent(Tasks.optimal_rate.value.col_name, "number", False)])# Model informationauto_eval_column_dict.append(["model_type", ColumnContent, ColumnContent("Type", "str", False)])auto_eval_column_dict.append(["precision", ColumnContent, ColumnContent("Precision", "str", False)])auto_eval_column_dict.append(["revision", ColumnContent, ColumnContent("Model sha", "str", False, True)])
# We use make dataclass to dynamically fill the scores from TasksAutoEvalColumn = make_dataclass("AutoEvalColumn", auto_eval_column_dict, frozen=True)@dataclass(frozen=True)class AutoEvalColumn: model_type_symbol: ColumnContent = ColumnContent("T", "str", True, never_hidden=True) model: ColumnContent = ColumnContent("Model", "markdown", True, never_hidden=True) provider: ColumnContent = ColumnContent("Provider", "str", True) completion_rate: ColumnContent = ColumnContent(Tasks.completion_rate.value.col_name, "number", True) accuracy: ColumnContent = ColumnContent(Tasks.accuracy.value.col_name, "number", True) avg_duration: ColumnContent = ColumnContent(Tasks.avg_duration.value.col_name, "number", True) avg_tokens: ColumnContent = ColumnContent(Tasks.avg_tokens.value.col_name, "number", True) total_cost: ColumnContent = ColumnContent(Tasks.total_cost.value.col_name, "number", True) optimal_rate: ColumnContent = ColumnContent(Tasks.optimal_rate.value.col_name, "number", False) model_type: ColumnContent = ColumnContent("Type", "str", False) precision: ColumnContent = ColumnContent("Precision", "str", False) revision: ColumnContent = ColumnContent("Model sha", "str", False, True)
## For the queue columns in the submission tab@dataclass(frozen=True).DS_Store
app.py+47-58
src/about.py+8-1
src/display/utils.py+15-21