This is
LFM2-24B-A2B model converted to the
OpenVINO™ IR (Intermediate Representation) format with weights compressed to INT4 by
NNCF.
LFM2-24B-A2B is a Mixture-of-Experts (MoE) language model with 24B total parameters and 2B active parameters per token, designed for efficient edge deployment.
For more information on quantization, check the
OpenVINO model optimization guide.
1from transformers import AutoTokenizer
2from optimum.intel.openvino import OVModelForCausalLM
3
4model_id = "OpenVINO/LFM2-24B-A2B-int4-ov"
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = OVModelForCausalLM.from_pretrained(model_id, trust_remote_code=True)
7
8inputs = tokenizer("What is a capital of France?", return_tensors="pt")
9inputs.pop("token_type_ids", None)
10
11outputs = model.generate(**inputs, max_length=200)
12text = tokenizer.batch_decode(outputs)[0]
13print(text)
For more examples and possible optimizations, refer to the
Inference with Optimum Intel.
1import huggingface_hub as hf_hub
2
3model_id = "OpenVINO/LFM2-24B-A2B-int4-ov"
4model_path = "LFM2-24B-A2B-int4-ov"
5
6hf_hub.snapshot_download(model_id, local_dir=model_path)
1import openvino_genai as ov_genai
2
3device = "CPU"
4pipeline_config = {"ATTENTION_BACKEND": "SDPA"}
5pipe = ov_genai.LLMPipeline(model_path, device, **pipeline_config)
6print(pipe.generate("What is a capital of France?", max_length=200))
More GenAI usage examples can be found in
OpenVINO GenAI library docs and
samples
You can find more detailed usage examples in
OpenVINO Notebooks:
Check the original model card for
limitations.
The original model is distributed under
lfm1.0 license. More details can be found in
LFM2-24B-A2B.
Intel is committed to respecting human rights and avoiding causing or contributing to adverse impacts on human rights. See
Intel's Global Human Rights Principles. Intel's products and software are intended only to be used in applications that do not cause or contribute to adverse impacts on human rights.