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 3
3
#include " llama-vocab.h"
4
4
#include " llama-sampling.h"
5
5
6
+ #include < cmath>
6
7
#include < algorithm>
7
8
#include < stdexcept>
8
9
Original file line number Diff line number Diff line change @@ -1258,7 +1258,18 @@ void llama_sampler_reset_impl(struct llama_sampler & smpl) {
1258
1258
}
1259
1259
1260
1260
struct 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" );
1262
1273
}
1263
1274
1264
1275
void llama_sampler_free_impl (struct llama_sampler * smpl) {
You can’t perform that action at this time.
0 commit comments