Downloads · 30 days
0
arafatanam/SMILE-llama-3-8b-Instruct
SMILE-llama-3-8b-Instruct is a machine learning model from arafatanam. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Student Mental Intelligence for Learning & Excellence
Downloads · 30 days
0
Access
Public
Updated Aug 13, 2025
Repo size
688 MB
Likes
0
Public
Click a slice to open those files.
.safetensors671 MB · 97%
From the Hugging Face model README
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.
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.
unsloth/llama-3-8b-Instruct-bnb-4bitarafatanam/Student-Mental-Health-Counseling-10Kpip install -U python-dotenv gradio transformers accelerate bitsandbytes
pip install torch --index-url https://download.pytorch.org/whl/cu121
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()
# 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)
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."
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.
Remember: Your mental health matters just as much as your academic success. SMILE is here to support you in achieving both! 🌟