Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Pau-Lozano committed Oct 17, 2023
0 parents commit d4690d2
Show file tree
Hide file tree
Showing 13 changed files with 2,608 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Cog SDXL Canny ControlNet with LoRA support

[![Replicate demo and cloud API](https://replicate.com/stability-ai/sdxl/badge)](https://replicate.com/batouresearch/sdxl-controlnet-lora)

This is an implementation of Stability AI's [SDXL](https://github.com/Stability-AI/generative-models) as a [Cog](https://github.com/replicate/cog) model with ControlNet and Replicate's LoRA support.

## Basic Usage

For prediction:

```bash
cog predict -i prompt="shot in the style of sksfer, ..." -i image=@image.png -i lora_weights="https://pbxt.replicate.delivery/mwN3AFyYZyouOB03Uhw8ubKW9rpqMgdtL9zYV9GF2WGDiwbE/trained_model.tar"
```
You may need to increase the default `lora_scale` value to big values such as <strong>0.8 ... 0.95</strong>.

## Limitations
- `lora_weights` only accepts models trained in Replicate and is a mandatory parameter.
- `expert_ensemble_refiner` is currently not supported, you can use `base_image_refiner` instead.
- For the moment, the model only uses canny as the conditional image.

<br>
<strong>For further improvements of this project, feel free to fork and PR!</strong>
33 changes: 33 additions & 0 deletions cog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Configuration for Cog ⚙️
# Reference: https://github.com/replicate/cog/blob/main/docs/yaml.md

build:
gpu: true
cuda: "11.8"
python_version: "3.9"
system_packages:
- "libgl1-mesa-glx"
- "ffmpeg"
- "libsm6"
- "libxext6"
- "wget"
python_packages:
- "diffusers==0.21.4"
- "torch==2.0.1"
- "transformers==4.34.0"
- "invisible-watermark==0.2.0"
- "accelerate==0.21.0"
- "pandas==2.0.3"
- "torchvision==0.15.2"
- "numpy==1.25.1"
- "pandas==2.0.3"
- "fire==0.5.0"
- "opencv-python>=4.1.0.25"
- "mediapipe==0.10.2"

run:
- curl -o /usr/local/bin/pget -L "https://github.com/replicate/pget/releases/download/v0.0.3/pget" && chmod +x /usr/local/bin/pget
- wget http://thegiflibrary.tumblr.com/post/11565547760 -O face_landmarker_v2_with_blendshapes.task -q https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/1/face_landmarker.task

predict: "predict.py:Predictor"
train: "train.py:train"

0 comments on commit d4690d2

Please sign in to comment.