{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"machine_shape": "hm"
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
},
"accelerator": "GPU",
"gpuClass": "premium",
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"06b88ddd7a7f4f219d5143d558445a59": {
"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_2336c0a991d54ae0b72e442f8c3bc067",
"IPY_MODEL_d723ed8d752a44a08f34ad381868953c",
"IPY_MODEL_a69dab4944924df09bd4530b1fada113"
],
"layout": "IPY_MODEL_7dd38b2a3c284e2f8f625518dbb04997"
}
},
"2336c0a991d54ae0b72e442f8c3bc067": {
"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_e6b528ece6e1408789d9e4068899ebed",
"placeholder": "",
"style": "IPY_MODEL_dc06126b67ff41938640057d9d78256a",
"value": "Downloading: 100%"
}
},
"d723ed8d752a44a08f34ad381868953c": {
"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_04fc6526cff845edb45ed39294a71df6",
"max": 3944692325,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_3d8dc5a7af6144c29bfda78080ed83a4",
"value": 3944692325
}
},
"a69dab4944924df09bd4530b1fada113": {
"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_aaa1e7f1ce32409982c2d8746c234083",
"placeholder": "",
"style": "IPY_MODEL_1ca4f73e2a5d4954b03844c18d0b4db4",
"value": " 3.94G/3.94G [00:54<00:00, 74.9MB/s]"
}
},
"7dd38b2a3c284e2f8f625518dbb04997": {
"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
}
},
"e6b528ece6e1408789d9e4068899ebed": {
"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
}
},
"dc06126b67ff41938640057d9d78256a": {
"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": ""
}
},
"04fc6526cff845edb45ed39294a71df6": {
"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
}
},
"3d8dc5a7af6144c29bfda78080ed83a4": {
"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": ""
}
},
"aaa1e7f1ce32409982c2d8746c234083": {
"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
}
},
"1ca4f73e2a5d4954b03844c18d0b4db4": {
"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": ""
}
},
"4d23377adc3b4ea4a1d713f832ea1f58": {
"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_7aba7fbd76134c8b8fc18a16a492df56",
"IPY_MODEL_d69c1b35735d452c9691ef53a240ea91",
"IPY_MODEL_dc0c1075746946189a4af37e0bdbee93"
],
"layout": "IPY_MODEL_3b1b50d04a5e4c629687def09ab84cb8"
}
},
"7aba7fbd76134c8b8fc18a16a492df56": {
"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_48dd7695d798418da65858cd623310af",
"placeholder": "",
"style": "IPY_MODEL_07182046b1ba48deba029ebe6e3ef220",
"value": "computing transition: 100%"
}
},
"d69c1b35735d452c9691ef53a240ea91": {
"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_aad1cb753ffd4abfa21db47798410820",
"max": 11,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_478e72ecc1ac43e9a91b4b0e6c0242af",
"value": 11
}
},
"dc0c1075746946189a4af37e0bdbee93": {
"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_ce729b0d535142df9c7265c32fc4bc3b",
"placeholder": "",
"style": "IPY_MODEL_5d47c099526e4c60adedf7a43bf35efc",
"value": " 11/11 [00:09<00:00, 1.13it/s]"
}
},
"3b1b50d04a5e4c629687def09ab84cb8": {
"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
}
},
"48dd7695d798418da65858cd623310af": {
"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
}
},
"07182046b1ba48deba029ebe6e3ef220": {
"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": ""
}
},
"aad1cb753ffd4abfa21db47798410820": {
"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
}
},
"478e72ecc1ac43e9a91b4b0e6c0242af": {
"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": ""
}
},
"ce729b0d535142df9c7265c32fc4bc3b": {
"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
}
},
"5d47c099526e4c60adedf7a43bf35efc": {
"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": ""
}
}
}
}
},
"cells": [
{
"cell_type": "code",
"source": [
"#@markdown # **Latent Blending Repository Download**\n",
"#@markdown ----\n",
"!git clone https://github.com/lunarring/latentblending.git\n",
"%cd latentblending"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "xOrehLq4KX8y",
"outputId": "4148ea80-f815-4aeb-95ec-f4737599b895"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"/content/latentblending\n"
]
}
]
},