sampling : fix cloning of samplers with null ctx
ggml-ci
This commit is contained in:
parent
0b6dfcebb2
commit
34f4bd02da
2 changed files with 13 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "llama-vocab.h"
|
||||
#include "llama-sampling.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
|
||||
|
|
|
@ -1258,7 +1258,18 @@ void llama_sampler_reset_impl(struct llama_sampler & smpl) {
|
|||
}
|
||||
|
||||
struct llama_sampler * llama_sampler_clone_impl(const struct llama_sampler & smpl) {
|
||||
return smpl.iface->clone ? smpl.iface->clone(&smpl) : nullptr;
|
||||
if (smpl.iface->clone) {
|
||||
return smpl.iface->clone(&smpl);
|
||||
}
|
||||
|
||||
if (smpl.ctx == nullptr) {
|
||||
return new llama_sampler {
|
||||
/* .iface = */ smpl.iface,
|
||||
/* .ctx = */ nullptr,
|
||||
};
|
||||
}
|
||||
|
||||
GGML_ABORT("the sampler does not support cloning");
|
||||
}
|
||||
|
||||
void llama_sampler_free_impl(struct llama_sampler * smpl) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue