EricLBuehler / xlora

X-LoRA: Mixture of LoRA Experts
Apache License 2.0
178 stars 8 forks source link

Remove all global state #7

Closed EricLBuehler closed 9 months ago

EricLBuehler commented 9 months ago

Overview

This PR removes all global state. Namely, I remove the xlora_state module. The xLoRA Classifier attribute is injected into the PeftModel like how the methods are injected, and the scalings attribute is done similarly.

I also remove the forward pass hook, replacing it by modifying the BaseTunerWrapper.forward function such that it executes the function. Additionally, some other small changes were made, such as setting the PeftModel scalings attribute in the xLoRAClassifier.forward instead of in the now nonexistent hook.

Changes