
{
"cell_type": "code",
"source": [
"#@markdown # **Install Dependencies**\n",
"#@markdown ----\n",
"!pip install -r requirements.txt --quiet\n",
"!pip install -e . --quiet"
],
"metadata": {
"id": "kolPBQsBPs01"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"#@markdown # **Checkpoint Downloader**\n",
"#@markdown ----\n",
"model_download='https://huggingface.co/stabilityai/stable-diffusion-2-1/resolve/main/v2-1_768-ema-pruned.ckpt' #@param {type:\"string\"}\n",
"\n",
"!wget $model_download"
],
"metadata": {
"id": "nFRa2Db3MSPD"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 153,
"referenced_widgets": [
"06b88ddd7a7f4f219d5143d558445a59",
"2336c0a991d54ae0b72e442f8c3bc067",
"d723ed8d752a44a08f34ad381868953c",
"a69dab4944924df09bd4530b1fada113",
"7dd38b2a3c284e2f8f625518dbb04997",
"e6b528ece6e1408789d9e4068899ebed",
"dc06126b67ff41938640057d9d78256a",
"04fc6526cff845edb45ed39294a71df6",
"3d8dc5a7af6144c29bfda78080ed83a4",
"aaa1e7f1ce32409982c2d8746c234083",
"1ca4f73e2a5d4954b03844c18d0b4db4"
]
},
"id": "li_jnabWKRIs",
"outputId": "056d0c2a-8341-4c01-8558-2f2435511138"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"LatentDiffusion: Running in v-prediction mode\n",
"DiffusionWrapper has 865.91 M params.\n",
"making attention of type 'vanilla' with 512 in_channels\n",
"Working with z of shape (1, 4, 32, 32) = 4096 dimensions.\n",
"making attention of type 'vanilla' with 512 in_channels\n"
]
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"Downloading: 0%| | 0.00/3.94G [00:00, ?B/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "06b88ddd7a7f4f219d5143d558445a59"
}
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"autosetup_branching: num_inference_steps: 15 list_nmb_branches: [2, 3, 6] list_injection_idx: [0, 9, 12]\n"
]
}
],
"source": [
"import os, sys\n",
"import torch\n",
"torch.backends.cudnn.benchmark = False\n",
"import numpy as np\n",
"import warnings\n",
"warnings.filterwarnings('ignore')\n",
"import warnings\n",
"import torch\n",
"from tqdm.auto import tqdm\n",
"from PIL import Image\n",
"# import matplotlib.pyplot as plt\n",
"import torch\n",
"from movie_util import MovieSaver\n",
"from typing import Callable, List, Optional, Union\n",
"from latent_blending import LatentBlending, add_frames_linear_interp\n",
"from stable_diffusion_holder import StableDiffusionHolder\n",
"import os\n",
"from tqdm import tqdm\n",
"from IPython.display import HTML\n",
"from base64 import b64encode\n",
"import gc\n",
"import torch\n",
"\n",
"torch.set_grad_enabled(False)\n",
"gc.collect()\n",
"torch.cuda.empty_cache()\n",
"\n",
"#@markdown # **Checkpoint Configuration**\n",
"#@markdown ----\n",
"\n",
"fp_ckpt = '/content/latentblending/v2-1_768-ema-pruned.ckpt' #@param {type:\"string\"} \n",
"fp_config = '/content/latentblending/configs/v2-inference-v.yaml' #@param {type:\"string\"} \n",
"\n",
"sdh = StableDiffusionHolder(fp_ckpt=fp_ckpt, fp_config=fp_config) \n",
"lb = LatentBlending(sdh)\n"
]
},