Skip to content

Implements Seed Checker#18

Draft
Clydingus wants to merge 11 commits intomainfrom
safety
Draft

Implements Seed Checker#18
Clydingus wants to merge 11 commits intomainfrom
safety

Conversation

@Clydingus
Copy link
Collaborator

@Clydingus Clydingus commented Feb 4, 2026

Fixes #15 and #10.

Implements nsfw seed checker with https://huggingface.co/Freepik/nsfw_image_detector.

  • Blocks images with 'low' NSFW score or above
  • Automatic model unloading after checks to free GPU memory
  • Conservative error handling (fails closed - unsafe on error)
  • SHA256 hash-based file tracking, non-human readable serialised cache that skips re-checking unchanged files

Also includes a restructure to server-components to run as a single unified server on port 7987: server.py (bridge), world_engine.py (generation), safety.py (NSFW detection)
Previous implementation was some hybrid client-server setup that had client managing the seed directory. The new implementation now allocates seed directory, safety checking and seed image integrity verification on server side. Having the safety checks be performed server side also ensures that if the server is hosted on separate device as the client, the safeties and generations are still authorised by the server process.

Current behaviour is that unsafe files hidden from UI (not deleted) and warns user about hidden files.

@Clydingus Clydingus requested a review from philpax February 4, 2026 06:56
@Clydingus Clydingus self-assigned this Feb 4, 2026
Copy link
Contributor

@philpax philpax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code seems reasonable.

Only thing that I'm unsure about: ensure we run the safetychecker before giving the image to the WM, if you aren't already; you don't want someone to modify the safety cache or swap in an image after it's already been checked. You can keep an in-memory cache for seeds (by hash?) to make this a bit less painful for revisiting the same seed.

Oh, and fix the CI, but that's a given

@philpax
Copy link
Contributor

philpax commented Feb 4, 2026

Note to self before merge: disable W8A8 quant, we're not supposed to run the model with a quant

@Clydingus
Copy link
Collaborator Author

Fixes #19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Safety filter via local NSFW classifier model

2 participants