[Question] How to have no preset values sent into `.compute()`
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- machine-learning
Direzione di ricerca
Riproduci la chiamata senza feature mostrata nell’issue e inizia leggendo evaluate/module.py in _get_all_cache_files e _infer_feature_from_example. Traccia il motivo per cui compute si aspetta predizioni o riferimenti, quindi verifica che la chiamata richiesta con pretrained e tasks possa essere completata senza add né add_batch e restituisca il risultato documentato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
We've a use-case https://huggingface.co/spaces/alvations/llm_harness_mistral_arc/blob/main/llm_harness_mistral_arc.py
where default feature input types for evaluate.Metric is nothing and we get something like this in our llm_harness_mistral_arc/llm_harness_mistral_arc.py
import evaluate
import datasets
import lm_eval
@evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
class llm_harness_mistral_arc(evaluate.Metric):
def _info(self):
# TODO: Specifies the evaluate.EvaluationModuleInfo object
return evaluate.MetricInfo(
# This is the description that will appear on the modules page.
module_type="metric",
description="",
citation="",
inputs_description="",
# This defines the format of each prediction and reference
features={},
)
def _compute(self, pretrained=None, tasks=[]):
outputs = lm_eval.simple_evaluate(
model="hf",
model_args={"pretrained":pretrained},
tasks=tasks,
num_fewshot=0,
)
results = {}
for task in outputs['results']:
results[task] = {'acc':outputs['results'][task]['acc,none'],
'acc_norm':outputs['results'][task]['acc_norm,none']}
return results
And in our expected user-behavior is something like, [in]:
import evaluate
module = evaluate.load("alvations/llm_harness_mistral_arc")
module.compute(pretrained="mistralai/Mistral-7B-Instruct-v0.2", tasks=["arc_easy"])
And the expected output as per our tests.py, https://huggingface.co/spaces/alvations/llm_harness_mistral_arc/blob/main/tests.py [out]:
{'arc_easy': {'acc': 0.8131313131313131, 'acc_norm': 0.7680976430976431}}
But the evaluate.Metric.compute() somehow expects a default batch and module.compute(pretrained="mistralai/Mistral-7B-Instruct-v0.2", tasks=["arc_easy"]) throws an error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
[<ipython-input-20-bd94e5882ca5>](https://localhost:8080/#) in <cell line: 1>()
----> 1 module.compute(pretrained="mistralai/Mistral-7B-Instruct-v0.2",
2 tasks=["arc_easy"])
2 frames
[/usr/local/lib/python3.10/dist-packages/evaluate/module.py](https://localhost:8080/#) in _get_all_cache_files(self)
309 if self.num_process == 1:
310 if self.cache_file_name is None:
--> 311 raise ValueError(
312 "Evaluation module cache file doesn't exist. Please make sure that you call `add` or `add_batch` "
313 "at least once before calling `compute`."
ValueError: Evaluation module cache file doesn't exist. Please make sure that you call `add` or `add_batch` at least once before calling `compute`.
Q: Is it possible for the .compute() to expect no features?
I've also tried this but somehow the evaluate.Metric.compute is still looking for some sort of predictions variable.
@evaluate.utils.file_utils.add_start_docstrings(_DESCRIPTION, _KWARGS_DESCRIPTION)
class llm_harness_mistral_arc(evaluate.Metric):
def _info(self):
# TODO: Specifies the evaluate.EvaluationModuleInfo object
return evaluate.MetricInfo(
# This is the description that will appear on the modules page.
module_type="metric",
description="",
citation="",
inputs_description="",
# This defines the format of each prediction and reference
features=[
datasets.Features(
{
"pretrained": datasets.Value("string", id="sequence"),
"tasks": datasets.Sequence(datasets.Value("string", id="sequence"), id="tasks"),
}
)]
)
def _compute(self, pretrained, tasks):
outputs = lm_eval.simple_evaluate(
model="hf",
model_args={"pretrained":pretrained},
tasks=tasks,
num_fewshot=0,
)
results = {}
for task in outputs['results']:
results[task] = {'acc':outputs['results'][task]['acc,none'],
'acc_norm':outputs['results'][task]['acc_norm,none']}
return results
then:
import evaluate
module = evaluate.load("alvations/llm_harness_mistral_arc")
module.compute(pretrained="mistralai/Mistral-7B-Instruct-v0.2", tasks=["arc_easy"])
[out]:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
[<ipython-input-36-bd94e5882ca5>](https://localhost:8080/#) in <cell line: 1>()
----> 1 module.compute(pretrained="mistralai/Mistral-7B-Instruct-v0.2",
2 tasks=["arc_easy"])
3 frames
[/usr/local/lib/python3.10/dist-packages/evaluate/module.py](https://localhost:8080/#) in _infer_feature_from_example(self, example)
606 f"Predictions and/or references don't match the expected format.\n"
607 f"Expected format:\n{feature_strings},\n"
--> 608 f"Input predictions: {summarize_if_long_list(example['predictions'])},\n"
609 f"Input references: {summarize_if_long_list(example['references'])}"
610 )
KeyError: 'predictions'
- Lingua principale
- Python
- Stelle
- 2.5k
- Fork
- 359
- Merge medio
- 48m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di huggingface/evaluate
-
exact_match: ignore_punctuation only removes ASCII punctuationForse già presa @reginaldalfret l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
huggingface/evaluate#836 ·
I maintainer di solito rispondono entro 1 giorno
-
EvaluationSuite.run fails with default args_for_task and mutates supplied kwargsForse già presa @ktz03 l’ha presa 17 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
huggingface/evaluate#825 ·
I maintainer di solito rispondono entro 1 giorno
-
exact_match scores two different answers as a perfect match when normalization erases both to the same residueForse già presa @MahendraMula l’ha presa 33 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
huggingface/evaluate#822 ·
I maintainer di solito rispondono entro 1 giorno
-
Perplexity metric fails with GPT-2 tokenizerForse già presa @zanvari l’ha presa 131 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
huggingface/evaluate#766 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
False/misleading instruction to use different checkpoints of BLEURTForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
huggingface/evaluate#679 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di huggingface/evaluate
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
-
query rewriting: prompt says "Language for `query` field: None" when language detection failsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
ocr_data_to_elements() raises AttributeError when a layout element is a ListForse già presa @Eapp1e l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
Unstructured-IO/unstructured#4616 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
area:codegen backend:metal bug direction:output
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno