Archived
sampler: read suppress_tokens
generation_config.json's suppress_tokens (Gemma 4: the end-of-image and end-of-audio markers, ids 258883 and 258882) are never sampled. The ids reach the sampler as SamplingParams::suppress_tokens and leave the row the way a grammar's mask does. A container carries them already, as the space-separated generation.suppress_tokens.
This commit is contained in:
1 parent
c1c05e9029
commit
a72686b7e7
6 files changed
+83
-2
No files matched your search
@@ -267,6 +267,9 @@ private:
|
||||
* inside the block. A grammar mask on the row wins: the close is forced only where the
|
||||
* grammar admits it, otherwise at a later position. */
|
||||
void force_close(DeviceSampleParams& p, int64_t row, int32_t close);
|
||||
/* Take `ids` out of the row: from the grammar's mask where it has one, from a full row where
|
||||
* not. */
|
||||
void suppress(DeviceSampleParams& p, int64_t row, const std::vector<int32_t>& ids);
|
||||
|
||||
SamplerConfig cfg_{};
|
||||
const VocabView* vocab_ = nullptr;
|
||||
|
||||
Reference in new issue
Block a user