Clean up weight handler

@xuzzo Cleanup code

Co-authored-by: Fabio Peruzzo <39661245+Xuzzo@users.noreply.github.com>
This commit is contained in:
elitexp 2024-09-03 18:19:21 +05:45 committed by GitHub
parent f82caa3298
commit 4dfb3aa892
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -91,10 +91,8 @@ class WeightHandler:
@staticmethod
def _lora_transformer(lora_path: Path) -> (dict, int):
weights = []
quantization_level = safe_open(lora_path, framework="pt").metadata().get("quantization_level")
weight = list(mx.load(str(lora_path)).items())
weights.extend(weight)
weights = list(mx.load(str(lora_path)).items())
weights = [WeightHandler._reshape_weights(k, v) for k, v in weights]
weights = WeightHandler._flatten(weights)
unflatten = tree_unflatten(weights)