Downloads · 30 days
10
5% of all-time downloads
Argobell/gemma-3n-gek408-dpo
gemma-3n-gek408-dpo is a image-text-to-text model from Argobell. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as other.
gemma-3n-gek408-dpo is a high-performance, fine-tuned version of google/gemma-3n-E2B-it, meticulously optimized for educational and scientific reasoning. This model was trained leveraging the Unsloth library for signi…
Downloads · 30 days
10
5% of all-time downloads
All-time downloads
203
Public
Parameters
6B
10.9 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors10.9 GB · 100%
From the Hugging Face model README
gemma-3n-gek408-dpogemma-3n-gek408-dpo is a high-performance, fine-tuned version of google/gemma-3n-E2B-it, meticulously optimized for educational and scientific reasoning. This model was trained leveraging the Unsloth library for significantly faster training and reduced memory usage.
The training followed a two-stage process:
This model was developed for the Google - The Gemma 3n Impact Challenge competition.
google/gemma-3n-E2B-itThis model is ideal for:
This model serves as a strong foundation for:
This model inherits limitations common to most LLMs and has specific risks related to its application:
gemma-3n-E2B-it base model and the gek408 dataset.Always critically evaluate the model's output before use in any real-world application. For educational purposes, outputs should be reviewed by a subject matter expert.
The model was trained with Unsloth, so using it for inference is recommended for maximum performance.
from unsloth import FastModel
import torch
from transformers import TextStreamer
import gc
# Load the model and tokenizer with 4-bit quantization
model, tokenizer = FastModel.from_pretrained(
model_name = "Argobell/gemma-3n-gek408-dpo",
max_seq_length = 1024, # Choose any for long context!
load_in_4bit = True, # 4 bit quantization to reduce memory
# token = "hf_...", # use one if using gated models
)
# Helper function for inference
def do_gemma_3n_inference(model, messages, max_new_tokens = 128):
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt = True, # Must add for generation
tokenize = True,
return_dict = True,
return_tensors = "pt",
).to("cuda")
_ = model.generate(
**inputs,
max_new_tokens = max_new_tokens,
temperature = 1.0, top_p = 0.95, top_k = 64,
streamer = TextStreamer(tokenizer, skip_prompt = True),
)
# Cleanup to reduce VRAM usage
del inputs
torch.cuda.empty_cache()
gc.collect()
sloth_link = "https://files.worldwildlife.org/wwfcmsprod/images/Sloth_Sitting_iStock_3_12_2014/story_full_width/8l7pbjmj29_iStock_000011145477Large_mini__1_.jpg"
messages = [{
"role" : "user",
"content": [
{ "type": "image", "image" : sloth_link },
{ "type": "text", "text" : "Which films does this animal feature in?" }
]
}]
# You might have to wait 1 minute for Unsloth's auto compiler
do_gemma_3n_inference(model, messages, max_new_tokens = 256)
The training was conducted in two distinct phases, using a LoRA-based approach accelerated by Unsloth.
Argobell/gek408# SFT Stage Configuration
--max_seq_length 2048
--max_steps 320
--learning_rate 2e-4
--lr_scheduler_type "cosine"
--optim "adamw_torch_fused"
# LoRA Configuration
--tune_vision
--tune_language_layers
--tune_attention_modules
--tune_mlp_modules
--r 16
--alpha 16
--lora_dropout 0.05
# Batching & Memory
--per_device_train_batch_size 4
--per_device_eval_batch_size 4
--gradient_accumulation_steps 8
--gradient_checkpointing
Argobell/gek408-dpo# DPO Stage Configuration
--max_seq_length 2048
--max_prompt_length 1024
--max_steps 100
--learning_rate 5e-6
--optim "adamw_torch_fused"
--warmup_ration 0.1
--weight_decay 0.01
# LoRA Configuration
--tune_vision
--tune_language_layers
--tune_attention_modules
--tune_mlp_modules
--r 4
--alpha 4
--lora_dropout 0.1
# Batching & Memory
--per_device_train_batch_size 2
--per_device_eval_batch_size 2
--gradient_accumulation_steps 4
--gradient_checkpointing
Gemma-3n utilizes a Matryoshka Transformer (MatFormer) architecture, which nests smaller, self-contained models within a larger one.
This work would not have been possible without the foundational models and libraries developed by the open-source community. We would like to extend our gratitude to:
If you use this model in your work, please cite it as follows:
@misc{gemma3ngek408dpo,
author = {Argobell},
title = {gemma-3n-gek408-dpo},
howpublished = {\url{https://huggingface.co/Argobell/gemma-3n-gek408-dpo}},
year = {2025}
}
For questions, feedback, or collaboration, please reach out via email: [email protected]