tiny ramdom models
Collection
146 items โข Updated โข 10
How to use tiny-random/lfm3 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="tiny-random/lfm3", 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("tiny-random/lfm3", trust_remote_code=True, device_map="auto")How to use tiny-random/lfm3 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "tiny-random/lfm3"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "tiny-random/lfm3",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/tiny-random/lfm3
How to use tiny-random/lfm3 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "tiny-random/lfm3" \
--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": "tiny-random/lfm3",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "tiny-random/lfm3" \
--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": "tiny-random/lfm3",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use tiny-random/lfm3 with Docker Model Runner:
docker model run hf.co/tiny-random/lfm3
This is a randomly initialized tiny model based on 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. 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 |
Load the included pinned upstream implementation with trust_remote_code=True.
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")
This repo is generated by GPT-6.1-Sol.