Instructions to use LiquidAI/LFM2-2.6B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LiquidAI/LFM2-2.6B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LiquidAI/LFM2-2.6B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("LiquidAI/LFM2-2.6B") model = AutoModelForCausalLM.from_pretrained("LiquidAI/LFM2-2.6B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LiquidAI/LFM2-2.6B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LiquidAI/LFM2-2.6B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LiquidAI/LFM2-2.6B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LiquidAI/LFM2-2.6B
- SGLang
How to use LiquidAI/LFM2-2.6B 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-2.6B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LiquidAI/LFM2-2.6B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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-2.6B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LiquidAI/LFM2-2.6B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LiquidAI/LFM2-2.6B with Docker Model Runner:
docker model run hf.co/LiquidAI/LFM2-2.6B
Commit History
-
Fix chat template: render assistant tool_calls
Verified signatureAssistant messages carrying `tool_calls` render to nothing under the current template: the message loop ends in a single `{{- content + "<|im_end|>\n" -}}` with no branch for tool calls. Two consequences, both reproduced on llama.cpp `server-rocm-b10088`: 1. llama.cpp probes the template at startup, sees that a tool call renders to nothing, and reports `supports_tool_calls: false` / `supports_parallel_tool_calls: false` in `/props`. It then constrains generation to at most one call, so the second call of a parallel request is never sampled. 2. Replaying a conversation that already contains an assistant tool call produces an empty assistant turn, while the following `tool` result is still rendered -- the model sees an answer to a question it has no record of asking. **This PR** adds the `format_arg_value` / `render_tool_calls` macros (taken verbatim from the latest LFM2.5 template) and one branch that emits them, so a tool call renders as `<|tool_call_start|>[name(ar…0f7a03b
-
Update README.md
Verified signaturef256cdb
-
Update README.md
Verified signatureb4743c4
-
Fix link bar, add Discord and br tag, update Contact section
8149bde
-
Lastly, fix mistake. (#7)
- Lastly, fix mistake. (b2b8e8161f8031073e01eba1524b7f49447b5d4b) Co-authored-by: Mihai Popa <MihaiPopa-1@users.noreply.huggingface.co>e161ff2
-
Update README.md
Verified signaturef988df9 -
Update README.md
Verified signature3815346
-
Update README.md (#6)
Verified signature- Update README.md (e079083d9b6c5fb943995bb3361e2e6696074a29) Co-authored-by: Edoardo Mosca <EdoardoMosca@users.noreply.huggingface.co>5eebf98
-
Update README.md
Verified signature616a3ff -
Update README.md
Verified signature1bfcfeb
-
Update README.md
Verified signaturec694022
-
Update README.md
Verified signature6b75982
-
Update README.md
Verified signaturebd63f69 -
Update README.md
Verified signaturef650e76 -
Create LICENSE
Verified signature1fbf4aa -
Update README.md
Verified signature005bf33
-
Update README.md
Verified signature0c0603c -
Create README.md
Verified signature7fe86b7 -
Add files using upload-large-folder tool
Verified signature62a5e42 -
initial commit
Verified signature607d21c