Introduction of distilbert-linkedIn-post-sentiment-analysis
Model Details of distilbert-linkedIn-post-sentiment-analysis
DistilBERT Quantized Model for LinkedIn Post Sentiment Analysis
This repository hosts a quantized version of the DistilBERT model, fine-tuned for LinkedIn post sentiment analysis tasks. The model has been optimized for efficient deployment while maintaining high accuracy, making it suitable for resource-constrained environments.
Model Details
Model Architecture:
DistilBERT Base Uncased
Task:
LinkedIn Post Sentiment Analysis
Dataset:
Stanford Sentiment Treebank v2 (SST2)
Quantization:
Float16
Fine-tuning Framework:
Hugging Face Transformers
Usage
Installation
pip install transformers torch
Loading the Model
from transformers import DistilBertForSequenceClassification, DistilBertTokenizer
import torch
# Load quantized model
quantized_model_path = "/kaggle/working/distilbert_finetuned_fp16"
quantized_model = DistilBertForSequenceClassification.from_pretrained(quantized_model_path)
quantized_model.eval() # Set to evaluation mode
quantized_model.half() # Convert model to FP16# Load tokenizer
tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased")
# Define a test sentence
test_sentence = "This update has received great engagement!"# Tokenize input
inputs = tokenizer(test_sentence, return_tensors="pt", padding=True, truncation=True, max_length=128)
# Ensure input tensors are in correct dtype
inputs["input_ids"] = inputs["input_ids"].long() # Convert to long type
inputs["attention_mask"] = inputs["attention_mask"].long() # Convert to long type# Make predictionwith torch.no_grad():
outputs = quantized_model(**inputs)
# Get predicted class
predicted_class = torch.argmax(outputs.logits, dim=1).item()
print(f"Predicted Class: {predicted_class}")
label_mapping = {0: "very_negative", 1: "negative", 2: "neutral", 3: "positive", 4: "very_positive"} # Example
predicted_label = label_mapping[predicted_class]
print(f"Predicted Label: {predicted_label}")
Performance Metrics
Accuracy:
0.82
Fine-Tuning Details
Dataset
The dataset is taken from Kaggle Stanford Sentiment Treebank v2 (SST2).
Training
Number of epochs: 3
Batch size: 8
Evaluation strategy: epoch
Learning rate: 2e-5
Quantization
Post-training quantization was applied using PyTorch's built-in quantization framework to reduce the model size and improve inference efficiency.
Repository Structure
.
├── model/ # Contains the quantized model files
├── tokenizer_config/ # Tokenizer configuration and vocabulary files
├── model.safensors/ # Fine Tuned Model
├── README.md # Model documentation
Limitations
The model may not generalize well to domains outside the fine-tuning dataset.
Quantization may result in minor accuracy degradation compared to full-precision models.
Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request if you have suggestions or improvements.
Runs of AventIQ-AI distilbert-linkedIn-post-sentiment-analysis on huggingface.co
8
Total runs
0
24-hour runs
1
3-day runs
2
7-day runs
-8
30-day runs
More Information About distilbert-linkedIn-post-sentiment-analysis huggingface.co Model
distilbert-linkedIn-post-sentiment-analysis huggingface.co is an AI model on huggingface.co that provides distilbert-linkedIn-post-sentiment-analysis's model effect (), which can be used instantly with this AventIQ-AI distilbert-linkedIn-post-sentiment-analysis model. huggingface.co supports a free trial of the distilbert-linkedIn-post-sentiment-analysis model, and also provides paid use of the distilbert-linkedIn-post-sentiment-analysis. Support call distilbert-linkedIn-post-sentiment-analysis model through api, including Node.js, Python, http.
distilbert-linkedIn-post-sentiment-analysis huggingface.co is an online trial and call api platform, which integrates distilbert-linkedIn-post-sentiment-analysis's modeling effects, including api services, and provides a free online trial of distilbert-linkedIn-post-sentiment-analysis, you can try distilbert-linkedIn-post-sentiment-analysis online for free by clicking the link below.
AventIQ-AI distilbert-linkedIn-post-sentiment-analysis online free url in huggingface.co:
distilbert-linkedIn-post-sentiment-analysis is an open source model from GitHub that offers a free installation service, and any user can find distilbert-linkedIn-post-sentiment-analysis on GitHub to install. At the same time, huggingface.co provides the effect of distilbert-linkedIn-post-sentiment-analysis install, users can directly use distilbert-linkedIn-post-sentiment-analysis installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
distilbert-linkedIn-post-sentiment-analysis install url in huggingface.co: