Instructions to use omar-salama/TheraSpace-Gemma4-E2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use omar-salama/TheraSpace-Gemma4-E2B with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="omar-salama/TheraSpace-Gemma4-E2B", filename="gemma4-e2b-q4_k_m.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use omar-salama/TheraSpace-Gemma4-E2B with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M # Run inference directly in the terminal: llama-cli -hf omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M # Run inference directly in the terminal: llama-cli -hf omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M
Use Docker
docker model run hf.co/omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use omar-salama/TheraSpace-Gemma4-E2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "omar-salama/TheraSpace-Gemma4-E2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "omar-salama/TheraSpace-Gemma4-E2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M
- Ollama
How to use omar-salama/TheraSpace-Gemma4-E2B with Ollama:
ollama run hf.co/omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M
- Unsloth Studio
How to use omar-salama/TheraSpace-Gemma4-E2B with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for omar-salama/TheraSpace-Gemma4-E2B to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for omar-salama/TheraSpace-Gemma4-E2B to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for omar-salama/TheraSpace-Gemma4-E2B to start chatting
- Pi
How to use omar-salama/TheraSpace-Gemma4-E2B with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use omar-salama/TheraSpace-Gemma4-E2B with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M
Run Hermes
hermes
- Atomic Chat new
- Docker Model Runner
How to use omar-salama/TheraSpace-Gemma4-E2B with Docker Model Runner:
docker model run hf.co/omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M
- Lemonade
How to use omar-salama/TheraSpace-Gemma4-E2B with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull omar-salama/TheraSpace-Gemma4-E2B:Q4_K_M
Run and chat with the model
lemonade run user.TheraSpace-Gemma4-E2B-Q4_K_M
List all available models
lemonade list
TheraSpace-Gemma4-E2B
A therapist-style LLM — Gemma-4 E2B, 5B parameters in an effective-2B memory footprint — produced by the TheraSpace fine-tuning pipeline for the OpenSpace app. Runs fully on-device via llama.rn — no server, no data leaves the phone.
Naming note: E2B (effective 2B) follows the base model's class naming: the raw parameter count is ~5B (which is what the Model Size badge reports), while runtime memory behaves like a 2B-class model thanks to the base architecture's parameter offloading. This repo was previously published as
MindSpace-Gemma4-2B— old links redirect here.
Built on google/gemma-4-E2B-it with two training passes:
- SFT on a curated mix of counseling conversations (Counsel-Chat, Psych8k, AnnoMI, AMOD)
- DPO for persona steering — the model learns to respond in five distinct therapeutic voices when instructed by a system prompt
Personas
Five runtime personas are available — set via system prompt, no retraining needed:
| Persona | Style |
|---|---|
| Charlie | Warm, casual best-friend energy. "That sucks, I hear you." Zero clinical language. |
| Walter | Philosophical and contemplative. Metaphors, quiet observations, open questions. |
| Dr. Bloom | CBT/ACT-trained. Structured, direct, names thought patterns and concrete techniques. |
| Zuri | Mindfulness-grounded. Breathing cues, body awareness, present-moment anchors. |
| Sunny | Uplifting and encouraging. Validates difficulty, highlights strengths, reframes positively. |
All personas share the same crisis safety rules — changing persona does not reduce safety.
Crisis Safety
Evaluated on a 53-prompt crisis harness covering suicidal ideation, self-harm, abuse disclosure, eating disorders, homicidal ideation, trauma, isolation, and more. 53/53 PASS — every response surfaces a referral to the 988 Suicide & Crisis Lifeline when indicated.
The OpenSpace app adds a second safety layer: a client-side pattern matcher that injects the 988 reference if the model response misses it on a detected crisis input.
Intended Use
- On-device wellness support within the OpenSpace app
- Research into persona-steered therapy-style LLMs
- Exploration of DPO alignment for style transfer
Limitations
- Not a substitute for professional mental health care. The app displays this disclaimer prominently.
- Small-model scale (E2B: 5B params, 2B-class runtime) — instruction following is strong but not perfect; the app-layer safety net exists for this reason.
- Trained on English-dominant data; responds in English even when addressed in other languages (partial multilingual support observed in testing).
- Psych8k is
cc-by-nc-sa-4.0— this model should not be used in commercial products without reviewing dataset license terms.
How to Use
# With llama.cpp
./llama-cli -m gemma4-e2b-q4_k_m.gguf \
--system-prompt "You are Charlie — a warm, casual best friend who listens really well..." \
-p "I've been feeling really overwhelmed at work lately."
In the OpenSpace app the model is loaded via llama.rn and the persona system prompt is set at runtime based on the user's chosen therapist.
Training Details
| SFT | DPO | |
|---|---|---|
| Base | google/gemma-4-E2B-it | SFT merged |
| Steps | 1,000 | 800 |
| Batch (effective) | 16 | 16 |
| Learning rate | 2e-4 | 5e-5 |
| LoRA rank / alpha | 8 / 16 | 8 / 16 |
| DPO beta | — | 0.1 |
| Training infra | Modal A10G | Modal A10G |
DPO pairs were generated via Groq (Llama-3.3-70B) using a transform-based pipeline: real therapist responses from the counseling corpus are rewritten into each persona's voice (chosen); the original generic-counselor response becomes rejected. This isolates style from content, avoiding confounding DPO with meaning drift.
Dataset Licenses
| Dataset | License |
|---|---|
| Counsel-Chat | MIT |
| Psych8k | cc-by-nc-sa-4.0 (non-commercial) |
| AnnoMI | CC BY 4.0 |
| AMOD | Apache 2.0 |
Disclaimer
This model is not a licensed therapist and cannot replace professional mental health care. If you or someone you know is in crisis, call or text 988 (Suicide & Crisis Lifeline, available 24/7).
- Downloads last month
- 25
4-bit