We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8f5c9b6 commit 645106eCopy full SHA for 645106e
1 file changed
llama_cpp/_internals.py
@@ -1488,7 +1488,16 @@ def clone(self) -> 'LlamaSampler':
1488
if not new_sampler_p:
1489
raise RuntimeError("llama_sampler_clone failed")
1490
1491
- return LlamaSampler(existing_sampler_p=new_sampler_p)
+ new_sampler = LlamaSampler(existing_sampler_p=new_sampler_p)
1492
+
1493
+ # copy _keep_alive and custom_samplers list to new sampler
1494
+ if self._keep_alive:
1495
+ new_sampler._keep_alive = self._keep_alive.copy()
1496
1497
+ if self.custom_samplers:
1498
+ new_sampler.custom_samplers = self.custom_samplers.copy()
1499
1500
+ return new_sampler
1501
1502
def sample(self, ctx: LlamaContext, idx: int = -1) -> int:
1503
"""
0 commit comments