Instructions to use LiquidAI/LFM2-700M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LiquidAI/LFM2-700M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LiquidAI/LFM2-700M") 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-700M") model = AutoModelForCausalLM.from_pretrained("LiquidAI/LFM2-700M", 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-700M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LiquidAI/LFM2-700M" # 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-700M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LiquidAI/LFM2-700M
- SGLang
How to use LiquidAI/LFM2-700M 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-700M" \ --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-700M", "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-700M" \ --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-700M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LiquidAI/LFM2-700M with Docker Model Runner:
docker model run hf.co/LiquidAI/LFM2-700M
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…8d37e72
-
Update README.md
Verified signature49f3aa4
-
Fix link bar, add Discord and br tag, update Contact section
e6b5a31
-
Fix mistake also. (#8)
- Fix mistake also. (69f5174610856556ac25b3406588e8d4a68a5643) Co-authored-by: Mihai Popa <MihaiPopa-1@users.noreply.huggingface.co>50146cd
-
Update README.md
Verified signature0f3cc1c -
Update README.md
Verified signature601382d
-
Update README.md
Verified signature27eda6a
-
Update README.md
Verified signature0a4b279 -
Update README.md
Verified signature1317b70
-
Update README.md
Verified signature8820606
-
Update README.md
Verified signatured300d6a
-
Update README.md
Verified signatureab26029
-
Update README.md
Verified signaturee7e2be7 -
Update README.md
Verified signature3afb55b
-
Update Unsloth notebook
Verified signature7f09b40 -
Update README.md
Verified signatureabf2c36
-
Fix expected model inputs (#6)
Verified signature- Fix expected model inputs (b1945925cdaf2d931eae0c94de41aae4d1e7ad06) Co-authored-by: Pedro Cuenca <pcuenq@users.noreply.huggingface.co>e3facd4
-
Support pre-formatted tools (#5)
Yuri Khrustalev +1: Xenova Verified signature- Support pre-formatted tools (92772b37249914704fdef3c66fc7c5f85b9b8f9d) - Update chat_template.jinja (46562f79f4b00166db7bc25d0daf1da524a82e05) Co-authored-by: Joshua <Xenova@users.noreply.huggingface.co>0a9ce37
-
Add tool calling support to chat template (#4)
Verified signature- Add tool calling support to chat template (dd4e8e2b4bae722b939bfbc90b25bb9018ea88f5) Co-authored-by: Joshua <Xenova@users.noreply.huggingface.co>d3c36d9
-
Update README.md
Verified signature305926a
-
Update README.md
Verified signaturec0e030b -
Update README.md
Verified signature85efa52
-
Update README.md
Verified signature3e24cff
-
Update README.md
Verified signature334d328
-
Bump transformers v4.54.0.dev0
Verified signatureb4ccfb0
-
Update README.md
Verified signature5139247 -
Bump transformers source v4.54.0.dev0
Verified signaturec27bc60 -
Update README.md
Verified signature6b79710 -
Update README.md
Verified signature02ded20 -
Upload all model files
Verified signature9fdefed -
initial commit
Verified signatureed0bc4d