Questions around perplexity metric for language modeling
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 32/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- machine-learning
Direzione di ricerca
Inizia confrontando il calcolo manuale della perplexity nella documentazione di Transformers con evaluate/metrics/perplexity/perplexity.py e l’esempio di riferimento della metrica collegato. Riproduci quindi i risultati riportati per Wikitext e GPT-2 dal notebook Colab, poi traccia il percorso con cui gli input di tipo lista e stringa raggiungono la metrica. Il lavoro è completato quando le discrepanze e il comportamento di elaborazione degli input sono spiegati o coperti da una correzione documentata e da test.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hi there,
I've been fiddling with perplexity computation in the past few days, and I was struck by a few discrepancies:
- In your manual implementation, I read:
When we run the above with
stride = 1024, i.e. no overlap, the resulting PPL is19.44, which is about the same as the19.93reported in the GPT-2 paper (note: p. 5). - On the reference page (see 'Examples'):
(Of course this is run on a very short sequence, only 50 characters!)perplexity = evaluate.load("perplexity", module_type="metric") input_texts = datasets.load_dataset("wikitext", "wikitext-2-raw-v1", split="test")["text"][:50] input_texts = [s for s in input_texts if s!=''] results = perplexity.compute(model_id='gpt2', predictions=input_texts) print(list(results.keys())) >>>['perplexities', 'mean_perplexity'] print(round(results["mean_perplexity"], 2)) >>>576.76 print(round(results["perplexities"][0], 2)) >>>889.28
Here's a Colab notebook with my experiments.
Question 1
Even when using evaluate, I get fairly different results: just for the 50 character selection, I obtain:
320.85
567.91
Something in the implementation changed since the docs were written? What am I missing?
Question 2
There is still a humongous difference between the manual computation (first page I quoted above, ported in the notebook, and similar results when experimenting with a faster, batched implementation using stride in the tokenizer) and what the metric produces. What I'm expecting for wikitext is something of the order of 20-30, and lower for bigger models, not in the hundreds, let alone in the thousands (see the notebook, result when joining all rows with \n\n)... (At first I thought it was because of pad_tokens being counted, that was wrong.) I'm now at a loss as to where that might come from. Any ideas?
Question 3
Also, notice that I can pass the dataset either as a list of strings of varying lengths, or as one long string, and it runs, but the perplexity class itself, on its own, does not seem to handle that (no return_overflowing_tokens = True passed to the tokenizer, for instance, I performed a few tests with the class only): I'm guessing the dataset is processed somewhere before being fed to it? I'm in the process of understanding the whole pipeline of invocation of the metric, but so far I haven't found where it happens.
Apologies if the first version of this issue had quite a few silly mistakes, and thanks for reading!
- Lingua principale
- Python
- Stelle
- 2.5k
- Fork
- 346
- Merge medio
- 38m
- PR unite (30g)
- 4
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
-
EvaluationSuite.run fails with default args_for_task and mutates supplied kwargsForse già presa @ktz03 l’ha presa 3 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 20 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 117 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
-
TypeError: got an unexpected keyword argument 'squared'Forse già presa @ShamikOfficial l’ha presa 41 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
huggingface/evaluate#669 · 3 commenti · 7 reazioni ·
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 72/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 62/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
topoteretes/cognee#5773 ·
I maintainer di solito rispondono entro 1 giorno
-
MiKTeX: a failed build reports no errors because texify --quiet switches the log to file:line: styleAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
SublimeText/LaTeXTools#1718 ·