Downloads · 30 days
13
7% of all-time downloads
pengsu/MLB-care-for-mind-kor
MLB-care-for-mind-kor is a machine learning model from pengsu. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for peft.
This model is a fine-tuned version of google/gemma-2-2b-it, trained to classify sentiment in Korean text into four categories: 무감정 (neutral), 슬픔 (sadness), 기쁨 (joy), and 분노 (anger). The model utilizes LoRA (Low-Rank A…
Downloads · 30 days
13
7% of all-time downloads
All-time downloads
179
Public
Repo size
118 MB
Likes
1
Public
Click a slice to open those files.
.safetensors83.1 MB · 71%
From the Hugging Face model README
gemma-2-2b-it on Custom Korean Sentiment DatasetThis model is a fine-tuned version of google/gemma-2-2b-it, trained to classify sentiment in Korean text into four categories: 무감정 (neutral), 슬픔 (sadness), 기쁨 (joy), and 분노 (anger). The model utilizes LoRA (Low-Rank Adaptation) for efficient fine-tuning and 4-bit quantization (NF4) for memory efficiency using BitsAndBytes. A custom weighted loss function was applied to handle class imbalance within the dataset.
The model is suitable for multi-class sentiment classification in Korean and is optimized for environments with limited computational resources due to the quantization.
This model was fine-tuned by [Your Name or Organization] using Hugging Face's peft and transformers libraries with a custom Korean sentiment dataset.
This is a transformer-based model for multi-class sentiment classification in the Korean language.
[Add relevant license here]
google/gemma-2-2b-itThis model is suitable for applications requiring multi-class sentiment classification in Korean, such as chatbots, social media monitoring, or customer feedback analysis.
The model may not perform optimally for tasks requiring multi-language support, sentiment classification with additional classes, or outside the specific context of Korean language data.
The model uses 4-bit quantization via BitsAndBytes for efficient memory usage, which enables it to run on lower-resource hardware.
LoRA (Low-Rank Adaptation) was applied to specific transformer layers, allowing for parameter-efficient fine-tuning. The target modules include:
down_proj, gate_proj, q_proj, o_proj, up_proj, v_proj, k_projLoRA parameters are:
r = 16, lora_alpha = 32, lora_dropout = 0.05A custom weighted loss function was implemented to handle class imbalance, using the following weights:
[ \text{weights} = [0.2032, 0.2704, 0.2529, 0.2735] ]
These weights correspond to the classes: 무감정, 슬픔, 기쁨, 분노, respectively.
The model was trained on a custom Korean sentiment analysis dataset. This dataset consists of text samples labeled with one of four sentiment classes: 무감정, 슬픔, 기쁨, and 분노.
Data was tokenized using the google/gemma-2-2b-it tokenizer with a maximum sequence length of 128. The preprocessing steps included padding and truncation to ensure consistent input lengths.
The model was evaluated using the following metrics:
The evaluation provides a detailed view of the model's performance across multiple metrics, which helps in understanding its strengths and areas for improvement.
You can load the fine-tuned model and use it for inference on your own data as follows:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
# Load model and tokenizer
model = AutoModelForSequenceClassification.from_pretrained("your-model-directory")
tokenizer = AutoTokenizer.from_pretrained("your-model-directory")
# Tokenize input text
text = "이 영화는 정말 슬퍼요."
inputs = tokenizer(text, return_tensors="pt", padding=True, truncation=True)
# Get predictions
outputs = model(**inputs)
logits = outputs.logits
predicted_class = logits.argmax(-1).item()
# Map prediction to label
id2label = {0: "무감정", 1: "슬픔", 2: "기쁨", 3: "분노"}
print(f"Predicted sentiment: {id2label[predicted_class]}")