mirror of
https://github.com/ml-explore/mlx-examples.git
synced 2025-09-01 04:14:38 +08:00
Add support for cohere2 (#1157)
* add support for cohere2 * revert to act_fn to silu * fix tests and sliding window attention * add tests * add to tuner * fix sliding window * add coauthor :) Co-authored-by: n8programs <43304488+N8python@users.noreply.github.com> * Add rotating kvcache to save space * some nits * style * nits --------- Co-authored-by: n8programs <43304488+N8python@users.noreply.github.com> Co-authored-by: N8 <n8@n8programs.com> Co-authored-by: Awni Hannun <awni@apple.com>
This commit is contained in:
@@ -851,6 +851,22 @@ class TestModels(unittest.TestCase):
|
||||
model = exaone.Model(args)
|
||||
self.model_test_runner(model, args.model_type, args.vocab_size, args.num_layers)
|
||||
|
||||
def test_cohere2(self):
|
||||
from mlx_lm.models import cohere2
|
||||
|
||||
args = cohere2.ModelArgs(
|
||||
model_type="cohere2",
|
||||
hidden_size=4096,
|
||||
head_dim=128,
|
||||
num_hidden_layers=40,
|
||||
sliding_window=4096,
|
||||
sliding_window_pattern=4,
|
||||
)
|
||||
model = cohere2.Model(args)
|
||||
self.model_test_runner(
|
||||
model, args.model_type, args.vocab_size, args.num_hidden_layers
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user