Instructions to use kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora", device_map="auto") - PEFT
How to use kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora
- SGLang
How to use kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora with Docker Model Runner:
docker model run hf.co/kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora
Nemotron 3 Nano 4B BF16 Psychology QA LoRA
LoRA adapter fine-tuned from nvidia/NVIDIA-Nemotron-3-Nano-4B-BF16 for supportive psychology question answering using jkhedri/psychology-dataset.
This model is intended for short, empathetic, practical responses to psychology-style questions. It is not a replacement for professional mental health care, diagnosis, emergency support, or crisis intervention.
Model Details
- Base model:
nvidia/NVIDIA-Nemotron-3-Nano-4B-BF16 - Adapter type: LoRA / PEFT
- Dataset:
jkhedri/psychology-dataset - Language: English
- License: Apache 2.0
- Task: Text generation / psychology QA
Training
Trained on response_j answers from the psychology dataset.
Key settings:
- Train examples: 8,000
- Validation examples: 800
- Epochs: 2
- LoRA rank: 32
- LoRA alpha: 64
- LoRA dropout: 0.1
- Trainable parameters: 41,376,768, about 1.03%
- Max sequence length: 1024
- Rows over max length: 0 / 8,000
Final validation loss was about 0.701.
Evaluation
Evaluation was done qualitatively on held-out psychology QA examples after training. The base model usually produced longer, more conversational answers with several bullets and more reassurance. The fine-tuned adapter produced shorter answers that more closely matched the dataset style: direct, therapist-like, and focused on identifying possible causes, suggesting coping strategies, and recommending support when appropriate.
Across sample questions about stress, concentration, and sleep, the adapter learned to:
- give concise supportive responses
- mention common contributing factors such as stress, anxiety, sleep habits, or workload
- suggest practical next steps such as relaxation, exercise, mindfulness, routines, or sleep hygiene
- encourage support from trusted people or professionals when relevant
The adapter is more dataset-aligned than the base model, but it is also less detailed. For applications that need longer coaching-style answers, use a richer prompt or fine-tune on longer target responses.
Usage
Install the basic dependencies:
pip install -U transformers peft accelerate safetensors packaging ninja
pip install -U --no-build-isolation "mamba_ssm==2.2.5" "causal_conv1d==1.5.2"
Load the base model and this LoRA adapter:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_model_id = "nvidia/NVIDIA-Nemotron-3-Nano-4B-BF16"
adapter_id = "kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora"
tokenizer = AutoTokenizer.from_pretrained(adapter_id, trust_remote_code=True)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
attn_implementation="eager",
)
base_model.config.use_cache = False
base_model.config.pad_token_id = tokenizer.pad_token_id
base_model.config.eos_token_id = tokenizer.eos_token_id
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval();
Run standalone inference:
def clean_thinking(text: str) -> str:
text = text.strip()
while "<think>" in text and "</think>" in text:
start = text.find("<think>")
end = text.find("</think>", start) + len("</think>")
text = (text[:start] + text[end:]).strip()
if "</think>" in text:
text = text.split("</think>")[-1].strip()
return text.replace("<think>", "").replace("</think>", "").strip()
system_prompt = """/no_think
You are a supportive psychology question-answering assistant.
Answer directly without showing reasoning or internal analysis.
Respond with empathy, practical coping suggestions, and clear next steps.
Do not diagnose the user or claim to replace a licensed mental health professional."""
question = "I'm feeling overwhelmed and stressed. What can I do?"
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": f"Question:\n\n{question}"},
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_dict=True,
return_tensors="pt",
enable_thinking=False,
)
input_device = model.get_input_embeddings().weight.device
inputs = {k: v.to(input_device) for k, v in inputs.items()}
input_len = inputs["input_ids"].shape[-1]
with torch.no_grad():
output = model.generate(
**inputs,
max_new_tokens=180,
do_sample=False,
use_cache=False,
repetition_penalty=1.08,
no_repeat_ngram_size=4,
pad_token_id=tokenizer.eos_token_id,
eos_token_id=tokenizer.eos_token_id,
)
answer = tokenizer.decode(output[0][input_len:], skip_special_tokens=True)
print(clean_thinking(answer))
Output:
It's important to prioritize self-care and stress management techniques such as exercise, mindfulness, and relaxation exercises. We can also explore any underlying issues that may be contributing to your stress levels.
Limitations
This adapter was trained on a small psychology QA dataset and may give incomplete, generic, or inappropriate advice. Do not use it for diagnosis, high-risk mental health decisions, crisis response, or medical decision-making without qualified human oversight.
Model tree for kingabzpro/nemotron-3-nano-4b-bf16-psychology-qa-lora
Base model
nvidia/NVIDIA-Nemotron-Nano-12B-v2-Base