File tree Expand file tree Collapse file tree
examples/models/qwen3_5_moe Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -162,11 +162,19 @@ int main(int argc, char** argv) {
162162 llm::SamplingConfig sampling;
163163 sampling.temperature = static_cast <float >(FLAGS_temperature);
164164 sampling.top_p = static_cast <float >(FLAGS_top_p);
165- const uint64_t base_seed = FLAGS_seed < 0
166- ? static_cast <uint64_t >(std::random_device{}())
167- : static_cast <uint64_t >(FLAGS_seed);
165+ // Only a --sample model uses the seed; randomize an unset seed for those and
166+ // leave non-sample models at 0 so they don't trip the top_p/seed guard.
167+ const auto & md = engine->metadata ();
168+ const auto us_it = md.find (" use_sampling" );
169+ const bool model_samples = us_it != md.end () && us_it->second != 0 ;
170+ uint64_t base_seed = FLAGS_seed < 0 ? 0 : static_cast <uint64_t >(FLAGS_seed);
171+ if (model_samples && FLAGS_seed < 0 ) {
172+ base_seed = static_cast <uint64_t >(std::random_device{}());
173+ }
168174 sampling.seed = base_seed;
169- ET_LOG (Info, " Sampling base seed: %" PRIu64, base_seed);
175+ if (model_samples) {
176+ ET_LOG (Info, " Sampling base seed: %" PRIu64, base_seed);
177+ }
170178 const int total_iters = FLAGS_warmup + std::max (1 , FLAGS_num_iters);
171179 std::vector<double > prefill_tps_samples;
172180 std::vector<double > decode_tps_samples;
You can’t perform that action at this time.
0 commit comments