Image-Text-to-Text
Transformers
Safetensors
gemma4
coder
coding
merged-lora
kaggle-proof
conversational
Instructions to use josephmayo/gemma-4-E4B-it-Coder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use josephmayo/gemma-4-E4B-it-Coder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="josephmayo/gemma-4-E4B-it-Coder") 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("josephmayo/gemma-4-E4B-it-Coder") model = AutoModelForImageTextToText.from_pretrained("josephmayo/gemma-4-E4B-it-Coder") 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 josephmayo/gemma-4-E4B-it-Coder with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "josephmayo/gemma-4-E4B-it-Coder" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "josephmayo/gemma-4-E4B-it-Coder", "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/josephmayo/gemma-4-E4B-it-Coder
- SGLang
How to use josephmayo/gemma-4-E4B-it-Coder 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 "josephmayo/gemma-4-E4B-it-Coder" \ --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": "josephmayo/gemma-4-E4B-it-Coder", "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 "josephmayo/gemma-4-E4B-it-Coder" \ --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": "josephmayo/gemma-4-E4B-it-Coder", "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 josephmayo/gemma-4-E4B-it-Coder with Docker Model Runner:
docker model run hf.co/josephmayo/gemma-4-E4B-it-Coder
| { | |
| "run_id": "20260512_190433", | |
| "model_id": "google/gemma-4-E4B-it", | |
| "dataset_id": "ise-uiuc/Magicoder-Evol-Instruct-110K", | |
| "adapter_repo": "josephmayo/gemma-4-E4B-it-coding-lora", | |
| "merged_repo": "josephmayo/gemma-4-E4B-it-coding-merged", | |
| "stage": "after_eval", | |
| "errors": [], | |
| "cuda_available": true, | |
| "cuda_device_count": 2, | |
| "devices": [ | |
| "Tesla T4", | |
| "Tesla T4" | |
| ], | |
| "torch_version_initial": "2.10.0+cu128", | |
| "hf_token_present": false, | |
| "max_train_samples": 1024, | |
| "max_steps": 200, | |
| "max_seq_length": 512, | |
| "eval_count": 8, | |
| "lora_r": 16, | |
| "lora_alpha": 32, | |
| "lr": 0.0001, | |
| "grad_accum": 8, | |
| "push_to_hf": true, | |
| "merge_and_push": false, | |
| "load_in_4bit": true, | |
| "memory_after_load": [ | |
| 0, | |
| 9302143488 | |
| ], | |
| "eval_source": "openai/openai_humaneval:8", | |
| "baseline_avg_score": 0.76875, | |
| "safe_train_rows": 1024, | |
| "trainable_parameters": { | |
| "trainable": 50499584, | |
| "total": 7991600416 | |
| }, | |
| "log_history_tail": [ | |
| { | |
| "loss": 1.0154043197631837, | |
| "grad_norm": 0.37521687150001526, | |
| "learning_rate": 4.51495073572676e-05, | |
| "epoch": 1.71875 | |
| }, | |
| { | |
| "loss": 0.9917967796325684, | |
| "grad_norm": 0.42887604236602783, | |
| "learning_rate": 4.114045042103887e-05, | |
| "epoch": 1.796875 | |
| }, | |
| { | |
| "loss": 1.1146905899047852, | |
| "grad_norm": 0.4208148717880249, | |
| "learning_rate": 3.718944461187138e-05, | |
| "epoch": 1.875 | |
| }, | |
| { | |
| "loss": 0.9283761978149414, | |
| "grad_norm": 0.3849687874317169, | |
| "learning_rate": 3.332237841745898e-05, | |
| "epoch": 1.953125 | |
| }, | |
| { | |
| "loss": 1.113053035736084, | |
| "grad_norm": 0.4142734110355377, | |
| "learning_rate": 2.9564590321322207e-05, | |
| "epoch": 2.03125 | |
| }, | |
| { | |
| "loss": 0.9842248916625976, | |
| "grad_norm": 0.44529953598976135, | |
| "learning_rate": 2.5940702775459747e-05, | |
| "epoch": 2.109375 | |
| }, | |
| { | |
| "loss": 0.9449721336364746, | |
| "grad_norm": 0.3756776750087738, | |
| "learning_rate": 2.2474460864709824e-05, | |
| "epoch": 2.1875 | |
| }, | |
| { | |
| "loss": 1.0590093612670899, | |
| "grad_norm": 0.4192875325679779, | |
| "learning_rate": 1.9188576719953633e-05, | |
| "epoch": 2.265625 | |
| }, | |
| { | |
| "loss": 0.9768091201782226, | |
| "grad_norm": 0.5095818638801575, | |
| "learning_rate": 1.6104580699624837e-05, | |
| "epoch": 2.34375 | |
| }, | |
| { | |
| "loss": 1.038302516937256, | |
| "grad_norm": 0.41709497570991516, | |
| "learning_rate": 1.3242680314639993e-05, | |
| "epoch": 2.421875 | |
| }, | |
| { | |
| "loss": 0.9975608825683594, | |
| "grad_norm": 0.5563586354255676, | |
| "learning_rate": 1.0621627821127289e-05, | |
| "epoch": 2.5 | |
| }, | |
| { | |
| "loss": 0.9714397430419922, | |
| "grad_norm": 0.8915637135505676, | |
| "learning_rate": 8.25859734853645e-06, | |
| "epoch": 2.578125 | |
| }, | |
| { | |
| "loss": 0.9948483467102051, | |
| "grad_norm": 0.4391196370124817, | |
| "learning_rate": 6.16907236823262e-06, | |
| "epoch": 2.65625 | |
| }, | |
| { | |
| "loss": 0.9389057159423828, | |
| "grad_norm": 0.4650712311267853, | |
| "learning_rate": 4.366744239922998e-06, | |
| "epoch": 2.734375 | |
| }, | |
| { | |
| "loss": 1.06390380859375, | |
| "grad_norm": 0.4836062788963318, | |
| "learning_rate": 2.8634225006782865e-06, | |
| "epoch": 2.8125 | |
| }, | |
| { | |
| "loss": 1.008359718322754, | |
| "grad_norm": 0.45215511322021484, | |
| "learning_rate": 1.6689574843694433e-06, | |
| "epoch": 2.890625 | |
| }, | |
| { | |
| "loss": 1.0110493659973145, | |
| "grad_norm": 0.5408219695091248, | |
| "learning_rate": 7.911757785462881e-07, | |
| "epoch": 2.96875 | |
| }, | |
| { | |
| "loss": 0.911649227142334, | |
| "grad_norm": 0.4599083364009857, | |
| "learning_rate": 2.3582894166930268e-07, | |
| "epoch": 3.046875 | |
| }, | |
| { | |
| "loss": 0.9673548698425293, | |
| "grad_norm": 0.43304941058158875, | |
| "learning_rate": 6.5558167183898955e-09, | |
| "epoch": 3.125 | |
| }, | |
| { | |
| "train_runtime": 4256.6409, | |
| "train_samples_per_second": 0.752, | |
| "train_steps_per_second": 0.047, | |
| "total_flos": 4.259313762009523e+16, | |
| "train_loss": 1.142699921131134, | |
| "epoch": 3.125 | |
| } | |
| ], | |
| "train_metrics": { | |
| "train_runtime": 4256.6409, | |
| "train_samples_per_second": 0.752, | |
| "train_steps_per_second": 0.047, | |
| "total_flos": 4.259313762009523e+16, | |
| "train_loss": 1.142699921131134, | |
| "epoch": 3.125 | |
| }, | |
| "after_avg_score": 0.76875, | |
| "score_delta": 0.0, | |
| "adapter_dir": "/kaggle/working/gemma4_e4b_coding_lora", | |
| "release_gate_pass": true | |
| } |