go-skynet / go-llama.cpp

LLama.cpp golang bindings
MIT License
650 stars 79 forks source link

Fix: per-prediction seed #198

Closed ljcleo closed 11 months ago

ljcleo commented 12 months ago

The original binding.cpp only applies RNG seed in ModelOptions, custom seeds passed by PredictOptions for individual prediction requests are not used. The example script is modified to illustrate its use.

Could be a fix to https://github.com/go-skynet/LocalAI/issues/676, because LocalAI doesn't set a model-level seed, so the default value 0 is used, which prevents llama.cpp from using random RNG seeds.

Some other changes:

P.S. I've only made the minimum changes, but I think we can use prediction-level seeds only and remove model-level seeds, like llama.cpp's official server example. For me it doesn't make sense to stick to a seed for a long-running backend service.