Image-Text-to-Text
Transformers
ONNX
Safetensors
Transformers.js
paligemma
text-generation-inference
Instructions to use hf-internal-testing/tiny-random-PaliGemmaForConditionalGeneration with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hf-internal-testing/tiny-random-PaliGemmaForConditionalGeneration with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="hf-internal-testing/tiny-random-PaliGemmaForConditionalGeneration")# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("hf-internal-testing/tiny-random-PaliGemmaForConditionalGeneration") model = AutoModelForImageTextToText.from_pretrained("hf-internal-testing/tiny-random-PaliGemmaForConditionalGeneration") - Transformers.js
How to use hf-internal-testing/tiny-random-PaliGemmaForConditionalGeneration with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-text-to-text', 'hf-internal-testing/tiny-random-PaliGemmaForConditionalGeneration'); - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use hf-internal-testing/tiny-random-PaliGemmaForConditionalGeneration with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hf-internal-testing/tiny-random-PaliGemmaForConditionalGeneration" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hf-internal-testing/tiny-random-PaliGemmaForConditionalGeneration", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/hf-internal-testing/tiny-random-PaliGemmaForConditionalGeneration
- SGLang
How to use hf-internal-testing/tiny-random-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 "hf-internal-testing/tiny-random-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": "hf-internal-testing/tiny-random-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 "hf-internal-testing/tiny-random-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": "hf-internal-testing/tiny-random-PaliGemmaForConditionalGeneration", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use hf-internal-testing/tiny-random-PaliGemmaForConditionalGeneration with Docker Model Runner:
docker model run hf.co/hf-internal-testing/tiny-random-PaliGemmaForConditionalGeneration
Upload 11 files
#5
by Xenova HF Staff - opened
- config.json +6 -5
- generation_config.json +1 -1
- onnx/decoder_model_merged.onnx +2 -2
- onnx/vision_encoder.onnx +1 -1
config.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
| 1 |
{
|
|
|
|
|
|
|
| 2 |
"_vocab_size": 257152,
|
| 3 |
"architectures": [
|
| 4 |
"PaliGemmaForConditionalGeneration"
|
|
@@ -11,19 +13,18 @@
|
|
| 11 |
"pad_token_id": 0,
|
| 12 |
"projection_dim": 16,
|
| 13 |
"text_config": {
|
| 14 |
-
"head_dim": 256,
|
| 15 |
"hidden_size": 16,
|
| 16 |
"intermediate_size": 16,
|
| 17 |
"model_type": "gemma",
|
| 18 |
-
"max_position_embeddings": 8192,
|
| 19 |
"num_attention_heads": 4,
|
| 20 |
"num_hidden_layers": 2,
|
| 21 |
"num_image_tokens": 256,
|
| 22 |
"num_key_value_heads": 1,
|
| 23 |
-
"vocab_size": 257216
|
|
|
|
| 24 |
},
|
| 25 |
"torch_dtype": "float32",
|
| 26 |
-
"transformers_version": "4.
|
| 27 |
"vision_config": {
|
| 28 |
"hidden_size": 16,
|
| 29 |
"intermediate_size": 32,
|
|
@@ -36,4 +37,4 @@
|
|
| 36 |
"projector_hidden_act": "gelu_fast",
|
| 37 |
"vision_use_head": false
|
| 38 |
}
|
| 39 |
-
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"_attn_implementation_autoset": true,
|
| 3 |
+
"_name_or_path": "Xenova/tiny-random-PaliGemmaForConditionalGeneration",
|
| 4 |
"_vocab_size": 257152,
|
| 5 |
"architectures": [
|
| 6 |
"PaliGemmaForConditionalGeneration"
|
|
|
|
| 13 |
"pad_token_id": 0,
|
| 14 |
"projection_dim": 16,
|
| 15 |
"text_config": {
|
|
|
|
| 16 |
"hidden_size": 16,
|
| 17 |
"intermediate_size": 16,
|
| 18 |
"model_type": "gemma",
|
|
|
|
| 19 |
"num_attention_heads": 4,
|
| 20 |
"num_hidden_layers": 2,
|
| 21 |
"num_image_tokens": 256,
|
| 22 |
"num_key_value_heads": 1,
|
| 23 |
+
"vocab_size": 257216,
|
| 24 |
+
"head_dim": 256
|
| 25 |
},
|
| 26 |
"torch_dtype": "float32",
|
| 27 |
+
"transformers_version": "4.48.0.dev0",
|
| 28 |
"vision_config": {
|
| 29 |
"hidden_size": 16,
|
| 30 |
"intermediate_size": 32,
|
|
|
|
| 37 |
"projector_hidden_act": "gelu_fast",
|
| 38 |
"vision_use_head": false
|
| 39 |
}
|
| 40 |
+
}
|
generation_config.json
CHANGED
|
@@ -3,5 +3,5 @@
|
|
| 3 |
"bos_token_id": 2,
|
| 4 |
"eos_token_id": 1,
|
| 5 |
"pad_token_id": 0,
|
| 6 |
-
"transformers_version": "4.
|
| 7 |
}
|
|
|
|
| 3 |
"bos_token_id": 2,
|
| 4 |
"eos_token_id": 1,
|
| 5 |
"pad_token_id": 0,
|
| 6 |
+
"transformers_version": "4.48.0.dev0"
|
| 7 |
}
|
onnx/decoder_model_merged.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f94b7e5203e77a7a1b0b2887556753aabd2416aeda7b855d1b43398c97ff1f29
|
| 3 |
+
size 16861777
|
onnx/vision_encoder.onnx
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 120673
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:916d69fe0fcf0204bf55d293e30ecff6bb62b6d022fae6bcfc7dae039e3a6497
|
| 3 |
size 120673
|