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
+4
-1
@@ -33,10 +33,13 @@ struct GenSampling {
|
||||
* has no field for it; a container states it as `generation.no_repeat_ngram_whitelist`, a
|
||||
* JSON array of ids. Empty means not stated. */
|
||||
std::vector<int32_t> ngram_whitelist;
|
||||
/* transformers' suppress_tokens: ids never sampled. Empty means not stated. */
|
||||
std::vector<int32_t> suppress;
|
||||
|
||||
bool any() const {
|
||||
return temp >= 0.0f || top_p >= 0.0f || min_p >= 0.0f || top_k >= 0 ||
|
||||
ngram_ban_n >= 0 || ngram_window >= 0 || !ngram_whitelist.empty();
|
||||
ngram_ban_n >= 0 || ngram_window >= 0 || !ngram_whitelist.empty() ||
|
||||
!suppress.empty();
|
||||
}
|
||||
|
||||
/* Overlay onto `base` field by field; unstated fields keep base's, so sources stack. */
|
||||
|
||||
Reference in new issue
Block a user