Method LoadFromModelID
LoadFromModelID(string, string, DeviceConfiguration, LoadingOptions, ModelDownloadingProgressCallback, ModelLoadingProgressCallback)
Loads an LM instance based on a given model identifier.
Where to find modelID
:
1. Use GetPredefinedModelCards(bool) to see a list of available predefined models.
Each predefined model exposes its unique identifier in the ModelID property.
2. For custom models, define your own ModelCard instance and specify the ModelID.
public static LM LoadFromModelID(string modelID, string storagePath = "", LM.DeviceConfiguration deviceConfiguration = null, LM.LoadingOptions loadingOptions = null, LM.ModelDownloadingProgressCallback downloadingProgress = null, LM.ModelLoadingProgressCallback loadingProgress = null)
Parameters
modelID
stringThe unique identifier of the target model. Must match one of the
ModelID
values returned by GetPredefinedModelCards(bool) or a custom ModelCard.storagePath
stringOptional custom path where the model is stored or downloaded.
deviceConfiguration
LM.DeviceConfigurationOptional device-specific configuration (e.g. GPU, CPU, etc.).
loadingOptions
LM.LoadingOptionsOptional loading options (e.g. whether to load tensors into memory).
downloadingProgress
LM.ModelDownloadingProgressCallbackOptional callback to report model-downloading progress.
loadingProgress
LM.ModelLoadingProgressCallbackOptional callback to report loading progress (e.g. model initialization).
Returns
Exceptions
- ArgumentException
Thrown if
modelID
is null, empty, or does not match any known/predefined model ID.