Views
No views yet
google/gemma-4-E4B-it — the personal AI assistant
ayarlicazhocam. Trained locally on an RTX 5070 (12 GB). This is the v2 iteration; see the
training repo and
BENCHMARK_REPORT_V2.md
for an honest before/after analysis.reasoning channel), trained on ~20% of examples so both modes work.| tool-calling | mihenk-benchmark (80Q) | |
|---|---|---|
| base | 17% | 75.0% |
| this adapter | 92% | 67.5% (−7.5; mostly short-answer verbosity, see report) |
1import torch
2from transformers import Gemma4ForConditionalGeneration, AutoProcessor, BitsAndBytesConfig
3from peft import PeftModel
4
5SKIP=["vision_tower","audio_tower","embed_vision","embed_audio","lm_head"]
6bnb=BitsAndBytesConfig(load_in_4bit=True,bnb_4bit_quant_type="nf4",
7 bnb_4bit_compute_dtype=torch.bfloat16,bnb_4bit_use_double_quant=True,
8 llm_int8_skip_modules=SKIP,llm_int8_enable_fp32_cpu_offload=True)
9dm={"model.language_model":0,"lm_head":0,"model.vision_tower":"cpu","model.audio_tower":"cpu",
10 "model.embed_vision":"cpu","model.embed_audio":"cpu","model.language_model.embed_tokens_per_layer":"cpu"}
11m=Gemma4ForConditionalGeneration.from_pretrained("google/gemma-4-E4B-it",quantization_config=bnb,device_map=dm,torch_dtype=torch.bfloat16)
12m=PeftModel.from_pretrained(m,"gorkemergune/ayarlicazhocam-gemma-4-e4b")
13tok=AutoProcessor.from_pretrained("google/gemma-4-E4B-it").tokenizer
14enc=tok.apply_chat_template([{"role":"user","content":"Sen kimsin?"}],
15 add_generation_prompt=True,enable_thinking=False,return_tensors="pt",return_dict=True).to(0)
16print(tok.decode(m.generate(**enc,max_new_tokens=120)[0][enc["input_ids"].shape[1]:],skip_special_tokens=True))-e4b for accuracy. 12B is future work.