--- license: apache-2.0 datasets: - arafatanam/Student-Mental-Health-Counseling-10K language: - en base_model: - unsloth/llama-3-8b-Instruct tags: - Student-Mental-Health - Llama - Empathy - Support --- # SMILE-llama-3-8b-Instruct 🎓✨ **Student Mental Intelligence for Learning & Excellence** A fine-tuned LLaMA 3 8B model designed to support students in their academic journey by providing intelligent guidance on learning strategies, mental well-being, and academic excellence. ## 🌟 Model Overview SMILE (Student Mental Intelligence for Learning & Excellence) is a specialized conversational AI model built to understand and address the unique challenges faced by students. It combines academic guidance with mental health awareness to create a comprehensive support system for learners at all levels. ### Key Features - 🧠 **Mental Health Support**: Provides empathetic responses to student stress, anxiety, and emotional challenges - 📚 **Academic Guidance**: Offers study tips, time management strategies, and learning optimization techniques - 🎯 **Goal Setting**: Helps students set realistic academic goals and develop action plans - 🤝 **Peer Support**: Simulates supportive peer interactions and collaborative learning approaches - 🌱 **Personal Growth**: Encourages self-reflection and personal development alongside academic achievement ## 🔧 Model Details - **Base Model**: `unsloth/llama-3-8b-Instruct-bnb-4bit` - **Architecture**: LLaMA 3 8B with 4-bit quantization - **Fine-tuning Method**: PEFT (Parameter Efficient Fine-Tuning) - **Training Dataset**: [`arafatanam/Student-Mental-Health-Counseling-10K`](https://huggingface.co/datasets/arafatanam/Student-Mental-Health-Counseling-10K) - **Additional Data**: University student data collected from North South University, Dhaka, Bangladesh - **Specialization**: Student mental health and academic excellence - **Language**: English ## 🚀 Quick Start ### Installation ```bash pip install -U python-dotenv gradio transformers accelerate bitsandbytes pip install torch --index-url https://download.pytorch.org/whl/cu121 ``` ### Loading the Model ```python import torch from transformers import AutoModelForCausalLM, AutoTokenizer from peft import PeftConfig, PeftModel import gradio as gr import re from huggingface_hub import login # Login to Hugging Face (required for gated models) login("your_hf_token_here") # Load model and tokenizer base_model = "unsloth/llama-3-8b-Instruct-bnb-4bit" adapter = "arafatanam/SMILE-llama-3-8b-Instruct" # Load tokenizer tokenizer = AutoTokenizer.from_pretrained( base_model, add_bos_token=True, trust_remote_code=True, padding_side='left' ) # Load base model with PEFT adapter config = PeftConfig.from_pretrained(adapter) model = AutoModelForCausalLM.from_pretrained( config.base_model_name_or_path, load_in_4bit=True, device_map='auto', torch_dtype='auto' ) model = PeftModel.from_pretrained(model, adapter) model.eval() ``` ### Gradio Interface ```python # Removes all instances of **bold** def clean_markdown_bold(response): return re.sub(r"\*\*(.*?)\*\*", r"\1", response) # Define chat function def smile_chat(message, history): # Format user message user_message = [{"role": "user", "content": message}] # Tokenize input input_ids = tokenizer.apply_chat_template( user_message, tokenize=True, add_generation_prompt=True, return_tensors='pt' ).to(model.device) # Generate response outputs = model.generate( input_ids=input_ids, max_new_tokens=220, do_sample=True, temperature=0.1, top_k=30, top_p=0.9, repetition_penalty=1.15, no_repeat_ngram_size=2, pad_token_id=tokenizer.pad_token_id, eos_token_id=tokenizer.eos_token_id ) # Extract and decode response generated_ids = outputs[:, input_ids.shape[1]:] response = tokenizer.decode(generated_ids[0], skip_special_tokens=True) response = clean_markdown_bold(response) if not response.endswith(('.', '!', '?')): response += '.' return response.strip() # Create Gradio interface for SMILE model gr.ChatInterface( fn=smile_chat, title="SMILE - Student Mental Intelligence for Learning & Excellence", description="Your AI companion for academic success and mental well-being", examples=[ ["I'm feeling overwhelmed with my coursework. How can I manage my stress?"], ["What are some effective study techniques for better retention?"], ["I'm struggling with procrastination. Can you help me stay motivated?"], ["How do I balance academic pressure with self-care?"], ["I feel like I'm falling behind in my studies. What should I do?"], ["Can you help me create a study schedule that works?"], ["I'm anxious about upcoming exams. How can I prepare mentally?"], ["How do I maintain good mental health during challenging academic periods?"] ] ).launch(share=True, pwa=True, prevent_thread_lock=True) ``` ## 💡 Use Cases ### Academic Support - Study planning and organization - Learning strategy optimization - Time management guidance - Exam preparation techniques - Research and writing assistance ### Mental Health & Well-being - Stress management techniques - Anxiety coping strategies - Motivation and confidence building - Work-life balance guidance - Emotional support during difficult periods ### Personal Development - Goal setting and achievement - Self-reflection and growth - Building resilience - Developing healthy study habits - Fostering a growth mindset ## 🎯 Example Conversations **Student**: "I'm feeling really stressed about my upcoming finals. I can't seem to focus and I'm worried I'll fail." **SMILE**: "I understand how overwhelming finals can feel, and your concerns are completely valid. Let's work together on some strategies to help you regain focus and confidence. First, try breaking your study material into smaller, manageable chunks. Create a realistic study schedule that includes regular breaks and self-care activities. Remember, some stress is normal, but if it's paralyzing you, consider techniques like deep breathing or short meditation sessions. You've made it this far in your studies, which shows you have the capability to succeed." --- **Student**: "I keep procrastinating on my assignments. I know what I need to do, but I just can't get started." **SMILE**: "Procrastination often stems from feeling overwhelmed or fearing imperfection. Try the 'two-minute rule': if a task takes less than two minutes, do it immediately. For larger tasks, commit to just 15 minutes of work. Often, starting is the hardest part, and you'll find yourself continuing beyond that initial commitment. Also, identify your peak energy hours and schedule important work during those times. Remember, progress is better than perfection." ## ⚠️ Limitations & Disclaimers - This model provides educational and emotional support but is not a replacement for professional mental health services - For serious mental health concerns, please consult with qualified healthcare professionals - The model's responses are based on training data and should be considered as supportive guidance, not professional advice - Always prioritize your safety and well-being above academic achievement ## 🤝 Contributing We welcome contributions to improve SMILE! Whether it's reporting issues, suggesting improvements, or sharing use cases, your feedback helps make this model better for all students. ## 🙏 Acknowledgments - Built upon Meta's LLaMA 3 architecture - Fine-tuned using Unsloth's optimized implementation - Developed with a focus on student mental health and academic success --- **Remember**: Your mental health matters just as much as your academic success. SMILE is here to support you in achieving both! 🌟