{"id":13408313,"url":"https://github.com/danlou/safespace","last_synced_at":"2025-03-14T13:30:47.538Z","repository":{"id":196048525,"uuid":"693631375","full_name":"danlou/safespace","owner":"danlou","description":"Your local AI counselor. LLM app that runs offline from a single binary.","archived":false,"fork":false,"pushed_at":"2023-09-22T15:10:52.000Z","size":1286,"stargazers_count":27,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-07-31T20:29:54.210Z","etag":null,"topics":["chatbot","eliza","llm","tui"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danlou.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-09-19T12:09:15.000Z","updated_at":"2024-05-31T09:10:13.000Z","dependencies_parsed_at":"2023-09-21T05:15:51.075Z","dependency_job_id":"92c6ea52-7b9e-4ee7-bc7e-619d20c60e41","html_url":"https://github.com/danlou/safespace","commit_stats":null,"previous_names":["danlou/safespace"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danlou%2Fsafespace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danlou%2Fsafespace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danlou%2Fsafespace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danlou%2Fsafespace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danlou","download_url":"https://codeload.github.com/danlou/safespace/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243584092,"owners_count":20314698,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","eliza","llm","tui"],"created_at":"2024-07-30T20:00:52.072Z","updated_at":"2025-03-14T13:30:47.146Z","avatar_url":"https://github.com/danlou.png","language":"Python","funding_links":[],"categories":["\u003ca name=\"ai\"\u003e\u003c/a\u003eAI / ChatGPT"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e🫧 safespace\u003c/h1\u003e\n\n![promo](https://github.com/danlou/safespace/blob/main/safespace_promo.png?raw=true)\n\n**safespace** is a lightweight LLM that can run on your laptop (or desktop) to help you navigate whatever personal issues or concerns may be troubling you.\nIt's trained to be non-judgemental and support you in coming up with solutions on your [own](https://en.wikipedia.org/wiki/Person-centered_therapy).\n\nIf you know about [ELIZA](https://en.wikipedia.org/wiki/ELIZA), you can think of **safespace** as its modern counterpart.\n\n## Main Features\n- **Simple**: It's just a single binary executable, no frameworks, no installs. Also, no GPU required.\n- **Private**: Designed to be run locally and traceless - no logs, analytics, etc. Runs offline.\n- **Lightweight**: Fully conversational at only ~5GB of RAM. See [Model Details](#model-details).\n- **Transparent**: App is contained in the 100 lines of [safespace.py](https://github.com/danlou/safespace/blob/main/safespace.py) - have a look at what it's doing.\n- **Free**: Use it as much as you want.\n\nNote: This model, like all LLMs, can hallucinate. It can sometimes refer to past conversations which never took place (and are not registered in any case). In rare occassions, it might also make ill-advised suggestions (in spite of its training) - use with common sense.\n\n## Video Demo\n[![asciicast](https://asciinema.org/a/609208.svg)](https://asciinema.org/a/609208)\n\n## Quickstart\n\n### 1. Download Binaries\nDownload the binary appropriate for your platform (~30MB).\n- [Apple Silicon (M1/M2) chips](https://github.com/danlou/safespace/releases/download/v1.0.0-mps/safespace)\n- [Linux](https://github.com/danlou/safespace/releases/download/v1.0.0-linux/safespace)\n- [Windows (Soon!)](TODO)\n\n### 2. Run Binaries\nGo to the directory where the binary is located (you may move it anywhere), and type the following on your terminal.\n\n```bash\n./safespace\n```\n\nThe application will search for a `safespace_models` in the same directory. If none is found, it will create it and download the default model (3.8GB) on the first run. If this download is interrupted, you will need to re-run the application with following command:\n\n```bash\n./safespace --force-download\n```\n\nIf you get a 'Permission Denied' error, try setting permissions before running:\n\n```bash\nchmod +x safespace\n```\n\nYou might also be able to run the binary by double-clicking on the downloaded binary file, but this hasn't been tested carefully yet.\n\n## Running from Python\n\nIf you don't want to use the binary files, you can run **safespace** from the code in this repository. It should run faster this way, but requires some setup.\n\n```bash\ngit clone https://github.com/danlou/safespace.git\ncd safespace\npip install -r requirements.txt\npython safespace.py\n```\n\nWhile this project has minimal dependencies, it may still be advisable to use a virtual environment. This installs the default llama.cpp, please check the documentation at the [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#installation-from-pypi) repository for instructions on taking advantage of platform specific optimizations (e.g. Apple Silicon). Tested on Python 3.10.\n\n## Model Details\n**safespace** uses a Llama v2 7B model that has been 4-bit quantized using [llama.cpp](https://github.com/ggerganov/llama.cpp) to run efficiently on CPUs.\nIn particular, it uses a custom fine-tuned model trained on a synthetic dataset of transcripts of therapy sessions with a Rogerian therapist. The sessions in this synthetic dataset are derived from a compilation of reddit posts on subreddits related to mental health (r/adhd, r/depression, r/aspergers, ...).\nWe make our synthetic dataset available [here](https://huggingface.co/datasets/danlou/safespace-8877-20230920), and the reddit dataset may be found [here](https://huggingface.co/datasets/solomonk/reddit_mental_health_posts).\n\nOur model is fine-tuned from the [Samantha-1.11](https://huggingface.co/ehartford/Samantha-1.11-7b) model (by [@ehartford](https://x.com/erhartford), see [blog post](https://erichartford.com/meet-samantha)) which, in turn, is a fine-tune of original Llama v2 checkpoints towards developing a companion trained on philosophy, psychology, and personal relationships.\n\n[\u003cimg src=\"https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png\" alt=\"Built with Axolotl\" width=\"200\" height=\"32\"/\u003e](https://github.com/OpenAccess-AI-Collective/axolotl)\n\n## License\nThe code in this repository is under the fully permissive MIT License, but the models are subject to the [Llama 2 Community License](https://github.com/facebookresearch/llama/blob/main/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanlou%2Fsafespace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanlou%2Fsafespace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanlou%2Fsafespace/lists"}