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
modelIDstringThe unique identifier of the target model. Must match one of the
ModelIDvalues returned by GetPredefinedModelCards(bool) or a custom ModelCard.storagePathstringOptional custom path where the model is stored or downloaded.
deviceConfigurationLM.DeviceConfigurationOptional device-specific configuration (e.g. GPU, CPU, etc.).
loadingOptionsLM.LoadingOptionsOptional loading options (e.g. whether to load tensors into memory).
downloadingProgressLM.ModelDownloadingProgressCallbackOptional callback to report model-downloading progress.
loadingProgressLM.ModelLoadingProgressCallbackOptional callback to report loading progress (e.g. model initialization).
Returns
Exceptions
- ArgumentException
Thrown if
modelIDis null, empty, or does not match any known/predefined model ID.