Instructions to use LiquidAI/LFM2-24B-A2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LiquidAI/LFM2-24B-A2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LiquidAI/LFM2-24B-A2B")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("LiquidAI/LFM2-24B-A2B", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LiquidAI/LFM2-24B-A2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LiquidAI/LFM2-24B-A2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LiquidAI/LFM2-24B-A2B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/LiquidAI/LFM2-24B-A2B
- SGLang
How to use LiquidAI/LFM2-24B-A2B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "LiquidAI/LFM2-24B-A2B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LiquidAI/LFM2-24B-A2B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "LiquidAI/LFM2-24B-A2B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LiquidAI/LFM2-24B-A2B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use LiquidAI/LFM2-24B-A2B with Docker Model Runner:
docker model run hf.co/LiquidAI/LFM2-24B-A2B
Extend context to 262144 with YaRN rope scaling
#16
by logan-vegna-shopify - opened
- config.json +7 -2
- tokenizer_config.json +3 -5
config.json
CHANGED
|
@@ -52,7 +52,7 @@
|
|
| 52 |
"full_attention",
|
| 53 |
"conv"
|
| 54 |
],
|
| 55 |
-
"max_position_embeddings":
|
| 56 |
"model_type": "lfm2_moe",
|
| 57 |
"moe_intermediate_size": 1536,
|
| 58 |
"norm_eps": 1e-05,
|
|
@@ -72,5 +72,10 @@
|
|
| 72 |
"transformers_version": "5.0.0rc1",
|
| 73 |
"use_cache": true,
|
| 74 |
"use_expert_bias": true,
|
| 75 |
-
"vocab_size": 65536
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
}
|
|
|
|
| 52 |
"full_attention",
|
| 53 |
"conv"
|
| 54 |
],
|
| 55 |
+
"max_position_embeddings": 262144,
|
| 56 |
"model_type": "lfm2_moe",
|
| 57 |
"moe_intermediate_size": 1536,
|
| 58 |
"norm_eps": 1e-05,
|
|
|
|
| 72 |
"transformers_version": "5.0.0rc1",
|
| 73 |
"use_cache": true,
|
| 74 |
"use_expert_bias": true,
|
| 75 |
+
"vocab_size": 65536,
|
| 76 |
+
"rope_scaling": {
|
| 77 |
+
"rope_type": "yarn",
|
| 78 |
+
"factor": 2.05,
|
| 79 |
+
"original_max_position_embeddings": 128000
|
| 80 |
+
}
|
| 81 |
}
|
tokenizer_config.json
CHANGED
|
@@ -1,10 +1,8 @@
|
|
| 1 |
{
|
| 2 |
-
"additional_special_tokens": null,
|
| 3 |
-
"backend": "tokenizers",
|
| 4 |
"bos_token": "<|startoftext|>",
|
| 5 |
"clean_up_tokenization_spaces": false,
|
| 6 |
"eos_token": "<|im_end|>",
|
| 7 |
-
"
|
| 8 |
"legacy": false,
|
| 9 |
"model_input_names": [
|
| 10 |
"input_ids",
|
|
@@ -15,7 +13,7 @@
|
|
| 15 |
"pad_token": "<|pad|>",
|
| 16 |
"sp_model_kwargs": {},
|
| 17 |
"spaces_between_special_tokens": false,
|
| 18 |
-
"tokenizer_class": "
|
| 19 |
"use_default_system_prompt": false,
|
| 20 |
"use_fast": true
|
| 21 |
-
}
|
|
|
|
| 1 |
{
|
|
|
|
|
|
|
| 2 |
"bos_token": "<|startoftext|>",
|
| 3 |
"clean_up_tokenization_spaces": false,
|
| 4 |
"eos_token": "<|im_end|>",
|
| 5 |
+
"extra_special_tokens": {},
|
| 6 |
"legacy": false,
|
| 7 |
"model_input_names": [
|
| 8 |
"input_ids",
|
|
|
|
| 13 |
"pad_token": "<|pad|>",
|
| 14 |
"sp_model_kwargs": {},
|
| 15 |
"spaces_between_special_tokens": false,
|
| 16 |
+
"tokenizer_class": "PreTrainedTokenizerFast",
|
| 17 |
"use_default_system_prompt": false,
|
| 18 |
"use_fast": true
|
| 19 |
+
}
|