chore(mlx-lm): add load model with adapter and fix bug in sample (#360)

* chore: add load model with adapter support and fix bug in sample

* chore: ignore temp during calculating prob in sample
This commit is contained in:
Anchen
2024-01-23 19:47:39 -08:00
committed by GitHub
parent f5b80c95fb
commit ab91ac1075
2 changed files with 14 additions and 4 deletions

View File

@@ -1,10 +1,11 @@
import mlx.core as mx
import mlx.nn as nn
from mlx.utils import tree_unflatten
from .lora import LoRALinear
def apply_lora_layers(model, adapter_file: str):
def apply_lora_layers(model: nn.Module, adapter_file: str) -> nn.Module:
adapters = list(mx.load(adapter_file).items())
linear_replacements = {}
lora_layers = set(