Spaces:
Runtime error
Runtime error
Add cross-linking of QA models
Browse files66 unmodified lines67686970717230 unmodified lines103104105106107108109235 unmodified lines34534634734834935035135266 unmodified lines# in the same environment. Refactor to avoid needing to actually load# the metric.try:metric_func = load(metric)except Exception as e:print(e)30 unmodified linesWelcome to Hugging Face's automatic model evaluator! This application allowsyou to evaluate 🤗 Transformers[models](https://huggingface.co/models?library=transformers&sort=downloads)across a wide variety of datasets on the Hub -- all for free! Please selectthe dataset and configuration below. The results of your evaluation will bedisplayed on the [publicleaderboard](https://huggingface.co/spaces/autoevaluate/leaderboards).235 unmodified lines)with st.form(key="form"):compatible_models = get_compatible_models(selected_task, selected_dataset)selected_models = st.multiselect("Select the models you wish to evaluate",compatible_models,66 unmodified lines6768697071727330 unmodified lines104105106107108109110235 unmodified lines34634734834935035135235335435535635766 unmodified lines# in the same environment. Refactor to avoid needing to actually load# the metric.try:print(f"INFO -- Attempting to load metric: {metric}")metric_func = load(metric)except Exception as e:print(e)30 unmodified linesWelcome to Hugging Face's automatic model evaluator! This application allowsyou to evaluate 🤗 Transformers[models](https://huggingface.co/models?library=transformers&sort=downloads)across a wide variety of datasets on the Hub. Please selectthe dataset and configuration below. The results of your evaluation will bedisplayed on the [publicleaderboard](https://huggingface.co/spaces/autoevaluate/leaderboards).235 unmodified lines)with st.form(key="form"):# Grab all models fine-tuned on SQuAD for question answering tasksif selected_task == "extractive_question_answering":compatible_models = get_compatible_models(selected_task, [selected_dataset, "squad", "squad_v2"])else:compatible_models = get_compatible_models(selected_task, [selected_dataset])selected_models = st.multiselect("Select the models you wish to evaluate",compatible_models,
123414 unmodified lines19202122232425262737 unmodified lines6566676869707172737475767778from typing import Dict, Unionimport jsonlinesimport requests14 unmodified linesLOGS_REPO = "evaluation-job-logs"api = HfApi()def get_auth_headers(token: str, prefix: str = "autonlp"):return {"Authorization": f"{prefix} {token}"}37 unmodified linesreturn Nonedef get_compatible_models(task, dataset_name):# TODO: relax filter on PyTorch models once supported in AutoTrainfilt = ModelFilter(task=AUTOTRAIN_TASK_TO_HUB_TASK[task],trained_dataset=dataset_name,library=["transformers", "pytorch"],)compatible_models = api.list_models(filter=filt)return sorted([model.modelId for model in compatible_models])123414 unmodified lines19202122232437 unmodified lines6263646566676869707172737475767778798081828384858687from typing import Dict, List, Unionimport jsonlinesimport requests14 unmodified linesLOGS_REPO = "evaluation-job-logs"def get_auth_headers(token: str, prefix: str = "autonlp"):return {"Authorization": f"{prefix} {token}"}37 unmodified linesreturn Nonedef get_compatible_models(task: str, dataset_ids: List[str]) -> List[str]:"""Returns all model IDs that are compatible with the given task and dataset names.Args:task (`str`): The task to search for.dataset_names (`List[str]`): A list of dataset names to search for.Returns:A list of model IDs, sorted alphabetically."""# TODO: relax filter on PyTorch models if TensorFlow supported in AutoTraincompatible_models = []for dataset_id in dataset_ids:model_filter = ModelFilter(task=AUTOTRAIN_TASK_TO_HUB_TASK[task],trained_dataset=dataset_id,library=["transformers", "pytorch"],)compatible_models.extend(HfApi().list_models(filter=model_filter))return sorted([model.modelId for model in compatible_models])
app.py+7-2
utils.py+21-12