Run this model with HF Jobs
Run tiny-random/lfm3-vl on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/tiny-random/lfm3-vl. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/tiny-random/lfm3-vl on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/tiny-random/lfm3-vl. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/tiny-random/lfm3-vl. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use tiny-random/lfm3-vl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tiny-random/lfm3-vl with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="tiny-random/lfm3-vl", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("tiny-random/lfm3-vl", trust_remote_code=True) model = AutoModelForMultimodalLM.from_pretrained("tiny-random/lfm3-vl", trust_remote_code=True, device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tiny-random/lfm3-vl with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tiny-random/lfm3-vl" # 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-vl", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/tiny-random/lfm3-vl
- SGLang
How to use tiny-random/lfm3-vl 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 "tiny-random/lfm3-vl" \ --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-vl", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "tiny-random/lfm3-vl" \ --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-vl", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use tiny-random/lfm3-vl with Docker Model Runner:
docker model run hf.co/tiny-random/lfm3-vl
Download .meta/model.log from tiny-random/lfm3-vl: direct link, hf CLI and curl.
- Browser
- Download file 13.4 kB
-
https://huggingface.co/tiny-random/lfm3-vl/resolve/main/.meta/model.log
- Command line
-
hf download hf://tiny-random/lfm3-vl/.meta/model.log
-
curl -L -o model.log https://huggingface.co/tiny-random/lfm3-vl/resolve/main/.meta/model.log
13.4 kB
| Lfm3VlForConditionalGeneration( | |
| (model): Lfm3VlModel( | |
| (vision_tower): Lfm3VlVisionModel( | |
| (patchifier): Linear(in_features=1536, out_features=256, bias=False) | |
| (embedding_norm): Lfm3VlRMSNorm((256,), eps=1e-05) | |
| (rotary_pos_emb): Lfm3VlVisionRotaryEmbedding() | |
| (layers): ModuleList( | |
| (0-1): 2 x Lfm3VlVisionLayer( | |
| (conv): Lfm3VlVisionConv2d( | |
| (in_proj): Linear(in_features=256, out_features=768, bias=False) | |
| (spatial_conv): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=256, bias=False) | |
| (out_proj): Linear(in_features=256, out_features=256, bias=False) | |
| ) | |
| (feed_forward): Lfm3VlMLP( | |
| (w1): Linear(in_features=256, out_features=640, bias=False) | |
| (w3): Linear(in_features=256, out_features=640, bias=False) | |
| (w2): Linear(in_features=640, out_features=256, bias=False) | |
| ) | |
| (operator_norm): Lfm3VlRMSNorm((256,), eps=1e-05) | |
| (ffn_norm): Lfm3VlRMSNorm((256,), eps=1e-05) | |
| ) | |
| (2): Lfm3VlVisionLayer( | |
| (self_attn): Lfm3VlVisionAttention( | |
| (q_proj): Linear(in_features=256, out_features=256, bias=False) | |
| (k_proj): Linear(in_features=256, out_features=128, bias=False) | |
| (v_proj): Linear(in_features=256, out_features=128, bias=False) | |
| (out_proj): Linear(in_features=256, out_features=256, bias=False) | |
| (q_layernorm): Lfm3VlRMSNorm((32,), eps=1e-05) | |
| (k_layernorm): Lfm3VlRMSNorm((32,), eps=1e-05) | |
| ) | |
| (feed_forward): Lfm3VlMLP( | |
| (w1): Linear(in_features=256, out_features=640, bias=False) | |
| (w3): Linear(in_features=256, out_features=640, bias=False) | |
| (w2): Linear(in_features=640, out_features=256, bias=False) | |
| ) | |
| (operator_norm): Lfm3VlRMSNorm((256,), eps=1e-05) | |
| (ffn_norm): Lfm3VlRMSNorm((256,), eps=1e-05) | |
| ) | |
| (3): Lfm3VlVisionLayer( | |
| (conv): Lfm3VlVisionConv2d( | |
| (in_proj): Linear(in_features=256, out_features=768, bias=False) | |
| (spatial_conv): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=256, bias=False) | |
| (out_proj): Linear(in_features=256, out_features=256, bias=False) | |
| ) | |
| (feed_forward): Lfm3VlMLP( | |
| (w1): Linear(in_features=256, out_features=640, bias=False) | |
| (w3): Linear(in_features=256, out_features=640, bias=False) | |
| (w2): Linear(in_features=640, out_features=256, bias=False) | |
| ) | |
| (operator_norm): Lfm3VlRMSNorm((256,), eps=1e-05) | |
| (ffn_norm): Lfm3VlRMSNorm((256,), eps=1e-05) | |
| ) | |
| (4): Lfm3VlVisionLayer( | |
| (self_attn): Lfm3VlVisionAttention( | |
| (q_proj): Linear(in_features=256, out_features=256, bias=False) | |
| (k_proj): Linear(in_features=256, out_features=128, bias=False) | |
| (v_proj): Linear(in_features=256, out_features=128, bias=False) | |
| (out_proj): Linear(in_features=256, out_features=256, bias=False) | |
| (q_layernorm): Lfm3VlRMSNorm((32,), eps=1e-05) | |
| (k_layernorm): Lfm3VlRMSNorm((32,), eps=1e-05) | |
| ) | |
| (feed_forward): Lfm3VlMLP( | |
| (w1): Linear(in_features=256, out_features=640, bias=False) | |
| (w3): Linear(in_features=256, out_features=640, bias=False) | |
| (w2): Linear(in_features=640, out_features=256, bias=False) | |
| ) | |
| (operator_norm): Lfm3VlRMSNorm((256,), eps=1e-05) | |
| (ffn_norm): Lfm3VlRMSNorm((256,), eps=1e-05) | |
| ) | |
| (5): Lfm3VlVisionLayer( | |
| (conv): Lfm3VlVisionConv2d( | |
| (in_proj): Linear(in_features=256, out_features=768, bias=False) | |
| (spatial_conv): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), groups=256, bias=False) | |
| (out_proj): Linear(in_features=256, out_features=256, bias=False) | |
| ) | |
| (feed_forward): Lfm3VlMLP( | |
| (w1): Linear(in_features=256, out_features=640, bias=False) | |
| (w3): Linear(in_features=256, out_features=640, bias=False) | |
| (w2): Linear(in_features=640, out_features=256, bias=False) | |
| ) | |
| (operator_norm): Lfm3VlRMSNorm((256,), eps=1e-05) | |
| (ffn_norm): Lfm3VlRMSNorm((256,), eps=1e-05) | |
| ) | |
| ) | |
| ) | |
| (multi_modal_projector): Lfm3VlMultiModalProjector( | |
| (layer_norm): LayerNorm((256,), eps=1e-06, elementwise_affine=True, bias=True) | |
| (linear_1): Linear(in_features=1024, out_features=128, bias=True) | |
| (act): GELUActivation() | |
| (linear_2): Linear(in_features=128, out_features=64, bias=True) | |
| ) | |
| (language_model): Lfm3Model( | |
| (embed_tokens): Embedding(128000, 64, padding_idx=124893) | |
| (layers): ModuleList( | |
| (0-1): 2 x Lfm3DecoderLayer( | |
| (conv): Lfm3ShortConv( | |
| (conv): Conv1d(64, 64, kernel_size=(7,), stride=(1,), padding=(6,), groups=64, bias=False) | |
| (in_proj): Linear(in_features=64, out_features=192, bias=False) | |
| (out_proj): Linear(in_features=64, out_features=64, bias=False) | |
| ) | |
| (feed_forward): Lfm3MLP( | |
| (w1): Linear(in_features=64, out_features=128, bias=False) | |
| (w3): Linear(in_features=64, out_features=128, bias=False) | |
| (w2): Linear(in_features=128, out_features=64, bias=False) | |
| ) | |
| (operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| ) | |
| (2): Lfm3DecoderLayer( | |
| (self_attn): Lfm3Attention( | |
| (q_proj): Linear(in_features=64, out_features=512, bias=False) | |
| (k_proj): Linear(in_features=64, out_features=128, bias=False) | |
| (v_proj): Linear(in_features=64, out_features=128, bias=False) | |
| (o_proj): Linear(in_features=512, out_features=64, bias=False) | |
| (q_norm): Lfm3RMSNorm((32,), eps=1e-05) | |
| (k_norm): Lfm3RMSNorm((32,), eps=1e-05) | |
| (gate_proj): Linear(in_features=64, out_features=16, bias=False) | |
| ) | |
| (feed_forward): Lfm3MLP( | |
| (w1): Linear(in_features=64, out_features=128, bias=False) | |
| (w3): Linear(in_features=64, out_features=128, bias=False) | |
| (w2): Linear(in_features=128, out_features=64, bias=False) | |
| ) | |
| (operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| ) | |
| (3): Lfm3DecoderLayer( | |
| (conv): Lfm3ShortConv( | |
| (conv): Conv1d(64, 64, kernel_size=(7,), stride=(1,), padding=(6,), groups=64, bias=False) | |
| (in_proj): Linear(in_features=64, out_features=192, bias=False) | |
| (out_proj): Linear(in_features=64, out_features=64, bias=False) | |
| ) | |
| (feed_forward): Lfm3MLP( | |
| (w1): Linear(in_features=64, out_features=128, bias=False) | |
| (w3): Linear(in_features=64, out_features=128, bias=False) | |
| (w2): Linear(in_features=128, out_features=64, bias=False) | |
| ) | |
| (operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| ) | |
| (4): Lfm3DecoderLayer( | |
| (self_attn): Lfm3Attention( | |
| (q_proj): Linear(in_features=64, out_features=512, bias=False) | |
| (k_proj): Linear(in_features=64, out_features=128, bias=False) | |
| (v_proj): Linear(in_features=64, out_features=128, bias=False) | |
| (o_proj): Linear(in_features=512, out_features=64, bias=False) | |
| (q_norm): Lfm3RMSNorm((32,), eps=1e-05) | |
| (k_norm): Lfm3RMSNorm((32,), eps=1e-05) | |
| (gate_proj): Linear(in_features=64, out_features=16, bias=False) | |
| ) | |
| (feed_forward): Lfm3MLP( | |
| (w1): Linear(in_features=64, out_features=128, bias=False) | |
| (w3): Linear(in_features=64, out_features=128, bias=False) | |
| (w2): Linear(in_features=128, out_features=64, bias=False) | |
| ) | |
| (operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| ) | |
| (5): Lfm3DecoderLayer( | |
| (conv): Lfm3ShortConv( | |
| (conv): Conv1d(64, 64, kernel_size=(7,), stride=(1,), padding=(6,), groups=64, bias=False) | |
| (in_proj): Linear(in_features=64, out_features=192, bias=False) | |
| (out_proj): Linear(in_features=64, out_features=64, bias=False) | |
| ) | |
| (feed_forward): Lfm3MLP( | |
| (w1): Linear(in_features=64, out_features=128, bias=False) | |
| (w3): Linear(in_features=64, out_features=128, bias=False) | |
| (w2): Linear(in_features=128, out_features=64, bias=False) | |
| ) | |
| (operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| ) | |
| (6): Lfm3DecoderLayer( | |
| (self_attn): Lfm3Attention( | |
| (q_proj): Linear(in_features=64, out_features=512, bias=False) | |
| (k_proj): Linear(in_features=64, out_features=128, bias=False) | |
| (v_proj): Linear(in_features=64, out_features=128, bias=False) | |
| (o_proj): Linear(in_features=512, out_features=64, bias=False) | |
| (q_norm): Lfm3RMSNorm((32,), eps=1e-05) | |
| (k_norm): Lfm3RMSNorm((32,), eps=1e-05) | |
| (gate_proj): Linear(in_features=64, out_features=16, bias=False) | |
| ) | |
| (feed_forward): Lfm3MLP( | |
| (w1): Linear(in_features=64, out_features=128, bias=False) | |
| (w3): Linear(in_features=64, out_features=128, bias=False) | |
| (w2): Linear(in_features=128, out_features=64, bias=False) | |
| ) | |
| (operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| ) | |
| (7): Lfm3DecoderLayer( | |
| (conv): Lfm3ShortConv( | |
| (conv): Conv1d(64, 64, kernel_size=(7,), stride=(1,), padding=(6,), groups=64, bias=False) | |
| (in_proj): Linear(in_features=64, out_features=192, bias=False) | |
| (out_proj): Linear(in_features=64, out_features=64, bias=False) | |
| ) | |
| (feed_forward): Lfm3MLP( | |
| (w1): Linear(in_features=64, out_features=128, bias=False) | |
| (w3): Linear(in_features=64, out_features=128, bias=False) | |
| (w2): Linear(in_features=128, out_features=64, bias=False) | |
| ) | |
| (operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| ) | |
| (8): Lfm3DecoderLayer( | |
| (self_attn): Lfm3Attention( | |
| (q_proj): Linear(in_features=64, out_features=512, bias=False) | |
| (k_proj): Linear(in_features=64, out_features=128, bias=False) | |
| (v_proj): Linear(in_features=64, out_features=128, bias=False) | |
| (o_proj): Linear(in_features=512, out_features=64, bias=False) | |
| (q_norm): Lfm3RMSNorm((32,), eps=1e-05) | |
| (k_norm): Lfm3RMSNorm((32,), eps=1e-05) | |
| (gate_proj): Linear(in_features=64, out_features=16, bias=False) | |
| ) | |
| (feed_forward): Lfm3MLP( | |
| (w1): Linear(in_features=64, out_features=128, bias=False) | |
| (w3): Linear(in_features=64, out_features=128, bias=False) | |
| (w2): Linear(in_features=128, out_features=64, bias=False) | |
| ) | |
| (operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| ) | |
| (9): Lfm3DecoderLayer( | |
| (conv): Lfm3ShortConv( | |
| (conv): Conv1d(64, 64, kernel_size=(7,), stride=(1,), padding=(6,), groups=64, bias=False) | |
| (in_proj): Linear(in_features=64, out_features=192, bias=False) | |
| (out_proj): Linear(in_features=64, out_features=64, bias=False) | |
| ) | |
| (feed_forward): Lfm3MLP( | |
| (w1): Linear(in_features=64, out_features=128, bias=False) | |
| (w3): Linear(in_features=64, out_features=128, bias=False) | |
| (w2): Linear(in_features=128, out_features=64, bias=False) | |
| ) | |
| (operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_operator_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| (post_ffn_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| ) | |
| ) | |
| (rotary_emb): Lfm3RotaryEmbedding() | |
| (embedding_norm): Lfm3RMSNorm((64,), eps=1e-05) | |
| ) | |
| ) | |
| (lm_head): Linear(in_features=64, out_features=128000, bias=False) | |
| ) |