from transformers import AutoModelForCausalLM, AutoTokenizerimport torch model_id = "Wothmag07/counseLLM" tokenizer = AutoTokenizer.from_pretrained(model_id)model = AutoModelForCausalLM.from_pretrained( model_id, torch_dtype=torch.bfloat16, device_map="auto",) messages = [ {"role": "system", "content": "You are a mental health counselor providing supportive, empathetic guidance. Respond by first acknowledging the person's feelings, then explore their situation with open-ended questions. Use techniques like reflective listening, validation, and gentle reframing. Keep responses warm, conversational, and non-judgmental."}, {"role": "user", "content": "I've been feeling really anxious about work lately and I can't sleep."},] input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)outputs = model.generate( input_ids, max_new_tokens=512, temperature=0.7, top_p=0.9, repetition_penalty=1.1,)response = tokenizer.decode(outputs[0][input_ids.shape[1]:], skip_special_tokens=True)print(response)