Instructions to use LiquidAI/LFM2-1.2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LiquidAI/LFM2-1.2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LiquidAI/LFM2-1.2B") 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-1.2B") model = AutoModelForCausalLM.from_pretrained("LiquidAI/LFM2-1.2B", 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-1.2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LiquidAI/LFM2-1.2B" # 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-1.2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LiquidAI/LFM2-1.2B
- SGLang
How to use LiquidAI/LFM2-1.2B 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-1.2B" \ --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-1.2B", "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-1.2B" \ --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-1.2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LiquidAI/LFM2-1.2B with Docker Model Runner:
docker model run hf.co/LiquidAI/LFM2-1.2B
Commit History
-
Add model-index with benchmark evaluations
Verified signatureAdded structured evaluation results from README benchmark table: **Automated Benchmarks:** - MMLU: 55.23 - GPQA: 31.47 - IFEval (Instruction following): 74.89 - IFBench: 20.7 - GSM8K (Math reasoning): 58.3 - MGSM (Multilingual math): 55.04 - MMMLU (Multilingual MMLU): 46.73 Total: 7 benchmarks across reasoning, instruction-following, and multilingual capabilities. This enables the model to appear in leaderboards and makes it easier to compare with other models. Note: PR #6 (Support tool calls) modifies the tokenizer configuration and should not conflict with this metadata addition.d20306b
-
Update README.md
Verified signaturec97ace0 -
Update README.md
Verified signature07d4be7
-
Update README.md
Verified signatureb77b5a0
-
Update README.md
Verified signature2d849dc -
Update README.md
Verified signature97b5cbb
-
Update README.md
Verified signature0843c15
-
Update README.md
Verified signature8c26bd1
-
Update README.md
Verified signature5d7e47e
-
Update README.md
Verified signature37c57c0 -
Update README.md
Verified signaturedf3f832
-
Update Unsloth notebook
Verified signaturef42a532 -
Update README.md
Verified signaturea1f2491
-
Fix expected model inputs (#15)
Verified signature- Fix expected model inputs (8ab668ab6314429ce2e6fb984f12fd6229f2aa20) Co-authored-by: Pedro Cuenca <pcuenq@users.noreply.huggingface.co>9297028
-
Update chat_template.jinja (#13)
Yuri Khrustalev +1: Xenova Verified signature- Update chat_template.jinja (bef067fc89c029dc5429655ed48b830183177f04) - Update chat_template.jinja (26bb21ffbfe2d9527e007758ddddb3700955d2af) Co-authored-by: Joshua <Xenova@users.noreply.huggingface.co>7d7fa49
-
Add tool calling support to chat template (#12)
Verified signature- Add tool calling support to chat template (574842d8446f77964131968cdcc45c8230f30558) Co-authored-by: Joshua <Xenova@users.noreply.huggingface.co>b703935
-
Update README.md
Verified signatureafebd8d
-
Update README.md
Verified signature0c3a39b -
Update README.md
Verified signatureb574915
-
Update README.md
Verified signaturef9c47ab
-
Update README.md
Verified signaturefa3dc52
-
Bump transformers v4.54.0.dev0
Verified signaturea6da5ec
-
Update README.md
Verified signature1f6a681 -
Update README.md
Verified signature4846b4e -
Bump transformers source v4.54.0.dev0
Verified signature4237495 -
Update README.md
Verified signature4e15566 -
Upload all model files
Verified signature6dae451 -
initial commit
Verified signature9275449