{ "cells": [ { "cell_type": "code", "source": [ "!git clone https://github.com/bamps53/diffusers\n", "%cd diffusers\n", "!git checkout b659199982a8c1c807c67938166a005152e6a0a4\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_sdxl 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": { "colab": { "base_uri": "https://localhost:8080/", "height": 190, "referenced_widgets": [ "6af63801222041e084b8dcc7d9717ea0", "e7db57b5a4604482a9c3f6a583c229ad", "b40041c9437a4a908a9408d6332a8b40", "78e8a8b996cc44138e8afcf00264be7c", "442696138b0f431e93e0fa7ac7bd5f6d", "aec159b072b64f1a8f5d28c09f2a0724", "57b051e7336947c5bab73128a0b50996", "39688812a2ff48bf9a77025ad5e0c55b", "8fcc3694f4e44f528b257dffe7e46f30", "3491736d5fa044db9da7df84d0bcf4d3", "b7060bfb30304f22a16f0a557e32bbe3" ] }, "id": "v7vs7eQyDeX1", "outputId": "2dc7fcf4-b6ec-4ee4-b951-872f28e510d0" }, "id": "v7vs7eQyDeX1", "execution_count": 2, "outputs": [ { "output_type": "stream", "name": "stderr", "text": [ "The cache for model files in Transformers v4.22.0 has been updated. Migrating your old cache. This is a one-time only operation. You can interrupt this and resume the migration later on by calling `transformers.utils.move_cache()`.\n" ] }, { "output_type": "display_data", "data": { "text/plain": [ "0it [00:00, ?it/s]" ], "application/vnd.jupyter.widget-view+json": { "version_major": 2, "version_minor": 0, "model_id": "6af63801222041e084b8dcc7d9717ea0" } }, "metadata": {} }, { "output_type": "stream", "name": "stderr", "text": [ "/usr/local/lib/python3.10/dist-packages/huggingface_hub/utils/_token.py:88: UserWarning: \n", "The secret `HF_TOKEN` does not exist in your Colab secrets.\n", "To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.\n", "You will be able to reuse this secret in all of your notebooks.\n", "Please note that authentication is recommended but still optional to access public models or datasets.\n", " warnings.warn(\n" ] } ] }, { "cell_type": "code", "execution_count": 3, "id": "b19ff19c-fff0-469f-b004-dd731edbffa9", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "b19ff19c-fff0-469f-b004-dd731edbffa9", "outputId": "f1248d0f-9909-44b5-d0e8-72ceab6640a2" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "---\n", "license: openrail++\n", "library_name: diffusers\n", "tags:\n", "- stable-diffusion-xl\n", "- stable-diffusion-xl-diffusers\n", "- text-to-image\n", "- diffusers\n", "- controlnet\n", "inference: true\n", "base_model: runwayml/stable-diffusion-v1-5\n", "---\n", "\n", "\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", "widgets": { "application/vnd.jupyter.widget-state+json": { "6af63801222041e084b8dcc7d9717ea0": { "model_module": "@jupyter-widgets/controls", "model_name": "HBoxModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HBoxModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HBoxView", "box_style": "", "children": [ "IPY_MODEL_e7db57b5a4604482a9c3f6a583c229ad", "IPY_MODEL_b40041c9437a4a908a9408d6332a8b40", "IPY_MODEL_78e8a8b996cc44138e8afcf00264be7c" ], "layout": "IPY_MODEL_442696138b0f431e93e0fa7ac7bd5f6d" } }, "e7db57b5a4604482a9c3f6a583c229ad": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_aec159b072b64f1a8f5d28c09f2a0724", "placeholder": "​", "style": "IPY_MODEL_57b051e7336947c5bab73128a0b50996", "value": "" } }, "b40041c9437a4a908a9408d6332a8b40": { "model_module": "@jupyter-widgets/controls", "model_name": "FloatProgressModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "FloatProgressModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "ProgressView", "bar_style": "success", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_39688812a2ff48bf9a77025ad5e0c55b", "max": 1, "min": 0, "orientation": "horizontal", "style": "IPY_MODEL_8fcc3694f4e44f528b257dffe7e46f30", "value": 0 } }, "78e8a8b996cc44138e8afcf00264be7c": { "model_module": "@jupyter-widgets/controls", "model_name": "HTMLModel", "model_module_version": "1.5.0", "state": { "_dom_classes": [], "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "HTMLModel", "_view_count": null, "_view_module": "@jupyter-widgets/controls", "_view_module_version": "1.5.0", "_view_name": "HTMLView", "description": "", "description_tooltip": null, "layout": "IPY_MODEL_3491736d5fa044db9da7df84d0bcf4d3", "placeholder": "​", "style": "IPY_MODEL_b7060bfb30304f22a16f0a557e32bbe3", "value": " 0/0 [00:00<?, ?it/s]" } }, "442696138b0f431e93e0fa7ac7bd5f6d": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "aec159b072b64f1a8f5d28c09f2a0724": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "57b051e7336947c5bab73128a0b50996": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } }, "39688812a2ff48bf9a77025ad5e0c55b": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": "20px" } }, "8fcc3694f4e44f528b257dffe7e46f30": { "model_module": "@jupyter-widgets/controls", "model_name": "ProgressStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "ProgressStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "bar_color": null, "description_width": "" } }, "3491736d5fa044db9da7df84d0bcf4d3": { "model_module": "@jupyter-widgets/base", "model_name": "LayoutModel", "model_module_version": "1.2.0", "state": { "_model_module": "@jupyter-widgets/base", "_model_module_version": "1.2.0", "_model_name": "LayoutModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "LayoutView", "align_content": null, "align_items": null, "align_self": null, "border": null, "bottom": null, "display": null, "flex": null, "flex_flow": null, "grid_area": null, "grid_auto_columns": null, "grid_auto_flow": null, "grid_auto_rows": null, "grid_column": null, "grid_gap": null, "grid_row": null, "grid_template_areas": null, "grid_template_columns": null, "grid_template_rows": null, "height": null, "justify_content": null, "justify_items": null, "left": null, "margin": null, "max_height": null, "max_width": null, "min_height": null, "min_width": null, "object_fit": null, "object_position": null, "order": null, "overflow": null, "overflow_x": null, "overflow_y": null, "padding": null, "right": null, "top": null, "visibility": null, "width": null } }, "b7060bfb30304f22a16f0a557e32bbe3": { "model_module": "@jupyter-widgets/controls", "model_name": "DescriptionStyleModel", "model_module_version": "1.5.0", "state": { "_model_module": "@jupyter-widgets/controls", "_model_module_version": "1.5.0", "_model_name": "DescriptionStyleModel", "_view_count": null, "_view_module": "@jupyter-widgets/base", "_view_module_version": "1.2.0", "_view_name": "StyleView", "description_width": "" } } } } }, "nbformat": 4, "nbformat_minor": 5 }