Text Generation
Transformers
Safetensors
lfm2_moe
liquid
lfm2
edge
Mixture of Experts
conversational
Instructions to use LiquidAI/LFM2-8B-A1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LiquidAI/LFM2-8B-A1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LiquidAI/LFM2-8B-A1B") 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-8B-A1B") model = AutoModelForCausalLM.from_pretrained("LiquidAI/LFM2-8B-A1B", 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-8B-A1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LiquidAI/LFM2-8B-A1B" # 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-8B-A1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LiquidAI/LFM2-8B-A1B
- SGLang
How to use LiquidAI/LFM2-8B-A1B 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-8B-A1B" \ --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-8B-A1B", "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-8B-A1B" \ --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-8B-A1B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LiquidAI/LFM2-8B-A1B with Docker Model Runner:
docker model run hf.co/LiquidAI/LFM2-8B-A1B
Commit History
-
Fix chat template: render assistant tool_calls (#10)
- Fix chat template: render assistant tool_calls (d0fa5f956a24834abb8fce10c275c3bbf410105c) Co-authored-by: nathan ranchin <nathanrchn@users.noreply.huggingface.co>c1c44ff
-
Update README.md
Verified signaturef9f0db8
-
Update README.md
Verified signature580a69a
-
Fix Try LFM link to use playground.liquid.ai homepage
13eb3eb -
Add Discord community link to README
fd34853
-
Update README.md
Verified signaturee2277e4
-
Update README.md
Verified signaturedd4bd83
-
Update README.md
Verified signature458d938
-
Delete model-00007-of-00007.safetensors
Verified signaturebce14d3 -
Delete model-00006-of-00007.safetensors
Verified signature5140b5c -
Delete model-00005-of-00007.safetensors
Verified signaturebb2a5f7 -
Delete model-00004-of-00007.safetensors
Verified signature624e636 -
Delete model-00003-of-00007.safetensors
Verified signature4ca0edf -
Delete model-00002-of-00007.safetensors
Verified signaturead374ae -
Delete model-00001-of-00007.safetensors
Verified signature2cb112a
-
Update README.md
Verified signature6df6a75 -
Update README.md
Verified signature70e1859
-
Update README.md
Verified signature533e6f1 -
Update README.md
Verified signature8ddc46f -
Update README.md
Verified signature7b3501b -
Update README.md
Verified signatureecbfe07 -
Update README.md
Verified signaturecb6816b -
Update README.md
Verified signatureb1fc81f
-
Update README.md
Verified signature86aa556
-
Upload local dir
Verified signature03a51b7
-
Update config.json
Verified signature5606e3d -
Update config.json
Verified signature4e7cfae
-
fix image
Verified signaturec08ac25 -
fix typo
Verified signaturea62c8a1
-
Update README.md
Verified signature19a7cba -
Add files using upload-large-folder tool
Verified signature4846f70 -
initial commit
Verified signatureb5e6fc8