CoolFace
Modelpublic

Mostafa8Mehrabi/qwen3-50m-insomnia-therapist

sourceHugging Faceapache-2.0updated 1y agoView on Hugging Face
0likes16downloads
Model Card

๐Ÿง  Qwen3-50M Insomnia Therapist

Fine-tuned version of Qwen3-50M specialized for insomnia therapy conversations with Chain of Thought reasoning.

๐ŸŽฏ Model Details

  • โ€”Base Model: Mostafa8Mehrabi/qwen3-50m-fp16
  • โ€”Fine-tuned on: Mostafa8Mehrabi/insomnia-dataset-with-cot
  • โ€”Precision: BF16
  • โ€”Model Size: ~50M parameters
  • โ€”Specialization: Insomnia therapy with Chain of Thought reasoning

๐Ÿ“Š Training Results

  • โ€”Final Training Loss: 1.1862
  • โ€”Final Validation Loss: 1.2026013135910034
  • โ€”Training Epochs: 3
  • โ€”Batch Size: 4
  • โ€”Learning Rate: 2e-05
  • โ€”Max Length: 1024
  • โ€”Precision Used: BF16

๐Ÿš€ Usage

Quick Start

python
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("Mostafa8Mehrabi/qwen3-50m-insomnia-therapist")
model = AutoModelForCausalLM.from_pretrained(
    "Mostafa8Mehrabi/qwen3-50m-insomnia-therapist",
    device_map="auto"
)

# Generate therapy response
prompt = '''<|system|>Generate insomnia therapy conversation. Gather sleep information, establish rapport, introduce sleep diary. Include CoT reasoning. Validate-Educate-Recommend-Check format.<|endoftext|>
<|patient|>I can't sleep at night. I keep thinking about work and worrying about tomorrow.<|endoftext|>
<|cot|>'''

inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_length=400,
        temperature=0.7,
        top_p=0.9,
        do_sample=True,
        pad_token_id=tokenizer.pad_token_id,
        eos_token_id=tokenizer.eos_token_id
    )

response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)

๐Ÿ“ Format Structure

The model follows a specific conversation format:

  • โ€”Input: <|system|> + <|patient|>
  • โ€”Output: <|cot|> (Chain of Thought reasoning) + <|therapist|> (Therapeutic response)

Format Example:

<|system|>Generate insomnia therapy conversation...<|endoftext|>
<|patient|>I can't sleep at night.<|endoftext|>
<|cot|>Patient reports sleep difficulty. Need to validate concern, gather more information about sleep patterns, potential causes, and establish therapeutic rapport. Should introduce sleep diary concept and provide initial guidance.<|endoftext|>
<|therapist|>I understand how frustrating it must be to struggle with sleep. This is a common issue that many people face, and I'm here to help you work through it. Can you tell me a bit more about your sleep patterns? For instance, how long have you been experiencing this difficulty, and what typically happens when you try to fall asleep?<|endoftext|>

๐ŸŽฏ Key Features

  • โ€”Chain of Thought Reasoning: The model provides transparent reasoning before generating responses
  • โ€”Therapeutic Approach: Follows evidence-based therapy principles
  • โ€”Validation-Education-Recommendation-Check: Structured therapeutic format
  • โ€”Optimized Training: Trained with BF16 precision for efficiency
  • โ€”Specialized Training: Fine-tuned specifically on insomnia therapy conversations

โš™๏ธ Technical Specifications

  • โ€”Architecture: Qwen3 (Transformer-based)
  • โ€”Parameters: ~50M
  • โ€”Training Precision: BF16
  • โ€”Context Length: 1024 tokens
  • โ€”Training Framework: PyTorch + Transformers
  • โ€”Optimization: AdamW with warmup

๐Ÿ”ง Hardware Requirements

  • โ€”Minimum: 2GB GPU VRAM
  • โ€”Recommended: 4GB+ GPU VRAM
  • โ€”CPU: Compatible with CPU inference (slower)

๐Ÿ“š Training Data

Trained on curated insomnia therapy conversations with Chain of Thought annotations from the Mostafa8Mehrabi/insomnia-dataset-with-cot dataset.

๐Ÿšจ Important Notes

  • โ€”This model is for educational and research purposes
  • โ€”Not a replacement for professional medical advice
  • โ€”Always consult healthcare professionals for serious sleep disorders
  • โ€”Model outputs should be reviewed by qualified therapists

๐Ÿ“„ License

Apache 2.0 License

๐Ÿค Citation

If you use this model in your research, please cite:

bibtex
@misc{qwen3-50m-insomnia-therapist,
  title={Qwen3-50M Insomnia Therapist},
  author={Mostafa8Mehrabi},
  year={2024},
  publisher={Hugging Face},
  url={https://huggingface.co/Mostafa8Mehrabi/qwen3-50m-insomnia-therapist}
}

Fine-tuned with โค๏ธ for better sleep health