|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > LMS. - LM-Studio Commands > LMS. - LM Studio Interface |
MiniRobotLanguage (MRL)
LMS.Unload Model - Command
Free VRAM and Eject Model
Intention
This command explicitly unloads (ejects) the currently loaded AI model from the LM Studio engine.
Large Language Models (LLMs) consume a significant amount of System RAM or Video RAM (VRAM). Use this command when:
• Your script has finished its AI tasks and you want to free up resources for other applications.
• You are about to perform a memory-intensive operation and need full system performance.
Syntax
LMS.Unload Model
Parameter Explanation
None.
Example
'**********************************************
' LMS.unloadmodel - Cleanup Example
'**********************************************
'
' 1. Load a specific model (optional, or assume one is loaded)
LMS.selectmodel|"llama-3"
'
' 2. Perform AI Task
LMS.ask|"Summarize this long text..."|$$SUMMARY
MBX.Summary: $$SUMMARY
'
' 3. Cleanup resources
LMS.unloadmodel
' VRAM is now free.
Remarks
This command does not close the LM Studio application; it only stops the running model server engine within it.
If you call LMS.ask after unloading, LM Studio will typically reload the last used model automatically, which may cause a delay in the response.
See also:
• LMS.selectmodel - Choose a Model
• LMS.setsystemprompt - Set Agent Persona