Skip to content

< Back


SafeLlavaModelHandle

Namespace: LLama.Native

A reference to a set of llava model weights.

1
public sealed class SafeLlavaModelHandle : SafeLLamaHandleBase, System.IDisposable

Inheritance ObjectCriticalFinalizerObjectSafeHandleSafeLLamaHandleBaseSafeLlavaModelHandle
Implements IDisposable
Attributes NullableContextAttribute, NullableAttribute

Fields

handle

1
protected IntPtr handle;

Properties

EmbeddingDimensions

Get the number of dimensions in an embedding

1
public int EmbeddingDimensions { get; }

Property Value

Int32

PatchCount

Get the number of "patches" in an image embedding

1
public int PatchCount { get; }

Property Value

Int32

IsInvalid

1
public bool IsInvalid { get; }

Property Value

Boolean

IsClosed

1
public bool IsClosed { get; }

Property Value

Boolean

Constructors

SafeLlavaModelHandle()

1
public SafeLlavaModelHandle()

Methods

ReleaseHandle()

1
protected bool ReleaseHandle()

Returns

Boolean

LoadFromFile(String, Int32)

Load a model from the given file path into memory

1
public static SafeLlavaModelHandle LoadFromFile(string modelPath, int verbosity)

Parameters

modelPath String
MMP File (Multi-Modal Projections)

verbosity Int32
Verbosity level

Returns

SafeLlavaModelHandle
SafeHandle of the Clip Model

Exceptions

InvalidOperationException

LoadWeightsFailedException

CreateImageEmbeddings(LLamaContext, String)

Create the Image Embeddings.

1
public SafeLlavaImageEmbedHandle CreateImageEmbeddings(LLamaContext ctxLlama, string image)

Parameters

ctxLlama LLamaContext
LLama Context

image String
Image filename (it supports jpeg format only)

Returns

SafeLlavaImageEmbedHandle
return the SafeHandle of these embeddings

CreateImageEmbeddings(String, Int32)

Create the Image Embeddings.

1
public SafeLlavaImageEmbedHandle CreateImageEmbeddings(string image, int threads)

Parameters

image String
Image in binary format (it supports jpeg format only)

threads Int32
Number of threads to use

Returns

SafeLlavaImageEmbedHandle
return the SafeHandle of these embeddings

CreateImageEmbeddings(LLamaContext, Byte[])

Create the Image Embeddings.

1
public SafeLlavaImageEmbedHandle CreateImageEmbeddings(LLamaContext ctxLlama, Byte[] image)

Parameters

ctxLlama LLamaContext
LLama Context

image Byte[]
Image in binary format (it supports jpeg format only)

Returns

SafeLlavaImageEmbedHandle
return the SafeHandle of these embeddings

CreateImageEmbeddings(Byte[], Int32)

Create the Image Embeddings.

1
public SafeLlavaImageEmbedHandle CreateImageEmbeddings(Byte[] image, int threads)

Parameters

image Byte[]
Image in binary format (it supports jpeg format only)

threads Int32
Number of threads to use

Returns

SafeLlavaImageEmbedHandle
return the SafeHandle of these embeddings

EvalImageEmbed(LLamaContext, SafeLlavaImageEmbedHandle, Int32&)

Evaluates the image embeddings.

1
public bool EvalImageEmbed(LLamaContext ctxLlama, SafeLlavaImageEmbedHandle imageEmbed, Int32& n_past)

Parameters

ctxLlama LLamaContext
Llama Context

imageEmbed SafeLlavaImageEmbedHandle
The current embeddings to evaluate

n_past Int32&

Returns

Boolean
True on success


< Back