mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-08-29 09:17:29 +08:00
comment
This commit is contained in:
parent
80e5c37bb9
commit
5828703a5a
@ -458,13 +458,14 @@ def load_model(
|
|||||||
weights = model.sanitize(weights)
|
weights = model.sanitize(weights)
|
||||||
|
|
||||||
if (quantization := config.get("quantization", None)) is not None:
|
if (quantization := config.get("quantization", None)) is not None:
|
||||||
# Handle legacy models which may not have everything quantized
|
|
||||||
def class_predicate(p, m):
|
def class_predicate(p, m):
|
||||||
# Handle custom per layer quantizations
|
# Handle custom per layer quantizations
|
||||||
if p in config["quantization"]:
|
if p in config["quantization"]:
|
||||||
return config["quantization"][p]
|
return config["quantization"][p]
|
||||||
if not hasattr(m, "to_quantized"):
|
if not hasattr(m, "to_quantized"):
|
||||||
return False
|
return False
|
||||||
|
# Handle legacy models which may not have everything quantized
|
||||||
return f"{p}.scales" in weights
|
return f"{p}.scales" in weights
|
||||||
|
|
||||||
nn.quantize(
|
nn.quantize(
|
||||||
|
Loading…
Reference in New Issue
Block a user