Model Card for gemma4-code-assistant

This model is a fine-tuned version of google/gemma-4-E2B, specialized for code assistance tasks. It was trained with supervised fine-tuning (SFT) using TRL and published by DevNexAI.

Quick start

This is a LoRA adapter — load the base model first and apply the adapter on top:

from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

base = AutoModelForCausalLM.from_pretrained(
    "google/gemma-4-E2B", device_map="auto"
)
model = PeftModel.from_pretrained(base, "Devnexai/gemma4-code-assistant")
tokenizer = AutoTokenizer.from_pretrained("Devnexai/gemma4-code-assistant")

messages = [{"role": "user", "content": "Write a Python function to check if a string is a palindrome."}]
inputs = tokenizer.apply_chat_template(
    messages, add_generation_prompt=True, return_tensors="pt"
).to(model.device)
output = model.generate(inputs, max_new_tokens=256)
print(tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=True))

Training procedure

This model was trained with SFT (LoRA/PEFT).

Framework versions

  • PEFT 0.18.1
  • TRL: 1.0.0
  • Transformers: 5.6.0.dev0
  • Pytorch: 2.10.0+cu128
  • Datasets: 4.8.4
  • Tokenizers: 0.22.2

Citations

@software{vonwerra2020trl,
  title   = {{TRL: Transformers Reinforcement Learning}},
  author  = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
  license = {Apache-2.0},
  url     = {https://github.com/huggingface/trl},
  year    = {2020}
}

Downloads last month
9
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Devnexai/gemma4-code-assistant

Adapter
(31)
this model