diff --git a/LLama/Batched/BatchedExecutor.cs b/LLama/Batched/BatchedExecutor.cs
index 2009a687..f432a89f 100644
--- a/LLama/Batched/BatchedExecutor.cs
+++ b/LLama/Batched/BatchedExecutor.cs
@@ -15,6 +15,11 @@ public sealed class BatchedExecutor
private int _nextSequenceId;
internal LLamaBatch Batch { get; }
+
+ ///
+ /// Epoch is incremented every time Infer is called. Conversations can use this to keep track of
+ /// whether they're waiting for inference, or can be sampled.
+ ///
internal ulong Epoch { get; private set; }
///
@@ -50,6 +55,11 @@ public sealed class BatchedExecutor
Epoch = 1;
}
+ ~BatchedExecutor()
+ {
+ Dispose();
+ }
+
///
/// Start a new with the given prompt
///
@@ -97,6 +107,8 @@ public sealed class BatchedExecutor
return;
IsDisposed = true;
+ GC.SuppressFinalize(this);
+
Context.Dispose();
}