Social Media Content Generator - Qwen2.5 7B LoRA
Model Overview
This model is a specialized fine-tune of Qwen2.5-7B-Instruct, optimized for generating high-engagement social media content. It has been trained on a curated dataset of over 5,300 professional examples covering Instagram, LinkedIn, YouTube, and Facebook formats. The model utilizes Low-Rank Adaptation (LoRA) to achieve high performance while maintaining parameter efficiency.
System Architecture
The model implements a QLoRA (Quantized Low-Rank Adaptation) architecture, injecting trainable rank-decomposition matrices into the frozen 4-bit quantized base model.
Quick Start
Prerequisites
pip install transformers peft torch
Inference Code
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
# Configuration
BASE_MODEL_ID = "Qwen/Qwen2.5-7B-Instruct"
ADAPTER_ID = "YOUR_USERNAME/qwen2.5-social-content-generator"
# Load Base Model
base_model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL_ID,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Load LoRA Adapter
model = PeftModel.from_pretrained(base_model, ADAPTER_ID)
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL_ID)
def generate_content(prompt, max_tokens=150):
# Format prompt with ChatML template
formatted_prompt = f"<|im_start|>system\nYou are a professional social media content generator.<|im_end|>\n<|im_start|>user\n{prompt}<|im_end|>\n<|im_start|>assistant\n"
inputs = tokenizer(formatted_prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=max_tokens,
temperature=0.7,
top_p=0.9,
do_sample=True
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
return response.split("assistant")[-1].strip()
# Example Usage
print(generate_content("Write a professional LinkedIn post about AI trends in 2026"))
Training Details
Dataset Composition
The model was trained on a dataset of 5,334 samples with the following distribution:
| Content Type | Count | Percentage | Description |
|---|---|---|---|
| Short-form | 1,468 | 27% | 8-30 words (Reels, Shorts) |
| Medium-form | 1,831 | 34% | 31-100 words (Captions, Updates) |
| Long-form | 1,987 | 37% | 100+ words (Articles, Threads) |
Hyperparameters
| Parameter | Value |
|---|---|
| Base Model | Qwen2.5-7B-Instruct |
| Quantization | 4-bit (NF4) |
| LoRA Rank (r) | 16 |
| LoRA Alpha | 32 |
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Batch Size | 16 (Effective) |
| Learning Rate | 2e-4 |
| Epochs | 3 |
| Optimizer | paged_adamw_32bit |
Performance & Capabilities
The model demonstrates strong capabilities in the following areas:
- Hook Generation: 73.8% of generated samples include engagement hooks.
- Platform Optimization: Automatically adjusts tone and format for LinkedIn (Professional), Instagram (Visual/Casual), and Twitter (Concise).
- Call-to-Action (CTA): consistently integrates relevant CTAs in 60% of outputs.
Example Outputs
Prompt: "Write an Instagram reel about productivity tips (20 words max)"
Output: Stop scrolling. ๐ This productivity hack changed everything for me. Focus on one thing at a time. Save this. ๐
Prompt: "Create a professional LinkedIn post about AI trends"
Output: AI is not just a buzzword; it's a paradigm shift. In 2026, we are seeing a move towards agentic workflows that autonomously solve complex problems. Organizations that adapt now will lead the market. #AI #Innovation #FutureOfWork
Deployment Options
CPU / Mobile Inference
This model supports CPU-only inference for edge deployment.
# Load on CPU
model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL_ID,
torch_dtype=torch.float32,
device_map="cpu",
low_cpu_mem_usage=True
)
model = PeftModel.from_pretrained(model, ADAPTER_ID)
- Desktop CPU (i7/Ryzen 7): ~5-10 tokens/sec
- Mobile/Edge: ~2-3 seconds per response via API
License
This model is released under the Apache 2.0 license, inheriting terms from Qwen2.5.
Citation
@misc{qwen2.5-social-content-generator,
author = {Your Name},
title = {Social Media Content Generator - Qwen2.5 7B LoRA},
year = {2026},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/YOUR_USERNAME/qwen2.5-social-content-generator}},
}
- Downloads last month
- 58
