diff options
| author | Jonas Knobloch <jonas.knobloch@t-online.de> | 2026-04-06 22:42:29 +0200 |
|---|---|---|
| committer | Jonas Knobloch <jonas.knobloch@t-online.de> | 2026-04-06 23:28:03 +0200 |
| commit | 58bdf1ac7155f4c5076cf4a077a5f39dfdedbac7 (patch) | |
| tree | 49b6d5a01784f43741f79cf9036431377460340a | |
| parent | a8f1b564dba5cc4029ff25a49d2aa47bc7dab406 (diff) | |
Require cache when generating new tokens
| -rw-r--r-- | gpt2/model.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gpt2/model.go b/gpt2/model.go index 19a3363..f492c56 100644 --- a/gpt2/model.go +++ b/gpt2/model.go @@ -110,6 +110,10 @@ func (m *Model) Generate(prompt []int64, steps int64, logits *[][]float32) ([]in panic("generate requires logits output") } + if steps > 0 && !m.withCache { + panic("generate with steps > 0 requires cache") + } + if len(prompt) == 0 { return nil, errors.New("empty prompt") } |
