Table of Contents

Method GetPerformanceScore

Namespace
LMKit.Graphics
Assembly
LM-Kit.NET.dll

GetPerformanceScore(LM)

Calculates a performance score for the provided language model based on the GPU device's total memory and the model's estimated memory requirements.

public static float GetPerformanceScore(LM model)

Parameters

model LM

An instance of LM representing the language model. The model's size is used to estimate memory requirements.

Returns

float

A float value between 0 and 1 representing the performance score. A score closer to 1 indicates that the GPU's memory is sufficient for the model's requirements.

Remarks

If a suitable GPU device is found using LMKit.Graphics.Gpu.GpuDeviceInfo.GetBestGpuDevice(), the performance score is calculated as the ratio of the GPU's total memory to the model's estimated memory requirement. If no suitable device is found, a default memory estimate of 1 GB is used for the calculation.

This score can be used to evaluate whether the GPU is well-suited for running the given language model efficiently.

GetPerformanceScore(ModelCard)

Calculates a performance score for the provided model card based on the GPU device's total memory and the model's file size.

public static float GetPerformanceScore(ModelCard modelCard)

Parameters

modelCard ModelCard

An instance of ModelCard representing the model. The file size is used to estimate memory requirements.

Returns

float

A float value between 0 and 1 representing the performance score. A score closer to 1 indicates that the GPU's memory is sufficient for the model's requirements.

Remarks

If a suitable GPU device is found using LMKit.Graphics.Gpu.GpuDeviceInfo.GetBestGpuDevice(), the performance score is calculated as the ratio of the GPU's total memory to the model's estimated memory requirement. If no suitable device is found, a default memory estimate of 1 GB is used for the calculation.

This score can be used to evaluate whether the GPU is well-suited for running the given model efficiently.

GetPerformanceScore(string)

Calculates a performance score for the language model located at the specified file path, based on the GPU device's total memory and the model's estimated memory requirement.

public static float GetPerformanceScore(string path)

Parameters

path string

The file path to the language model file. This method initializes an LM object from the specified path (with tensors not loaded to reduce overhead) to estimate the model's memory requirements.

Returns

float

A float value between 0 and 1 representing the performance score. A score closer to 1 indicates that the GPU's memory is sufficient for the model's requirements.

Remarks

If a suitable GPU device is found using LMKit.Graphics.Gpu.GpuDeviceInfo.GetBestGpuDevice(), the performance score is calculated as the ratio of the GPU's total memory to the model's estimated memory requirement. If no suitable device is detected, a default memory estimate of 1 GB is used for the calculation.

The final score can be used to determine whether the GPU is well-suited for running the specified language model effectively.