Instructions to use trl-internal-testing/tiny-Gemma3ForConditionalGeneration with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trl-internal-testing/tiny-Gemma3ForConditionalGeneration 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-Gemma3ForConditionalGeneration") 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)# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("trl-internal-testing/tiny-Gemma3ForConditionalGeneration") model = AutoModelForImageTextToText.from_pretrained("trl-internal-testing/tiny-Gemma3ForConditionalGeneration") 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use trl-internal-testing/tiny-Gemma3ForConditionalGeneration 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-Gemma3ForConditionalGeneration" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-Gemma3ForConditionalGeneration", "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/trl-internal-testing/tiny-Gemma3ForConditionalGeneration
- SGLang
How to use trl-internal-testing/tiny-Gemma3ForConditionalGeneration 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-Gemma3ForConditionalGeneration" \ --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": "trl-internal-testing/tiny-Gemma3ForConditionalGeneration", "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 "trl-internal-testing/tiny-Gemma3ForConditionalGeneration" \ --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": "trl-internal-testing/tiny-Gemma3ForConditionalGeneration", "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 trl-internal-testing/tiny-Gemma3ForConditionalGeneration with Docker Model Runner:
docker model run hf.co/trl-internal-testing/tiny-Gemma3ForConditionalGeneration
Upload Gemma3ForConditionalGeneration
#3
by albertvillanova HF Staff - opened
- config.json +2 -34
- generation_config.json +1 -1
- model.safetensors +1 -1
config.json
CHANGED
|
@@ -3,6 +3,7 @@
|
|
| 3 |
"Gemma3ForConditionalGeneration"
|
| 4 |
],
|
| 5 |
"boi_token_index": 255999,
|
|
|
|
| 6 |
"eoi_token_index": 256000,
|
| 7 |
"eos_token_id": [
|
| 8 |
1,
|
|
@@ -24,38 +25,6 @@
|
|
| 24 |
"initializer_range": 0.02,
|
| 25 |
"intermediate_size": 10240,
|
| 26 |
"layer_types": [
|
| 27 |
-
"sliding_attention",
|
| 28 |
-
"sliding_attention",
|
| 29 |
-
"sliding_attention",
|
| 30 |
-
"sliding_attention",
|
| 31 |
-
"sliding_attention",
|
| 32 |
-
"full_attention",
|
| 33 |
-
"sliding_attention",
|
| 34 |
-
"sliding_attention",
|
| 35 |
-
"sliding_attention",
|
| 36 |
-
"sliding_attention",
|
| 37 |
-
"sliding_attention",
|
| 38 |
-
"full_attention",
|
| 39 |
-
"sliding_attention",
|
| 40 |
-
"sliding_attention",
|
| 41 |
-
"sliding_attention",
|
| 42 |
-
"sliding_attention",
|
| 43 |
-
"sliding_attention",
|
| 44 |
-
"full_attention",
|
| 45 |
-
"sliding_attention",
|
| 46 |
-
"sliding_attention",
|
| 47 |
-
"sliding_attention",
|
| 48 |
-
"sliding_attention",
|
| 49 |
-
"sliding_attention",
|
| 50 |
-
"full_attention",
|
| 51 |
-
"sliding_attention",
|
| 52 |
-
"sliding_attention",
|
| 53 |
-
"sliding_attention",
|
| 54 |
-
"sliding_attention",
|
| 55 |
-
"sliding_attention",
|
| 56 |
-
"full_attention",
|
| 57 |
-
"sliding_attention",
|
| 58 |
-
"sliding_attention",
|
| 59 |
"sliding_attention",
|
| 60 |
"sliding_attention"
|
| 61 |
],
|
|
@@ -76,8 +45,7 @@
|
|
| 76 |
"use_cache": true,
|
| 77 |
"vocab_size": 262208
|
| 78 |
},
|
| 79 |
-
"
|
| 80 |
-
"transformers_version": "4.56.0.dev0",
|
| 81 |
"vision_config": {
|
| 82 |
"attention_dropout": 0.0,
|
| 83 |
"hidden_act": "gelu_pytorch_tanh",
|
|
|
|
| 3 |
"Gemma3ForConditionalGeneration"
|
| 4 |
],
|
| 5 |
"boi_token_index": 255999,
|
| 6 |
+
"dtype": "bfloat16",
|
| 7 |
"eoi_token_index": 256000,
|
| 8 |
"eos_token_id": [
|
| 9 |
1,
|
|
|
|
| 25 |
"initializer_range": 0.02,
|
| 26 |
"intermediate_size": 10240,
|
| 27 |
"layer_types": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
"sliding_attention",
|
| 29 |
"sliding_attention"
|
| 30 |
],
|
|
|
|
| 45 |
"use_cache": true,
|
| 46 |
"vocab_size": 262208
|
| 47 |
},
|
| 48 |
+
"transformers_version": "4.56.1",
|
|
|
|
| 49 |
"vision_config": {
|
| 50 |
"attention_dropout": 0.0,
|
| 51 |
"hidden_act": "gelu_pytorch_tanh",
|
generation_config.json
CHANGED
|
@@ -6,5 +6,5 @@
|
|
| 6 |
106
|
| 7 |
],
|
| 8 |
"pad_token_id": 0,
|
| 9 |
-
"transformers_version": "4.56.
|
| 10 |
}
|
|
|
|
| 6 |
106
|
| 7 |
],
|
| 8 |
"pad_token_id": 0,
|
| 9 |
+
"transformers_version": "4.56.1"
|
| 10 |
}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 11287536
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:56dc37066c675420391d220a2ed601068b2eb092ed96d8e8d2ba4cd1f9de8e97
|
| 3 |
size 11287536
|