
{
"cell_type": "code",
"source": [
"#@markdown # **Parameter Configuration**\n",
"#@markdown ----\n",
"quality = 'low' #@param {type:\"string\"}\n",
"depth_strength = 0.6 #@param {type:\"number\"}\n",
"seed1 = 235235235 #@param {type:\"number\"}\n",
"seed2 = 23423526 #@param {type:\"number\"}\n",
"fixed_seeds = [seed1, seed2] \n",
"\n",
"prompt1 = \"a beautiful painting of a cyberpunk city by sergey kolesov and pascal blanche and greg rutkowski and sachin teng. in style of digital art. colorful comic, symmetry, hyper detailed. octane render. trending on artstation \" #@param {type:\"string\"} \n",
"\n",
"prompt2 = \"a beautiful portrait painting of a cyberpunk armor by simon stalenhag and pascal blanche and alphonse mucha and nekro. in style of digital art. colorful comic, film noirs, symmetry, brush stroke, vibrating colors, hyper detailed. octane render. trending on artstation \" #@param {type:\"string\"} \n",
"\n",
"# In seconds\n",
"duration_transition = 12 #@param {type:\"number\"} \n",
" \n",
"fps = 30 #@param {type:\"number\"}\n",
"\n",
"lb.load_branching_profile(quality=quality, depth_strength=depth_strength)\n",
"lb.set_prompt1(prompt1)\n",
"lb.set_prompt2(prompt2)\n",
"\n",
"imgs_transition = lb.run_transition(fixed_seeds=fixed_seeds)\n",
"\n",
"imgs_transition_ext = add_frames_linear_interp(imgs_transition, duration_transition, fps)\n",
"\n",
"# Save as MP4\n",
"fp_movie = \"movie_example1.mp4\"\n",
"if os.path.isfile(fp_movie):\n",
" os.remove(fp_movie)\n",
"ms = MovieSaver(fp_movie, fps=fps, shape_hw=[sdh.height, sdh.width])\n",
"for img in tqdm(imgs_transition_ext):\n",
" ms.write_frame(img)\n",
"ms.finalize()\n",
"\n",
"def visualize_video_colab(video_path):\n",
" mp4 = open(video_path,'rb').read()\n",
" data_url = \"data:video/mp4;base64,\" + b64encode(mp4).decode()\n",
" return HTML(\"\"\"\n",
" \n",
" \"\"\" % data_url)\n",
"\n",
"\n",
"\n",
"visualize_video_colab(fp_movie)\n",
"\n"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 557,
"referenced_widgets": [
"4d23377adc3b4ea4a1d713f832ea1f58",
"7aba7fbd76134c8b8fc18a16a492df56",
"d69c1b35735d452c9691ef53a240ea91",
"dc0c1075746946189a4af37e0bdbee93",
"3b1b50d04a5e4c629687def09ab84cb8",
"48dd7695d798418da65858cd623310af",
"07182046b1ba48deba029ebe6e3ef220",
"aad1cb753ffd4abfa21db47798410820",
"478e72ecc1ac43e9a91b4b0e6c0242af",
"ce729b0d535142df9c7265c32fc4bc3b",
"5d47c099526e4c60adedf7a43bf35efc"
]
},
"id": "5QuVVl2-0xAh",
"outputId": "afd08806-35ac-4126-92a3-bf3a185056c2"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"autosetup_branching: num_inference_steps: 15 list_nmb_branches: [2, 3, 6] list_injection_idx: [0, 9, 12]\n"
]
},
{
"output_type": "display_data",
"data": {
"text/plain": [
"computing transition: 0%| | 0/11 [00:00, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "4d23377adc3b4ea4a1d713f832ea1f58"
}
},
"metadata": {}
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"Initialization done. Movie shape: (768, 768, 3)\n",
"MovieSaver initialized. fps=30 crf=24 pix_fmt=yuv420p codec=libx264 preset=fast\n"
]
},
{
"output_type": "stream",
"name": "stderr",
"text": [
"100%|██████████| 360/360 [00:04<00:00, 83.42it/s]\n"
]
},
{
"output_type": "stream",
"name": "stdout",
"text": [
"Movie saved, 12s playtime, watch here: \n",
"movie_example1.mp4\n"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
""
],
"text/html": [
"\n",
" \n",
" "
]
},
"metadata": {},
"execution_count": 15
}
]
}
]
}