Skip to content

Commit e506d10

Browse files
authored
Add LFM2 (#354)
* feat: Add support for LFM2 model
1 parent 88c875c commit e506d10

File tree

3 files changed

+481
-1
lines changed

3 files changed

+481
-1
lines changed

ACKNOWLEDGMENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
MLX Swift was developed with contributions from the following individuals:
88

9-
- [John Mai](https://github.com/johnmai-dev): Added support for multiple models (Qwen2, Starcoder2, InternLM2, Qwen3, Qwen3 MoE, GLM-4, MiMo, BitNet, SmolLM3).
9+
- [John Mai](https://github.com/johnmai-dev): Added support for multiple models (Qwen2, Starcoder2, InternLM2, Qwen3, Qwen3 MoE, GLM-4, MiMo, BitNet, SmolLM3, LFM2).
1010

1111

1212
<a href="https://github.com/ml-explore/mlx-swift-examples/graphs/contributors">

Libraries/MLXLLM/LLMModelFactory.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class LLMTypeRegistry: ModelTypeRegistry, @unchecked Sendable {
5151
"bitnet": create(BitnetConfiguration.self, BitnetModel.init),
5252
"smollm3": create(SmolLM3Configuration.self, SmolLM3Model.init),
5353
"ernie4_5": create(Ernie45Configuration.self, Ernie45Model.init),
54+
"lfm2": create(LFM2Configuration.self, LFM2Model.init),
5455
]
5556
}
5657

@@ -243,6 +244,11 @@ public class LLMRegistry: AbstractModelRegistry, @unchecked Sendable {
243244
defaultPrompt: "Why is the sky blue?"
244245
)
245246

247+
static public let lfm2_1_2b_4bit = ModelConfiguration(
248+
id: "mlx-community/LFM2-1.2B-4bit",
249+
defaultPrompt: "Why is the sky blue?"
250+
)
251+
246252
private static func all() -> [ModelConfiguration] {
247253
[
248254
codeLlama13b4bit,
@@ -277,6 +283,7 @@ public class LLMRegistry: AbstractModelRegistry, @unchecked Sendable {
277283
bitnet_b1_58_2b_4t_4bit,
278284
smollm3_3b_4bit,
279285
ernie_45_0_3BPT_bf16_ft,
286+
lfm2_1_2b_4bit,
280287
]
281288
}
282289

0 commit comments

Comments
 (0)