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
Browse files- config.json +3 -3
- generation_config.json +1 -4
- model.safetensors +2 -2
config.json
CHANGED
|
@@ -23,7 +23,7 @@
|
|
| 23 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 24 |
"hidden_size": 16,
|
| 25 |
"initializer_range": 0.02,
|
| 26 |
-
"intermediate_size":
|
| 27 |
"layer_types": [
|
| 28 |
"sliding_attention",
|
| 29 |
"sliding_attention"
|
|
@@ -52,8 +52,8 @@
|
|
| 52 |
"embed_dim": 64,
|
| 53 |
"hidden_act": "gelu_pytorch_tanh",
|
| 54 |
"hidden_size": 16,
|
| 55 |
-
"image_size":
|
| 56 |
-
"intermediate_size":
|
| 57 |
"layer_norm_eps": 1e-06,
|
| 58 |
"model_type": "siglip_vision_model",
|
| 59 |
"num_attention_heads": 4,
|
|
|
|
| 23 |
"hidden_activation": "gelu_pytorch_tanh",
|
| 24 |
"hidden_size": 16,
|
| 25 |
"initializer_range": 0.02,
|
| 26 |
+
"intermediate_size": 32,
|
| 27 |
"layer_types": [
|
| 28 |
"sliding_attention",
|
| 29 |
"sliding_attention"
|
|
|
|
| 52 |
"embed_dim": 64,
|
| 53 |
"hidden_act": "gelu_pytorch_tanh",
|
| 54 |
"hidden_size": 16,
|
| 55 |
+
"image_size": 224,
|
| 56 |
+
"intermediate_size": 32,
|
| 57 |
"layer_norm_eps": 1e-06,
|
| 58 |
"model_type": "siglip_vision_model",
|
| 59 |
"num_attention_heads": 4,
|
generation_config.json
CHANGED
|
@@ -1,13 +1,10 @@
|
|
| 1 |
{
|
|
|
|
| 2 |
"bos_token_id": 2,
|
| 3 |
-
"cache_implementation": "hybrid",
|
| 4 |
-
"do_sample": true,
|
| 5 |
"eos_token_id": [
|
| 6 |
1,
|
| 7 |
106
|
| 8 |
],
|
| 9 |
"pad_token_id": 0,
|
| 10 |
-
"top_k": 64,
|
| 11 |
-
"top_p": 0.95,
|
| 12 |
"transformers_version": "4.57.3"
|
| 13 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
"bos_token_id": 2,
|
|
|
|
|
|
|
| 4 |
"eos_token_id": [
|
| 5 |
1,
|
| 6 |
106
|
| 7 |
],
|
| 8 |
"pad_token_id": 0,
|
|
|
|
|
|
|
| 9 |
"transformers_version": "4.57.3"
|
| 10 |
}
|
model.safetensors
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:866c91b1e2d7f40146f4a679ff31dc7cf900afdf2fc8a880c94bbf68392fb952
|
| 3 |
+
size 8640680
|