Downloads · 30 days
4
15% of all-time downloads
osmankagankurnaz/gemma-4-2b-tr-ecommerce-absa
gemma-4-2b-tr-ecommerce-absa is a text generation model from osmankagankurnaz. Use it when you need the model to write or continue text. It is set up for peft.
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. T…
Downloads · 30 days
4
15% of all-time downloads
All-time downloads
26
Public
Repo size
37.7 MB
Likes
0
Public
Click a slice to open those files.
.json32.2 MB · 85%
From the Hugging Face model README
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."
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