Gemma 4 E2B IT - Turkish E-Commerce ABSA

This model is fine-tuned on Turkish e-commerce clothing reviews to perform multi-aspect Aspect-Based Sentiment Analysis (ABSA). It uses the google/gemma-4-E2B-it architecture and was trained via the QLoRA technique. The model analyzes texts to directly extract "which aspect is expressed with which sentiment."

Model Details

  • Base Model: google/gemma-4-E2B-it
  • Task: Aspect-Based Sentiment Analysis (ABSA)
  • Language: Turkish
  • Libraries Used: PEFT, TRL, Transformers

Quick Start (Python)

You can download and integrate the model directly from Hugging Face. The following code demonstrates how to call the model using the correct prompt template:

import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

# Load the base model and tokenizer
base_model_id = "google/gemma-4-E2B-it"
peft_model_id = "YOUR_HUGGINGFACE_USERNAME/gemma_4_e2b_it_absa_finetuned" # Replace with your HF ID

tokenizer = AutoTokenizer.from_pretrained(base_model_id)
base_model = AutoModelForCausalLM.from_pretrained(base_model_id, torch_dtype=torch.bfloat16, device_map="auto")

# Load the fine-tuned LoRA adapter
model = PeftModel.from_pretrained(base_model, peft_model_id)

system_prompt = """You are an expert Aspect-Based Sentiment Analysis (ABSA) assistant for Turkish e-commerce. 
Analyze reviews and extract aspects with sentiments (positive, negative, neutral).
Format: aspect|sentiment; aspect|sentiment
Provide ONLY the tags."""

review = "İndirimden 50 liraya kaptım fiyatına göre iyi ama kargo tam 2 haftada geldi."

messages = [
    {"role": "user", "content": f"{system_prompt}\n\nReview: {review}"}
]

inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True).to("cuda")
outputs = model.generate(inputs, max_new_tokens=50)

print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))
# Expected Output: price_value|positive; product_quality|neutral; shipping|negative
Downloads last month
1
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for osmankagankurnaz/gemma-4-2b-tr-ecommerce-absa

Adapter
(183)
this model

Collection including osmankagankurnaz/gemma-4-2b-tr-ecommerce-absa