File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 33#include " llama-vocab.h"
44#include " llama-sampling.h"
55
6+ #include < cmath>
67#include < algorithm>
78#include < stdexcept>
89
Original file line number Diff line number Diff line change @@ -1258,7 +1258,18 @@ void llama_sampler_reset_impl(struct llama_sampler & smpl) {
12581258}
12591259
12601260struct llama_sampler * llama_sampler_clone_impl (const struct llama_sampler & smpl) {
1261- return smpl.iface ->clone ? smpl.iface ->clone (&smpl) : nullptr ;
1261+ if (smpl.iface ->clone ) {
1262+ return smpl.iface ->clone (&smpl);
1263+ }
1264+
1265+ if (smpl.ctx == nullptr ) {
1266+ return new llama_sampler {
1267+ /* .iface = */ smpl.iface ,
1268+ /* .ctx = */ nullptr ,
1269+ };
1270+ }
1271+
1272+ GGML_ABORT (" the sampler does not support cloning" );
12621273}
12631274
12641275void llama_sampler_free_impl (struct llama_sampler * smpl) {
You can’t perform that action at this time.
0 commit comments