Downloads · 30 days
3
6% of all-time downloads
xTronz/gemma-3n-E4B-it-FineTome-100k
gemma-3n-E4B-it-FineTome-100k is a machine learning model from xTronz. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
3
6% of all-time downloads
All-time downloads
48
Public
Parameters
8.4B
15.7 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors15.7 GB · 100%
From the Hugging Face model README
fourbit_models = [
# 4bit dynamic quants for superior accuracy and low memory use
"unsloth/gemma-3n-E4B-it-unsloth-bnb-4bit",
"unsloth/gemma-3n-E2B-it-unsloth-bnb-4bit",
# Pretrained models
"unsloth/gemma-3n-E4B-unsloth-bnb-4bit",
"unsloth/gemma-3n-E2B-unsloth-bnb-4bit",
# Other Gemma 3 quants
"unsloth/gemma-3-1b-it-unsloth-bnb-4bit",
"unsloth/gemma-3-4b-it-unsloth-bnb-4bit",
"unsloth/gemma-3-12b-it-unsloth-bnb-4bit",
"unsloth/gemma-3-27b-it-unsloth-bnb-4bit",
] # More models at https://huggingface.co/unsloth
model, tokenizer = FastModel.from_pretrained(
model_name = "unsloth/gemma-3n-E4B-it",
dtype = None, # None for auto detection
max_seq_length = 1024, # Choose any for long context!
load_in_4bit = True, # 4 bit quantization to reduce memory
full_finetuning = False, # [NEW!] We have full finetuning now!
# token = "hf_...", # use one if using gated models
)
model = FastModel.get_peft_model(
model,
finetune_vision_layers = False, # Turn off for just text!
finetune_language_layers = True, # Should leave on!
finetune_attention_modules = True, # Attention good for GRPO
finetune_mlp_modules = True, # Should leave on always!
r = 8, # Larger = higher accuracy, but might overfit
lora_alpha = 8, # Recommended alpha == r at least
lora_dropout = 0,
bias = "none",
random_state = 3407,
)
tokenizer = get_chat_template(
tokenizer,
chat_template = "gemma-3",
)
from trl import SFTTrainer, SFTConfig
trainer = SFTTrainer(
model = model,
tokenizer = tokenizer,
train_dataset = dataset,
eval_dataset = None, # Can set up evaluation!
args = SFTConfig(
dataset_text_field = "text",
per_device_train_batch_size = 1,
gradient_accumulation_steps = 4, # Use GA to mimic batch size!
warmup_steps = 5,
# num_train_epochs = 1, # Set this for 1 full training run.
max_steps = 60,
learning_rate = 2e-4, # Reduce to 2e-5 for long training runs
logging_steps = 1,
optim = "adamw_8bit",
weight_decay = 0.001,
lr_scheduler_type = "linear",
seed = 3407,
report_to = "none", # Use TrackIO/WandB etc
),
)
trainer = train_on_responses_only(
trainer,
instruction_part = "<start_of_turn>user\n",
response_part = "<start_of_turn>model\n",
)