Skip to content

HopeArtOrg/hope-algorithms

Hope:RE Algorithms

This repository contains the core adversarial perturbation algorithms used in Hope:RE to protect digital art from unauthorized AI training.

Overview

The algorithms implement CLIP-based adversarial attacks to inject imperceptible noise into images, specifically targeting training pipelines of Diffusion models and other generative AI architectures.

Notebooks

The notebooks follow a sequential pipeline for development, testing, and ONNX export:

  1. 0_setup_colab.ipynb: Environment setup and dependency installation for Google Colab.
  2. 1_clip_to_jax.ipynb: Integration of OpenAI CLIP models with the JAX framework for high-performance gradient computation.
  3. 2_noise_algorithm.ipynb: Implementation of the base adversarial perturbation engine.
  4. 3_glaze_algorithm.ipynb: Specialized algorithm for style protection (inspired by Glaze).
  5. 4_nightshade_algorithm.ipynb: Specialized algorithm for concept "poisoning" (inspired by Nightshade).
  6. 5_export_onnx.ipynb: Conversion of JAX/Python models to ONNX format for deployment in the Hope:RE desktop application.

Setup

To run these notebooks, it is recommended to use Google Colab with a GPU runtime (T4, A100, or V100).

Dependencies

Primary dependencies include:

  • JAX & Flax
  • PyTorch (for CLIP weight loading)
  • OpenAI CLIP
  • ONNX & ONNX Runtime

Full list of requirements can be found in equirements.txt.

License

MIT

About

The implementations of Nightshade / Glaze / Noise in JAX Python models with Google Colab, which build the hope-re app

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors