File size: 7,810 Bytes
8b36302
 
 
 
 
 
 
d6977bc
8b36302
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
212
213
214
215
216
217
218
219
220
221
222
223
{
  "cells": [
    {
      "cell_type": "code",
      "source": [
        "!git clone https://github.com/bamps53/diffusers\n",
        "%cd diffusers\n",
        "!git checkout 734be90e4ee4362c44cb2fdd4be26a19962ec9ec\n",
        "!pip install -q -e \".[dev]\""
      ],
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "ZNgWSJQ-BViA",
        "outputId": "f57c7bf5-2b70-4861-858a-bf3dec0f3690"
      },
      "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": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "pdpDJAul40ZB",
        "outputId": "0f86603d-cef1-4a23-b2b6-afc3a4390522"
      },
      "id": "pdpDJAul40ZB",
      "execution_count": 2,
      "outputs": [
        {
          "output_type": "stream",
          "name": "stdout",
          "text": [
            "--2024-02-08 13:47:00--  https://huggingface.co/sayakpaul/test-model-card-template-dreambooth/resolve/main/image_0.png\n",
            "Resolving huggingface.co (huggingface.co)... 3.163.189.114, 3.163.189.37, 3.163.189.90, ...\n",
            "Connecting to huggingface.co (huggingface.co)|3.163.189.114|:443... connected.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: 386612 (378K) [image/png]\n",
            "Saving to: ‘image_0.png’\n",
            "\n",
            "image_0.png         100%[===================>] 377.55K  --.-KB/s    in 0.1s    \n",
            "\n",
            "2024-02-08 13:47:00 (2.84 MB/s) - ‘image_0.png’ saved [386612/386612]\n",
            "\n",
            "--2024-02-08 13:47:00--  https://huggingface.co/sayakpaul/test-model-card-template-dreambooth/resolve/main/image_1.png\n",
            "Resolving huggingface.co (huggingface.co)... 3.163.189.114, 3.163.189.37, 3.163.189.90, ...\n",
            "Connecting to huggingface.co (huggingface.co)|3.163.189.114|: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  --.-KB/s    in 0.03s   \n",
            "\n",
            "2024-02-08 13:47:00 (14.1 MB/s) - ‘image_1.png’ saved [386612/386612]\n",
            "\n",
            "--2024-02-08 13:47:00--  https://huggingface.co/sayakpaul/test-model-card-template-dreambooth/resolve/main/image_2.png\n",
            "Resolving huggingface.co (huggingface.co)... 3.163.189.114, 3.163.189.37, 3.163.189.90, ...\n",
            "Connecting to huggingface.co (huggingface.co)|3.163.189.114|: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  --.-KB/s    in 0.07s   \n",
            "\n",
            "2024-02-08 13:47:01 (5.29 MB/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_flax 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": 4,
      "outputs": []
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "id": "b19ff19c-fff0-469f-b004-dd731edbffa9",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "b19ff19c-fff0-469f-b004-dd731edbffa9",
        "outputId": "0092c531-70b6-40c0-de0b-2c79e01786df"
      },
      "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",
            "- jax-diffusers-event\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. You can find some example images in the following. \n",
            "\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
}