- Technically, a heavily modified fork of:
- http://github.com/stanislavfort/Direct_Ascent_Synthesis
- With emphasis on heavily modified. Alas, please open an Issue on me if you encounter one.
The original author's code offers:
- Text to image generation
- "Style" transfer
- Image reconstruction from its CLIP embedding
This repo adds:
- Gradient Ascent on the Text Embeddings (use CLIP's own opinion about image as text prompt)
- Minimize cosine similarity (get an "anti-cat" opinion / antonym for a cat image OR a cat text prompt)
- Use 4. and 5. to generate images Direct Ascent Synthesis
- For a given input image, visualize the Neuron (MLP Feature) with the highest activation value.
- Add one (or all) layer's features / "neurons" to the image stack for processing
- Can be, in essence, a self-sustained loop of making EVERYTHING out of CLIP. No human input.
- ...And many more options & features!
Quick start fun, uses human text prompts:
python clip-generate.py --use_neuron --make_anti Uses the same default (cat) image as --img0, but gets a CLIP opinion about it (no human text input):
python clip-generate.py --use_neuron --make_anti --use_image images/cat.png Adds ALL features ('neurons') as images, changes primary image, changes text prompt 1:
python clip-generate.py --all_neurons --img0 images/eatcat.jpg --txt1 "backyardspaghetti lifestyledissertation" Loads a second CLIP model (open_clip), makes plots, CLIP opinion, adds second image --img1:
python clip-generate.py --custom_model2 'ViT-B-32' 'laion2b_s34b_b79k' --make_plots --make_lossplots --img1 dogface.png Loads fine-tuned OpenAI/CLIP model as primary, sets deterministic backends. OpenAI models must start with "OpenAI-".
python clip-generate.py --model_name "OpenAI-ViT-L/14" "mymodels/finetune.pt" --batch_size 16 --deterministic - There's a lot. But I left you lots of comments, too!
python clip-generate.py --helpfor a quick review.


