Avoid unnecessary GGUF model unloading after patches#16
Conversation
Prevent unloading GGUF model weights to CPU during unpatching when the model is not scheduled for full unload (i.e., not in `current_loaded_models`). This allows faster patch switching by keeping base weights on GPU.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Implemented logic in
GGUFModelPatcher.unpatch_modelto checksrc.Device.current_loaded_models. If the model is not in the list (meaning it was popped for reload/repatch), the method ignores thedevice_toargument if it points to the offload device, thus preserving the weights on the current device (GPU). This avoids the expensive GPU->CPU transfer when simply changing LoRAs or patches.PR created automatically by Jules for task 7709232856346694567 started by @Aatricks