Downloads · 30 days
0
navdeep-singh/Llama-3-8b-ABSA-Summarizer-LoRA
Llama-3-8b-ABSA-Summarizer-LoRA is a text generation model from navdeep-singh. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
- Developed by: navdeep-singh - License: apache-2.0 - Finetuned from model: unsloth/llama-3-8b-bnb-4bit - Dataset: navdeep-singh/sentiment-aware-review-summarization
Downloads · 30 days
0
Access
Public
Updated Feb 2, 2026
Repo size
185 MB
Likes
0
Public
Click a slice to open those files.
.safetensors168 MB · 91%
From the Hugging Face model README
This is a LoRA adapter for Llama-3-8b, fine-tuned for Aspect-Based Sentiment Analysis (ABSA) and Review Summarization. It is specifically designed to analyze restaurant reviews, extracting sentiment for specific aspects (Ambiance, Cleanliness, Food, Service, Value) and generating a concise summary.
This llama model was trained 2x faster with Unsloth.
This model performs two tasks simultaneously given a customer review:
You can use unsloth to load this model.
First, install the necessary libraries and load the model and tokenizer.
from unsloth import FastLanguageModel
import torch
# Define the model name
model_name = "navdeep-singh/Llama-3-8b-ABSA-Summarizer-LoRA"
max_seq_length = 2048
dtype = None # None for auto detection
load_in_4bit = True # Use 4bit quantization to reduce memory usage
# Load model and tokenizer
model, tokenizer = FastLanguageModel.from_pretrained(
model_name = model_name,
max_seq_length = max_seq_length,
dtype = dtype,
load_in_4bit = load_in_4bit,
)
Set the model to inference and pass below prompt to generate result.
# Enable native 2x faster inference
FastLanguageModel.for_inference(model)
# Define the prompt template
alpaca_prompt = """Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
You are an expert restaurant critic and sentiment analyst. Your task is to analyze the customer review provided below and extract structured insights.
Follow these specific steps:
1. **Aspect Analysis**: Analyze the text to determine the sentiment for specific categories. You must classify each category as 'Positive', 'Negative', or 'Neutral'.
- **Ambiance**: Decor, atmosphere, noise level, lighting.
- **Cleanliness**: Hygiene, tidiness of the space.
- **Food**: Taste, temperature, portion size, menu variety.
- **Service**: Staff behavior, speed, attentiveness.
- **Value**: Price appropriateness, worth the money.
If a category is not explicitly mentioned but can be strongly inferred, classify it. If absolutely no info is present, use 'Neutral'.
2. **Summarization**: Write a concise, one-sentence summary of the review that captures the main pros and cons.
### Input:
{}
### Response:
"""
# Example Review
review_text = "The food was absolutely delicious, especially the pasta, but the service was incredibly slow. We waited 40 minutes for our main course. The ambiance was cozy though."
# Format the prompt
inputs = tokenizer(
[
alpaca_prompt.format(review_text)
], return_tensors = "pt").to("cuda")
# Generate output
outputs = model.generate(**inputs, max_new_tokens = 512, use_cache = True, temperature = 0.1)
prediction = tokenizer.batch_decode(outputs[:, inputs['input_ids'].shape[1]:], skip_special_tokens=True)[0]
# Print the result
print(prediction)