File size: 7,006 Bytes
a08d4f1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
{
"cells": [
{
"cell_type": "code",
"source": [
"!git clone https://github.com/bamps53/diffusers\n",
"%cd diffusers\n",
"!git checkout 2b8f0991f46749f22aa1394f19a80275d27d3fb9\n",
"!pip install -e \".[dev]\""
],
"metadata": {
"id": "ZNgWSJQ-BViA",
"outputId": "3956d806-fc52-467d-e73f-a09961ed147d",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"id": "ZNgWSJQ-BViA",
"execution_count": 1,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"/content/diffusers\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"!wget https://huggingface.co/sayakpaul/test-model-card-template-dreambooth/resolve/main/image_0.png\n",
"!wget https://huggingface.co/sayakpaul/test-model-card-template-dreambooth/resolve/main/image_1.png\n",
"!wget https://huggingface.co/sayakpaul/test-model-card-template-dreambooth/resolve/main/image_2.png"
],
"metadata": {
"id": "pdpDJAul40ZB",
"outputId": "d6dbe2fa-c611-48dc-ed28-af4341f0e33e",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"id": "pdpDJAul40ZB",
"execution_count": 8,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"--2024-02-08 13:23:49-- https://huggingface.co/sayakpaul/test-model-card-template-dreambooth/resolve/main/image_1.png\n",
"Resolving huggingface.co (huggingface.co)... 18.67.181.126, 18.67.181.36, 18.67.181.124, ...\n",
"Connecting to huggingface.co (huggingface.co)|18.67.181.126|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 386612 (378K) [image/png]\n",
"Saving to: ‘image_1.png’\n",
"\n",
"image_1.png 100%[===================>] 377.55K 501KB/s in 0.8s \n",
"\n",
"2024-02-08 13:23:50 (501 KB/s) - ‘image_1.png’ saved [386612/386612]\n",
"\n",
"--2024-02-08 13:23:51-- https://huggingface.co/sayakpaul/test-model-card-template-dreambooth/resolve/main/image_2.png\n",
"Resolving huggingface.co (huggingface.co)... 18.67.181.126, 18.67.181.36, 18.67.181.124, ...\n",
"Connecting to huggingface.co (huggingface.co)|18.67.181.126|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 386612 (378K) [image/png]\n",
"Saving to: ‘image_2.png’\n",
"\n",
"image_2.png 100%[===================>] 377.55K 503KB/s in 0.8s \n",
"\n",
"2024-02-08 13:23:52 (503 KB/s) - ‘image_2.png’ saved [386612/386612]\n",
"\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"from diffusers.utils import load_image\n",
"from examples.controlnet.train_controlnet import save_model_card\n",
"\n",
"images = [load_image(f\"image_{i}.png\") for i in range(3)]\n",
"\n",
"image_logs = [\n",
" dict(\n",
" images=[image],\n",
" validation_prompt=\"validation_prompt\",\n",
" validation_image=image,\n",
" )\n",
" for image in images\n",
"]\n",
"save_model_card(\n",
" repo_id=\"camaro/test\",\n",
" image_logs=image_logs,\n",
" base_model=\"runwayml/stable-diffusion-v1-5\",\n",
" repo_folder=\".\",\n",
")"
],
"metadata": {
"id": "v7vs7eQyDeX1"
},
"id": "v7vs7eQyDeX1",
"execution_count": 9,
"outputs": []
},
{
"cell_type": "code",
"execution_count": 10,
"id": "b19ff19c-fff0-469f-b004-dd731edbffa9",
"metadata": {
"id": "b19ff19c-fff0-469f-b004-dd731edbffa9",
"outputId": "b8682622-e0ce-4015-91a3-2e5b018f1c4f",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"---\n",
"license: creativeml-openrail-m\n",
"library_name: diffusers\n",
"tags:\n",
"- stable-diffusion\n",
"- stable-diffusion-diffusers\n",
"- text-to-image\n",
"- diffusers\n",
"- controlnet\n",
"inference: true\n",
"base_model: runwayml/stable-diffusion-v1-5\n",
"---\n",
"\n",
"<!-- This model card has been generated automatically according to the information the training script had access to. You\n",
"should probably proofread and complete it, then remove this comment. -->\n",
"\n",
"\n",
"# controlnet-camaro/test\n",
"\n",
"These are controlnet weights trained on runwayml/stable-diffusion-v1-5 with new type of conditioning.\n",
"You can find some example images below.\n",
"prompt: validation_prompt\n",
"![images_0)](./images_0.png)\n",
"prompt: validation_prompt\n",
"![images_1)](./images_1.png)\n",
"prompt: validation_prompt\n",
"![images_2)](./images_2.png)\n",
"\n",
"\n",
"\n",
"## Intended uses & limitations\n",
"\n",
"#### How to use\n",
"\n",
"```python\n",
"# TODO: add an example code snippet for running this diffusion pipeline\n",
"```\n",
"\n",
"#### Limitations and bias\n",
"\n",
"[TODO: provide examples of latent issues and potential remediations]\n",
"\n",
"## Training details\n",
"\n",
"[TODO: describe the data used to train the model]"
]
}
],
"source": [
"!cat README.md"
]
},
{
"cell_type": "code",
"source": [],
"metadata": {
"id": "Y3uTj1bv5Amw"
},
"id": "Y3uTj1bv5Amw",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.17"
},
"colab": {
"provenance": [],
"gpuType": "T4"
},
"accelerator": "GPU"
},
"nbformat": 4,
"nbformat_minor": 5
} |