MCPcopy Create free account
hub / github.com/Luce-Org/lucebox-hub / parse_sampler_token

Function parse_sampler_token

server/src/common/sampler.cpp:257–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

255}
256
257bool parse_sampler_token(std::string & line, SamplerCfg & out) {
258 auto pos = line.find(" samp=");
259 if (pos == std::string::npos) return false;
260 auto end = line.find(' ', pos + 1);
261 std::string tok = (end == std::string::npos)
262 ? line.substr(pos + 6)
263 : line.substr(pos + 6, end - (pos + 6));
264 line.erase(pos, (end == std::string::npos ? std::string::npos : end - pos));
265 float t = 0.0f, tp = 1.0f, rp = 1.0f, fp = 0.0f, pp = 0.0f;
266 int tk = 0;
267 unsigned long long sd = 0;
268 int n = std::sscanf(tok.c_str(), "%f,%f,%d,%f,%llu,%f,%f",
269 &t, &tp, &tk, &rp, &sd, &fp, &pp);
270 if (n < 1) return false;
271 out.temp = t;
272 out.top_p = tp;
273 out.top_k = tk;
274 out.rep_pen = rp;
275 out.seed = sd;
276 out.freq_pen = fp;
277 out.pres_pen = pp;
278 return true;
279}
280
281} // namespace dflash::common

Callers 7

mainFunction · 0.85
run_daemonFunction · 0.85
run_layer_split_daemonFunction · 0.85

Calls

no outgoing calls