Instructions to use LiquidAI/LFM3-1.7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LiquidAI/LFM3-1.7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LiquidAI/LFM3-1.7B", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("LiquidAI/LFM3-1.7B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LiquidAI/LFM3-1.7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LiquidAI/LFM3-1.7B" # 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/LFM3-1.7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LiquidAI/LFM3-1.7B
- SGLang
How to use LiquidAI/LFM3-1.7B 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/LFM3-1.7B" \ --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/LFM3-1.7B", "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/LFM3-1.7B" \ --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/LFM3-1.7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LiquidAI/LFM3-1.7B with Docker Model Runner:
docker model run hf.co/LiquidAI/LFM3-1.7B
Got error when running and finetuning
hi , i got this error when finetuning with unsloth :
Unsloth: Failed to load model. Both AutoConfig and PeftConfig loading failed. AutoConfig error: Class 'Lfm3Config' must be a dataclass before applying @strict . PeftConfig error: Can't find 'adapter_config.json' at 'D:\aimodels\models\LiquidAILFM3-1.7B'
i got this error when i want to run :
Failed to load model: Unsloth: Failed to load model. Both AutoConfig and PeftConfig loading failed.
AutoConfig error: Class 'Lfm3Config' must be a dataclass before applying @strict .
PeftConfig error: Can't find 'adapter_config.json' at 'D:/aimodels/models/LiquidAILFM3-1.7B'
did you ask sonnet 5.5?
@mahdisml The adapter_config.json message is PEFT's fallback after AutoConfig failed; this base checkpoint is not supposed to contain an adapter config. Unsloth's LFM3 support issue is still open. First try AutoConfig.from_pretrained('LiquidAI/LFM3-1.7B', trust_remote_code=True) with plain Transformers, then share exact Unsloth and Transformers versions and the first full exception. Liquid's model card points to TRL; its linked TRL examples still show LFM2.5, so I would not copy them verbatim for LFM3.
Update from a config-only check: in clean Python 3.12 environments, plain Transformers 5.19.0 and 5.21.0 both loaded Lfm3Config with 24 layers from official revision 40ebe0aa6662c9d40389c2f5d565b6a2c6aebacd using trust_remote_code=True. This did not load weights or test training. Comparing the Hub model ID and your local directory with the same Transformers version would help isolate the failing path.