- Cleaned up disposal in LLamaContext
- sealed some classes not intended to be extended
This commit is contained in:
parent
4d741d24f2
commit
d0a7a8fcd6
|
@ -422,6 +422,8 @@ namespace LLama
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public virtual void Dispose()
|
public virtual void Dispose()
|
||||||
{
|
{
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
|
||||||
_ctx.Dispose();
|
_ctx.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,12 +431,11 @@ namespace LLama
|
||||||
/// The state of this model, which can be reloaded later
|
/// The state of this model, which can be reloaded later
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class State
|
public class State
|
||||||
: SafeHandleZeroOrMinusOneIsInvalid
|
: SafeLLamaHandleBase
|
||||||
{
|
{
|
||||||
internal State(IntPtr memory)
|
internal State(IntPtr memory)
|
||||||
: base(true)
|
: base(memory)
|
||||||
{
|
{
|
||||||
SetHandle(memory);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace LLama
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A set of model weights, loaded into memory.
|
/// A set of model weights, loaded into memory.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class LLamaWeights
|
public sealed class LLamaWeights
|
||||||
: IDisposable
|
: IDisposable
|
||||||
{
|
{
|
||||||
private readonly SafeLlamaModelHandle _weights;
|
private readonly SafeLlamaModelHandle _weights;
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace LLama.Native
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A safe wrapper around a llama_context
|
/// A safe wrapper around a llama_context
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SafeLLamaContextHandle
|
public sealed class SafeLLamaContextHandle
|
||||||
: SafeLLamaHandleBase
|
: SafeLLamaHandleBase
|
||||||
{
|
{
|
||||||
#region properties and fields
|
#region properties and fields
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace LLama.Native
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A reference to a set of llama model weights
|
/// A reference to a set of llama model weights
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SafeLlamaModelHandle
|
public sealed class SafeLlamaModelHandle
|
||||||
: SafeLLamaHandleBase
|
: SafeLLamaHandleBase
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue