ensure penalty sampler to be the first one in mixed samplers

This commit is contained in:
hzx 2025-05-21 23:42:30 +08:00
parent 3941e19a81
commit 69ac2f8f04
1 changed files with 11 additions and 0 deletions

View File

@ -232,6 +232,17 @@ void Sampler::SamplerConfig::configMixed(std::shared_ptr<LlmConfig> llmConfig) {
this->configSampler(samplerName, llmConfig);
// std::cout << samplerName << " " << std::flush;
}
for (int i=1; i<mixedSamplers.size(); ++i) {
// "penalty" can only locate at the first position
if (mixedSamplers[i]=="penalty") {
mixedSamplers.erase(mixedSamplers.begin()+i);
i--;
if (mixedSamplers[0]!="penalty") {
mixedSamplers.insert(mixedSamplers.begin(), "penalty");
i++;
}
}
}
// std::cout << std::endl;
// set select type
// the final sampler select the token