Instructions to use trl-internal-testing/tiny-PaliGemmaForConditionalGeneration with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trl-internal-testing/tiny-PaliGemmaForConditionalGeneration with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="trl-internal-testing/tiny-PaliGemmaForConditionalGeneration")# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("trl-internal-testing/tiny-PaliGemmaForConditionalGeneration") model = AutoModelForImageTextToText.from_pretrained("trl-internal-testing/tiny-PaliGemmaForConditionalGeneration") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use trl-internal-testing/tiny-PaliGemmaForConditionalGeneration with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "trl-internal-testing/tiny-PaliGemmaForConditionalGeneration" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-PaliGemmaForConditionalGeneration", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/trl-internal-testing/tiny-PaliGemmaForConditionalGeneration
- SGLang
How to use trl-internal-testing/tiny-PaliGemmaForConditionalGeneration 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 "trl-internal-testing/tiny-PaliGemmaForConditionalGeneration" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-PaliGemmaForConditionalGeneration", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "trl-internal-testing/tiny-PaliGemmaForConditionalGeneration" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-PaliGemmaForConditionalGeneration", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use trl-internal-testing/tiny-PaliGemmaForConditionalGeneration with Docker Model Runner:
docker model run hf.co/trl-internal-testing/tiny-PaliGemmaForConditionalGeneration
File size: 1,438 Bytes
0989d5f 2cb3712 2c7bec0 2cb3712 0989d5f 2cb3712 0989d5f 2cb3712 0989d5f e65b9bd 8a1afeb e65b9bd f69c7f9 b4eeae1 e65b9bd 2cb3712 8a1afeb e65b9bd 0989d5f 2cb3712 0989d5f e65b9bd 2cb3712 0989d5f f69c7f9 0989d5f e65b9bd 07fd1ad e65b9bd b4eeae1 e65b9bd 2cb3712 e65b9bd 0989d5f e65b9bd 0989d5f 2cb3712 0989d5f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | {
"architectures": [
"PaliGemmaForConditionalGeneration"
],
"bos_token_id": 2,
"dtype": "float32",
"eos_token_id": 1,
"hidden_size": 2048,
"ignore_index": -100,
"image_token_index": 257152,
"model_type": "paligemma",
"pad_token_id": 0,
"projection_dim": 2048,
"text_config": {
"attention_bias": false,
"attention_dropout": 0.0,
"dtype": "float32",
"head_dim": 256,
"hidden_act": "gelu_pytorch_tanh",
"hidden_activation": null,
"hidden_size": 16,
"initializer_range": 0.02,
"intermediate_size": 16384,
"layer_types": null,
"max_position_embeddings": 8192,
"model_type": "gemma",
"num_attention_heads": 4,
"num_hidden_layers": 2,
"num_image_tokens": 256,
"num_key_value_heads": 2,
"rms_norm_eps": 1e-06,
"rope_theta": 10000.0,
"use_cache": true,
"vocab_size": 257216
},
"transformers_version": "4.57.3",
"vision_config": {
"attention_dropout": 0.0,
"embed_dim": 64,
"hidden_act": "gelu_pytorch_tanh",
"hidden_size": 16,
"image_size": 224,
"intermediate_size": 4304,
"layer_norm_eps": 1e-06,
"model_type": "siglip_vision_model",
"num_attention_heads": 4,
"num_channels": 3,
"num_hidden_layers": 2,
"num_image_tokens": 256,
"num_key_value_heads": 2,
"patch_size": 14,
"projection_dim": 2048,
"projector_hidden_act": "gelu_fast",
"vision_use_head": false
}
}
|