Image-to-Image
Diffusers
Safetensors
Core ML
StableDiffusionInpaintPipeline
image-editing
local-ai
clover-image
inpainting
stable-diffusion
Instructions to use neonforestmist/Clover-Image-Tiny-Inpaint with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use neonforestmist/Clover-Image-Tiny-Inpaint with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import AutoPipelineForInpainting from diffusers.utils import load_image # switch to "mps" for apple devices pipe = AutoPipelineForInpainting.from_pretrained("neonforestmist/Clover-Image-Tiny-Inpaint", dtype=torch.float16, device_map="cuda") img_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png" mask_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png" image = load_image(img_url).resize((1024, 1024)) mask_image = load_image(mask_url).resize((1024, 1024)) prompt = "a tiger sitting on a park bench" generator = torch.Generator(device="cuda").manual_seed(0) image = pipe( prompt=prompt, image=image, mask_image=mask_image, guidance_scale=8.0, num_inference_steps=20, # steps between 15 and 30 work well for us strength=0.99, # make sure to use `strength` below 1.0 generator=generator, ).images[0] - Notebooks
- Google Colab
- Kaggle
Add Modal training and inpainting model scaffold
Browse files12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061# Clover Image Tiny Inpainting
The inpainting model keeps Clover’s text encoder, VAE, scheduler, and safetychecker, and replaces only the U-Net with a 9-channel fine-tuned version.
The U-Net input is ordered as:
```text[noisy_latent (4), mask (1), masked_image_latent (4)]```
White mask pixels are regenerated; black pixels are preserved. Masks aresampled procedurally during training, so the dataset only needs image/captionpairs. The pinned default dataset is `prithivMLmods/Caption3o-Opt` at revision`17e893f785fcd3f5d6fc4a5d65a914b9f7b1ff5b` (Apache-2.0, `image` + `caption`).
## Modal
The local Modal CLI is already configured for the `guccichungus69` profile.Use that profile before running the commands below:
```bashmodal profile activate guccichungus69modal run modal_inpaint.py --smoke --steps 2modal run modal_inpaint.py --steps 4000```
The job uses one A10G and writes the finished Diffusers pipeline to the`clover-image-tiny-inpaint-output` Volume. No Hub token is required for thedefault public dataset. The estimated compute ceiling for the default four-hourjob is about $4 at $1/hour; the actual charge depends on runtime.
Download a completed output directory with:
```bashmodal volume get clover-image-tiny-inpaint-output \ clover-image-tiny-inpaint \ ./artifacts/clover-image-tiny-inpaint```
If a job stops before writing its final pipeline, the Volume retains any filesthat were committed. The current trainer saves only at the end, so use aseparate `--output-name` for retries.
## Local dry run
The same trainer can run locally when the model and dataset are available:
```bashpython inpainting/train.py \ --pretrained_model_name_or_path . \ --dataset_name prithivMLmods/Caption3o-Opt \ --dataset_revision 17e893f785fcd3f5d6fc4a5d65a914b9f7b1ff5b \ --max_train_samples 4 \ --max_train_steps 2 \ --output_dir /tmp/clover-image-tiny-inpaint-smoke```
The complete model is large enough that Modal is the intended trainingenvironment. The current repo’s Apple Core ML environment is for conversion,not PyTorch training.training/README-INPAINTING.mdAdded+61