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
| [ | |
| { | |
| "loss": 2.7602264404296877, | |
| "grad_norm": 3.374150276184082, | |
| "learning_rate": 6.666666666666667e-05, | |
| "epoch": 0.078125, | |
| "step": 5 | |
| }, | |
| { | |
| "loss": 1.8698038101196288, | |
| "grad_norm": 1.457783579826355, | |
| "learning_rate": 9.994100796397954e-05, | |
| "epoch": 0.15625, | |
| "step": 10 | |
| }, | |
| { | |
| "loss": 1.319937038421631, | |
| "grad_norm": 0.707484245300293, | |
| "learning_rate": 9.958100506132127e-05, | |
| "epoch": 0.234375, | |
| "step": 15 | |
| }, | |
| { | |
| "loss": 1.3707428932189942, | |
| "grad_norm": 0.43754199147224426, | |
| "learning_rate": 9.889612861977853e-05, | |
| "epoch": 0.3125, | |
| "step": 20 | |
| }, | |
| { | |
| "loss": 1.3082144737243653, | |
| "grad_norm": 0.35036444664001465, | |
| "learning_rate": 9.789086620939936e-05, | |
| "epoch": 0.390625, | |
| "step": 25 | |
| }, | |
| { | |
| "loss": 1.283499526977539, | |
| "grad_norm": 0.26873722672462463, | |
| "learning_rate": 9.657180469054213e-05, | |
| "epoch": 0.46875, | |
| "step": 30 | |
| }, | |
| { | |
| "loss": 1.1428126335144042, | |
| "grad_norm": 0.31287550926208496, | |
| "learning_rate": 9.494758705426978e-05, | |
| "epoch": 0.546875, | |
| "step": 35 | |
| }, | |
| { | |
| "loss": 1.1817453384399415, | |
| "grad_norm": 0.2988075911998749, | |
| "learning_rate": 9.302885579019627e-05, | |
| "epoch": 0.625, | |
| "step": 40 | |
| }, | |
| { | |
| "loss": 1.1872751235961914, | |
| "grad_norm": 0.2937701642513275, | |
| "learning_rate": 9.082818315286055e-05, | |
| "epoch": 0.703125, | |
| "step": 45 | |
| }, | |
| { | |
| "loss": 1.146270751953125, | |
| "grad_norm": 0.3410361111164093, | |
| "learning_rate": 8.835998878354931e-05, | |
| "epoch": 0.78125, | |
| "step": 50 | |
| }, | |
| { | |
| "loss": 1.167984962463379, | |
| "grad_norm": 0.3269799053668976, | |
| "learning_rate": 8.564044522734147e-05, | |
| "epoch": 0.859375, | |
| "step": 55 | |
| }, | |
| { | |
| "loss": 1.0844226837158204, | |
| "grad_norm": 0.44009652733802795, | |
| "learning_rate": 8.268737196446264e-05, | |
| "epoch": 0.9375, | |
| "step": 60 | |
| }, | |
| { | |
| "loss": 1.1493185043334961, | |
| "grad_norm": 0.383281409740448, | |
| "learning_rate": 7.952011865029614e-05, | |
| "epoch": 1.015625, | |
| "step": 65 | |
| }, | |
| { | |
| "loss": 1.1071245193481445, | |
| "grad_norm": 0.40226107835769653, | |
| "learning_rate": 7.61594383291065e-05, | |
| "epoch": 1.09375, | |
| "step": 70 | |
| }, | |
| { | |
| "loss": 1.062960433959961, | |
| "grad_norm": 0.3419550359249115, | |
| "learning_rate": 7.262735145222696e-05, | |
| "epoch": 1.171875, | |
| "step": 75 | |
| }, | |
| { | |
| "loss": 1.1302300453186036, | |
| "grad_norm": 0.39782464504241943, | |
| "learning_rate": 6.894700159171534e-05, | |
| "epoch": 1.25, | |
| "step": 80 | |
| }, | |
| { | |
| "loss": 1.0111728668212892, | |
| "grad_norm": 0.3370531499385834, | |
| "learning_rate": 6.514250379489753e-05, | |
| "epoch": 1.328125, | |
| "step": 85 | |
| }, | |
| { | |
| "loss": 1.0343121528625487, | |
| "grad_norm": 0.35490792989730835, | |
| "learning_rate": 6.123878657343648e-05, | |
| "epoch": 1.40625, | |
| "step": 90 | |
| }, | |
| { | |
| "loss": 1.161344337463379, | |
| "grad_norm": 0.4397459328174591, | |
| "learning_rate": 5.726142856227452e-05, | |
| "epoch": 1.484375, | |
| "step": 95 | |
| }, | |
| { | |
| "loss": 1.1250411987304687, | |
| "grad_norm": 0.375924289226532, | |
| "learning_rate": 5.3236490918721794e-05, | |
| "epoch": 1.5625, | |
| "step": 100 | |
| }, | |
| { | |
| "loss": 1.0718464851379395, | |
| "grad_norm": 0.41714778542518616, | |
| "learning_rate": 4.919034655987493e-05, | |
| "epoch": 1.640625, | |
| "step": 105 | |
| }, | |
| { | |
| "loss": 1.0154043197631837, | |
| "grad_norm": 0.37521687150001526, | |
| "learning_rate": 4.51495073572676e-05, | |
| "epoch": 1.71875, | |
| "step": 110 | |
| }, | |
| { | |
| "loss": 0.9917967796325684, | |
| "grad_norm": 0.42887604236602783, | |
| "learning_rate": 4.114045042103887e-05, | |
| "epoch": 1.796875, | |
| "step": 115 | |
| }, | |
| { | |
| "loss": 1.1146905899047852, | |
| "grad_norm": 0.4208148717880249, | |
| "learning_rate": 3.718944461187138e-05, | |
| "epoch": 1.875, | |
| "step": 120 | |
| }, | |
| { | |
| "loss": 0.9283761978149414, | |
| "grad_norm": 0.3849687874317169, | |
| "learning_rate": 3.332237841745898e-05, | |
| "epoch": 1.953125, | |
| "step": 125 | |
| }, | |
| { | |
| "loss": 1.113053035736084, | |
| "grad_norm": 0.4142734110355377, | |
| "learning_rate": 2.9564590321322207e-05, | |
| "epoch": 2.03125, | |
| "step": 130 | |
| }, | |
| { | |
| "loss": 0.9842248916625976, | |
| "grad_norm": 0.44529953598976135, | |
| "learning_rate": 2.5940702775459747e-05, | |
| "epoch": 2.109375, | |
| "step": 135 | |
| }, | |
| { | |
| "loss": 0.9449721336364746, | |
| "grad_norm": 0.3756776750087738, | |
| "learning_rate": 2.2474460864709824e-05, | |
| "epoch": 2.1875, | |
| "step": 140 | |
| }, | |
| { | |
| "loss": 1.0590093612670899, | |
| "grad_norm": 0.4192875325679779, | |
| "learning_rate": 1.9188576719953633e-05, | |
| "epoch": 2.265625, | |
| "step": 145 | |
| }, | |
| { | |
| "loss": 0.9768091201782226, | |
| "grad_norm": 0.5095818638801575, | |
| "learning_rate": 1.6104580699624837e-05, | |
| "epoch": 2.34375, | |
| "step": 150 | |
| }, | |
| { | |
| "loss": 1.038302516937256, | |
| "grad_norm": 0.41709497570991516, | |
| "learning_rate": 1.3242680314639993e-05, | |
| "epoch": 2.421875, | |
| "step": 155 | |
| }, | |
| { | |
| "loss": 0.9975608825683594, | |
| "grad_norm": 0.5563586354255676, | |
| "learning_rate": 1.0621627821127289e-05, | |
| "epoch": 2.5, | |
| "step": 160 | |
| }, | |
| { | |
| "loss": 0.9714397430419922, | |
| "grad_norm": 0.8915637135505676, | |
| "learning_rate": 8.25859734853645e-06, | |
| "epoch": 2.578125, | |
| "step": 165 | |
| }, | |
| { | |
| "loss": 0.9948483467102051, | |
| "grad_norm": 0.4391196370124817, | |
| "learning_rate": 6.16907236823262e-06, | |
| "epoch": 2.65625, | |
| "step": 170 | |
| }, | |
| { | |
| "loss": 0.9389057159423828, | |
| "grad_norm": 0.4650712311267853, | |
| "learning_rate": 4.366744239922998e-06, | |
| "epoch": 2.734375, | |
| "step": 175 | |
| }, | |
| { | |
| "loss": 1.06390380859375, | |
| "grad_norm": 0.4836062788963318, | |
| "learning_rate": 2.8634225006782865e-06, | |
| "epoch": 2.8125, | |
| "step": 180 | |
| }, | |
| { | |
| "loss": 1.008359718322754, | |
| "grad_norm": 0.45215511322021484, | |
| "learning_rate": 1.6689574843694433e-06, | |
| "epoch": 2.890625, | |
| "step": 185 | |
| }, | |
| { | |
| "loss": 1.0110493659973145, | |
| "grad_norm": 0.5408219695091248, | |
| "learning_rate": 7.911757785462881e-07, | |
| "epoch": 2.96875, | |
| "step": 190 | |
| }, | |
| { | |
| "loss": 0.911649227142334, | |
| "grad_norm": 0.4599083364009857, | |
| "learning_rate": 2.3582894166930268e-07, | |
| "epoch": 3.046875, | |
| "step": 195 | |
| }, | |
| { | |
| "loss": 0.9673548698425293, | |
| "grad_norm": 0.43304941058158875, | |
| "learning_rate": 6.5558167183898955e-09, | |
| "epoch": 3.125, | |
| "step": 200 | |
| }, | |
| { | |
| "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, | |
| "step": 200 | |
| } | |
| ] |