Clean up weight handler
@xuzzo Cleanup code Co-authored-by: Fabio Peruzzo <39661245+Xuzzo@users.noreply.github.com>
This commit is contained in:
parent
f82caa3298
commit
4dfb3aa892
@ -91,10 +91,8 @@ class WeightHandler:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _lora_transformer(lora_path: Path) -> (dict, int):
|
def _lora_transformer(lora_path: Path) -> (dict, int):
|
||||||
weights = []
|
|
||||||
quantization_level = safe_open(lora_path, framework="pt").metadata().get("quantization_level")
|
quantization_level = safe_open(lora_path, framework="pt").metadata().get("quantization_level")
|
||||||
weight = list(mx.load(str(lora_path)).items())
|
weights = list(mx.load(str(lora_path)).items())
|
||||||
weights.extend(weight)
|
|
||||||
weights = [WeightHandler._reshape_weights(k, v) for k, v in weights]
|
weights = [WeightHandler._reshape_weights(k, v) for k, v in weights]
|
||||||
weights = WeightHandler._flatten(weights)
|
weights = WeightHandler._flatten(weights)
|
||||||
unflatten = tree_unflatten(weights)
|
unflatten = tree_unflatten(weights)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user