Update README.md
Browse files
README.md
CHANGED
|
@@ -61,8 +61,41 @@ Weights for this model are available in Safetensors format.
|
|
| 61 |
|
| 62 |
#### How to use
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
```python
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
```
|
| 67 |
|
| 68 |
#### Limitations and bias
|
|
|
|
| 61 |
|
| 62 |
#### How to use
|
| 63 |
|
| 64 |
+
```bash
|
| 65 |
+
# Create and activate conda environment
|
| 66 |
+
conda create –name dreambooth python=3.10
|
| 67 |
+
conda activate dreambooth
|
| 68 |
+
|
| 69 |
+
# Install ipykernel (needed only if you want to run the inference inside a jupyter-notebook)
|
| 70 |
+
conda install -c anaconda ipykernel
|
| 71 |
+
python -m ipykernel install --user --name=dreambooth
|
| 72 |
+
|
| 73 |
+
# Clone and install diffusers package
|
| 74 |
+
git clone https://github.com/huggingface/diffusers
|
| 75 |
+
cd diffusers
|
| 76 |
+
pip install -e .
|
| 77 |
+
|
| 78 |
+
# Browse to examples/dreambooth directory in the diffusers installation directory
|
| 79 |
+
cd examples/dreambooth
|
| 80 |
+
|
| 81 |
+
# Install dreambooth sdxl training dependencies
|
| 82 |
+
pip install -r requirements_sdxl.txt
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
```python
|
| 86 |
+
from huggingface_hub.repocard import RepoCard
|
| 87 |
+
from diffusers import DiffusionPipeline
|
| 88 |
+
import torch
|
| 89 |
+
|
| 90 |
+
lora_model_id = "DKTech/dreambooth-test-1"
|
| 91 |
+
card = RepoCard.load(lora_model_id)
|
| 92 |
+
base_model_id = card.data.to_dict()["base_model"]
|
| 93 |
+
|
| 94 |
+
pipe = DiffusionPipeline.from_pretrained(base_model_id, torch_dtype=torch.float16)
|
| 95 |
+
pipe = pipe.to("cuda")
|
| 96 |
+
pipe.load_lora_weights(lora_model_id)
|
| 97 |
+
image = pipe("A picture of an elephant that looks like a dog.", num_inference_steps=25).images[0]
|
| 98 |
+
image.save("my_image.png")
|
| 99 |
```
|
| 100 |
|
| 101 |
#### Limitations and bias
|