Text Generation
Transformers
Safetensors
gemma3
image-text-to-text
moral reasoning
value reasoning
persona
chain-of-thought
conversational
text-generation-inference
Instructions to use launch/MET-D-Gemma3-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use launch/MET-D-Gemma3-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="launch/MET-D-Gemma3-4B") 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, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("launch/MET-D-Gemma3-4B") model = AutoModelForMultimodalLM.from_pretrained("launch/MET-D-Gemma3-4B", device_map="auto") 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 Settings
- vLLM
How to use launch/MET-D-Gemma3-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "launch/MET-D-Gemma3-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "launch/MET-D-Gemma3-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/launch/MET-D-Gemma3-4B
- SGLang
How to use launch/MET-D-Gemma3-4B 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 "launch/MET-D-Gemma3-4B" \ --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": "launch/MET-D-Gemma3-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "launch/MET-D-Gemma3-4B" \ --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": "launch/MET-D-Gemma3-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use launch/MET-D-Gemma3-4B with Docker Model Runner:
docker model run hf.co/launch/MET-D-Gemma3-4B
| { | |
| "best_global_step": null, | |
| "best_metric": null, | |
| "best_model_checkpoint": null, | |
| "epoch": 0.9982905982905983, | |
| "eval_steps": 500, | |
| "global_step": 73, | |
| "is_hyper_param_search": false, | |
| "is_local_process_zero": true, | |
| "is_world_process_zero": true, | |
| "log_history": [ | |
| { | |
| "epoch": 0.13675213675213677, | |
| "grad_norm": 12.366014396004987, | |
| "learning_rate": 4.9970805670808174e-06, | |
| "loss": 0.7955, | |
| "step": 10 | |
| }, | |
| { | |
| "epoch": 0.27350427350427353, | |
| "grad_norm": 7.119569345619287, | |
| "learning_rate": 4.654924167200124e-06, | |
| "loss": 0.7791, | |
| "step": 20 | |
| }, | |
| { | |
| "epoch": 0.41025641025641024, | |
| "grad_norm": 7.338418129750288, | |
| "learning_rate": 3.819100610265332e-06, | |
| "loss": 0.8035, | |
| "step": 30 | |
| }, | |
| { | |
| "epoch": 0.5470085470085471, | |
| "grad_norm": 7.307968476806662, | |
| "learning_rate": 2.6810870004044065e-06, | |
| "loss": 0.7937, | |
| "step": 40 | |
| }, | |
| { | |
| "epoch": 0.6837606837606838, | |
| "grad_norm": 6.523804942950502, | |
| "learning_rate": 1.5015885410857617e-06, | |
| "loss": 0.8005, | |
| "step": 50 | |
| }, | |
| { | |
| "epoch": 0.8205128205128205, | |
| "grad_norm": 6.052210409126915, | |
| "learning_rate": 5.508141148419443e-07, | |
| "loss": 0.7827, | |
| "step": 60 | |
| }, | |
| { | |
| "epoch": 0.9572649572649573, | |
| "grad_norm": 6.848824598292211, | |
| "learning_rate": 4.657468465146642e-08, | |
| "loss": 0.7632, | |
| "step": 70 | |
| } | |
| ], | |
| "logging_steps": 10, | |
| "max_steps": 73, | |
| "num_input_tokens_seen": 0, | |
| "num_train_epochs": 1, | |
| "save_steps": 200, | |
| "stateful_callbacks": { | |
| "TrainerControl": { | |
| "args": { | |
| "should_epoch_stop": false, | |
| "should_evaluate": false, | |
| "should_log": false, | |
| "should_save": true, | |
| "should_training_stop": true | |
| }, | |
| "attributes": {} | |
| } | |
| }, | |
| "total_flos": 22366371643392.0, | |
| "train_batch_size": 1, | |
| "trial_name": null, | |
| "trial_params": null | |
| } | |