{"id":22451990,"url":"https://github.com/woctezuma/stable-diffusion-safety-checker","last_synced_at":"2025-07-11T14:08:17.515Z","repository":{"id":210677519,"uuid":"727161788","full_name":"woctezuma/stable-diffusion-safety-checker","owner":"woctezuma","description":"Python package to apply the Safety Checker from Stable Diffusion. ","archived":false,"fork":false,"pushed_at":"2025-06-23T18:58:01.000Z","size":36,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-23T19:45:00.383Z","etag":null,"topics":["colab","colab-notebook","colaboratory","deep-learning","diffusers","diffusion","google-colab","google-colab-notebook","google-colaboratory","nsfw","nsfw-classifier","nsfw-detection","nsfw-detector","nsfw-recognition","safety","safety-check","safety-checker","safety-checks","stable-diffusion","transformers"],"latest_commit_sha":null,"homepage":"https://github.com/Stability-AI/generative-models","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/woctezuma.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-12-04T10:05:43.000Z","updated_at":"2025-06-05T04:23:18.000Z","dependencies_parsed_at":"2024-07-16T00:50:24.461Z","dependency_job_id":"b789bc2a-327c-4192-a880-db5364d81f53","html_url":"https://github.com/woctezuma/stable-diffusion-safety-checker","commit_stats":null,"previous_names":["woctezuma/stable-diffusion-safety-checker"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/woctezuma/stable-diffusion-safety-checker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woctezuma%2Fstable-diffusion-safety-checker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woctezuma%2Fstable-diffusion-safety-checker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woctezuma%2Fstable-diffusion-safety-checker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woctezuma%2Fstable-diffusion-safety-checker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/woctezuma","download_url":"https://codeload.github.com/woctezuma/stable-diffusion-safety-checker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/woctezuma%2Fstable-diffusion-safety-checker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264830109,"owners_count":23670226,"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":["colab","colab-notebook","colaboratory","deep-learning","diffusers","diffusion","google-colab","google-colab-notebook","google-colaboratory","nsfw","nsfw-classifier","nsfw-detection","nsfw-detector","nsfw-recognition","safety","safety-check","safety-checker","safety-checks","stable-diffusion","transformers"],"created_at":"2024-12-06T06:09:27.935Z","updated_at":"2025-07-11T14:08:17.465Z","avatar_url":"https://github.com/woctezuma.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stable Diffusion Safety Checker\n\nThe goal of this repository is to run the [safety checker][huggingface-safety-checker] from [Stable Diffusion][huggingface-stable-diffusion].\n\n## Requirements\n\n- Install the latest version of [Python 3][python-download-url].\n- Install the required packages:\n\n```bash\n!pip install git+https://github.com/woctezuma/stable-diffusion-safety-checker.git\n```\n\n## Usage\n\n- Run the main script with:\n\n```bash\n!python -m safety_checker.check_safety -h\n```\n\n- Alternatively, run [`safety_checker.ipynb`][colab-notebook-safety-checker].\n[![Open In Colab][colab-badge]][colab-notebook-safety-checker]\n\n## Example\n\nDownload the `balloon` image dataset.\n```bash\nfname = \"balloon_dataset.zip\"\n!curl -OL https://github.com/matterport/Mask_RCNN/releases/download/v2.1/{fname}\n!unzip -q {fname}\n```\n\nRun the script:\n```bash\n!python -m safety_checker.check_safety \\\n --input balloon \\\n --batch 8 \\\n --resize 256 \\\n --keep-ratio \\\n --output bad_concepts.json \\\n --scores bad_concepts_scores.pth \\\n --list img_list.json \\\n --verbose\n```\n\nCheck the results:\n\n```python\nimport json\n\nfrom pathlib import Path\n\nwith Path(\"bad_concepts.json\").open(encoding='utf8') as f:\n  results = json.load(f)\n```\n\nThe IDs of the \"bad concepts\" are clarified on [this page][bad-concepts] hosted by LAION-AI.\n\n## References\n\n- [`feature-extractor`][feature-extractor]: similar code to extract image features,\n- [`discord-members-metadata`][data-discord]: profiles pictures scraped from a specific Discord guild's members.\n\n\u003c!-- Definitions --\u003e\n\n[huggingface-safety-checker]: \u003chttps://huggingface.co/CompVis/stable-diffusion-safety-checker\u003e\n[huggingface-stable-diffusion]: \u003chttps://huggingface.co/CompVis/stable-diffusion\u003e\n\n[python-download-url]: \u003chttps://www.python.org/downloads/\u003e\n[bad-concepts]: \u003chttps://github.com/LAION-AI/CLIP-based-NSFW-Detector/blob/main/safety_settings.yml\u003e\n\n[feature-extractor]: \u003chttps://github.com/woctezuma/feature-extractor\u003e\n[data-discord]: \u003chttps://github.com/woctezuma/discord-members-metadata\u003e\n\n[colab-notebook-safety-checker]: \u003chttps://colab.research.google.com/github/woctezuma/stable-diffusion-safety-checker/blob/main/safety_checker.ipynb\u003e\n[colab-badge]: \u003chttps://colab.research.google.com/assets/colab-badge.svg\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoctezuma%2Fstable-diffusion-safety-checker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwoctezuma%2Fstable-diffusion-safety-checker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwoctezuma%2Fstable-diffusion-safety-checker/lists"}