Image-Text-to-Text
Transformers
Safetensors
lfm2-vl
Generated from Trainer
hf_jobs
trl
sft
conversational
Instructions to use davanstrien/lfm2-vl-doab-sft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use davanstrien/lfm2-vl-doab-sft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="davanstrien/lfm2-vl-doab-sft") 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 AutoModelForMultimodalLM model = AutoModelForMultimodalLM.from_pretrained("davanstrien/lfm2-vl-doab-sft", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use davanstrien/lfm2-vl-doab-sft with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "davanstrien/lfm2-vl-doab-sft" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "davanstrien/lfm2-vl-doab-sft", "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/davanstrien/lfm2-vl-doab-sft
- SGLang
How to use davanstrien/lfm2-vl-doab-sft 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 "davanstrien/lfm2-vl-doab-sft" \ --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": "davanstrien/lfm2-vl-doab-sft", "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 "davanstrien/lfm2-vl-doab-sft" \ --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": "davanstrien/lfm2-vl-doab-sft", "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 davanstrien/lfm2-vl-doab-sft with Docker Model Runner:
docker model run hf.co/davanstrien/lfm2-vl-doab-sft
Download preprocessor_config.json from davanstrien/lfm2-vl-doab-sft: direct link, hf CLI and curl.
- Browser
- Download file 977 Bytes
-
https://huggingface.co/davanstrien/lfm2-vl-doab-sft/resolve/main/preprocessor_config.json
- Command line
-
hf download hf://davanstrien/lfm2-vl-doab-sft/preprocessor_config.json
-
curl -L -o preprocessor_config.json https://huggingface.co/davanstrien/lfm2-vl-doab-sft/resolve/main/preprocessor_config.json
977 Bytes
| { | |
| "crop_size": null, | |
| "data_format": "channels_first", | |
| "default_to_square": true, | |
| "device": null, | |
| "disable_grouping": null, | |
| "do_center_crop": null, | |
| "do_convert_rgb": null, | |
| "do_image_splitting": true, | |
| "do_normalize": true, | |
| "do_pad": true, | |
| "do_rescale": true, | |
| "do_resize": false, | |
| "downsample_factor": 2, | |
| "encoder_patch_size": 16, | |
| "image_mean": [ | |
| 0.5, | |
| 0.5, | |
| 0.5 | |
| ], | |
| "image_processor_type": "Lfm2VlImageProcessorFast", | |
| "image_std": [ | |
| 0.5, | |
| 0.5, | |
| 0.5 | |
| ], | |
| "input_data_format": null, | |
| "max_image_tokens": 256, | |
| "max_num_patches": 1024, | |
| "max_pixels_tolerance": 2.0, | |
| "max_tiles": 10, | |
| "min_image_tokens": 64, | |
| "min_tiles": 2, | |
| "pad_size": null, | |
| "patch_size": 16, | |
| "processor_class": "Lfm2VlProcessor", | |
| "resample": 3, | |
| "rescale_factor": 0.00392156862745098, | |
| "return_row_col_info": true, | |
| "return_tensors": null, | |
| "size": { | |
| "height": 512, | |
| "width": 512 | |
| }, | |
| "tile_size": 512, | |
| "use_thumbnail": true | |
| } | |