AI-Hypercomputer / AI-Hypercomputer/maxtext

Support beam search

Aperta
#594 0 commenti 0 reazioni 1 assegnatario Rivendicata da @vipannalla Vedi su GitHub
feature request inference
Lingua principale
Python
Stelle
2.4k
Fork
607
Merge medio
2g 19h
PR unite (30g)
158

Descrizione

Hi,

It would be nice to support beam search.

There is [the reference flax implementation in wmt example](https://github.com/google/flax/blob/main/examples/wmt/decode.py) and [the equivalent one from `transformers`](https://github.com/huggingface/transformers/blob/main/src/transformers/generation/flax_utils.py).

I am guessing that we could:
* duplicate inputs per num_beams initially
* at each step we do:
* decode_step
* select top beams
* overwrite entire past cache per selected beams
* update cache with new selected tokens

So maybe the extra step here is to add the "overwrite entire past cache per selected beams"?
Curious if you have suggestions for implementation

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.