Instructions to use yujiepan/lfm3-tiny-random with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yujiepan/lfm3-tiny-random with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yujiepan/lfm3-tiny-random", trust_remote_code=True) 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("yujiepan/lfm3-tiny-random", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("yujiepan/lfm3-tiny-random", trust_remote_code=True, 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 yujiepan/lfm3-tiny-random with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yujiepan/lfm3-tiny-random" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yujiepan/lfm3-tiny-random", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yujiepan/lfm3-tiny-random
- SGLang
How to use yujiepan/lfm3-tiny-random 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 "yujiepan/lfm3-tiny-random" \ --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": "yujiepan/lfm3-tiny-random", "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 "yujiepan/lfm3-tiny-random" \ --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": "yujiepan/lfm3-tiny-random", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use yujiepan/lfm3-tiny-random with Docker Model Runner:
docker model run hf.co/yujiepan/lfm3-tiny-random
|
Download README.md from yujiepan/lfm3-tiny-random: direct link, hf CLI and curl.
- Browser
- Download file 2.96 kB
-
https://huggingface.co/yujiepan/lfm3-tiny-random/resolve/main/README.md
- Command line
-
hf download hf://yujiepan/lfm3-tiny-random/README.md
-
curl -L -o README.md https://huggingface.co/yujiepan/lfm3-tiny-random/resolve/main/README.md
2.96 kB
| library_name: transformers | |
| pipeline_tag: text-generation | |
| base_model: | |
| - LiquidAI/LFM3-1.7B | |
| This is a randomly initialized tiny model based on [LiquidAI/LFM3-1.7B](https://huggingface.co/LiquidAI/LFM3-1.7B) for testing and debugging. | |
| | Feature | Source | This repo | | |
| |---|---|---| | |
| | Checkpoint tensor elements | 1.73B BF16 | 8.62M BF16 | | |
| | Safetensors weight files | 3.46 GB (model.safetensors) | 17.26 MB (model.safetensors) | | |
| | Layers / layer-type cycle | 24 / two-conv prefix, then full/conv/sliding/conv | 10 / same prefix and two complete cycles | | |
| | Hidden width / MLP width | 2,048 / 7,680 | 64 / 128 | | |
| | Q heads / KV heads / head_dim | 16 / 4 / 128 | 4 / 1 / 32 | | |
| | Short-conv kernel / cache | 7 / 7 | Same | | |
| | RoPE | full 0.5 partial, theta 1e6; sliding theta 1e4 | Same | | |
| | Sandwich norms / QK RMSNorm / sigmoid head gate | present | Same | | |
| | Vocabulary rows / embedding tying | 128,000 / tied | Same | | |
| | Maximum context length | 262,144 | 128,000 | | |
| | Stored precision | BF16 | Same | | |
| Residual width 64 and MLP width 128 follow [tiny-random/lfm2](https://huggingface.co/tiny-random/lfm2). The pinned upstream implementation is included for Transformers loading. This repo provides a Transformers example; no serving-backend validation is claimed. | |
| | File path | Size | | |
| |------|------| | |
| | model.safetensors | 17.3MB | | |
| ### Example usage | |
| #### Transformers (✅ verified) | |
| Load the included pinned upstream implementation with `trust_remote_code=True`. | |
| ```python | |
| def run_transformers(model_id: str): | |
| import torch | |
| from transformers import AutoModelForCausalLM, AutoTokenizer | |
| model_id = str(model_id) | |
| tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True) | |
| model = ( | |
| AutoModelForCausalLM.from_pretrained( | |
| model_id, trust_remote_code=True, dtype=torch.bfloat16, attn_implementation="sdpa" | |
| ) | |
| .eval() | |
| .cuda() | |
| ) | |
| inputs = tokenizer.apply_chat_template( | |
| [{"role": "user", "content": "What is C. elegans?"}], | |
| add_generation_prompt=True, | |
| return_tensors="pt", | |
| return_dict=True, | |
| enable_thinking=False, | |
| ).to(model.device) | |
| with torch.no_grad(): | |
| logits = model(**inputs).logits | |
| assert torch.isfinite(logits).all() | |
| output = model.generate(**inputs, do_sample=False, max_new_tokens=32) | |
| print(tokenizer.decode(output[0, inputs["input_ids"].shape[1] :], skip_special_tokens=False)) | |
| if __name__ == "__main__": | |
| run_transformers(model_id="tiny-random/lfm3") | |
| ``` | |
| ### Creating this repo | |
| - Code: [.meta/create_model.py](.meta/create_model.py) | |
| - Model structure: [.meta/model.log](.meta/model.log) | |
| - Environment: [.meta/env.json](.meta/env.json) | |
| ### Change log | |
| - 2026-10-30: Initial version. | |
| - 2026-10-31: Resize to hidden width 64 and MLP width 128, following tiny-random/lfm2; use four Q heads and one KV head while preserving the LFM3 layer cadence. | |
| *This repo is generated by GPT-6.1-Sol.* |