diff --git a/README.md b/README.md index 9ae75af..d613a6f 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ The goal of this project is to make Stable Diffusion more accessible, simple and **Installation:** ``` -pip install stablepy==0.5.0 +pip install stablepy==0.5.1 ``` **Usage:** @@ -37,7 +37,7 @@ model = Model_Diffusers( task_name= 'txt2img', ) -image, path_image = model( +image, info_image = model( prompt='highly detailed portrait of an underwater city, with towering spires and domes rising up from the ocean floor', num_steps = 30, guidance_scale = 7.5, @@ -61,7 +61,7 @@ model = Model_Diffusers( task_name= 'canny', ) -images, path_images = model( +images, info_image = model( prompt='highly detailed portrait of an underwater city, with towering spires and domes rising up from the ocean floor', num_steps = 30, image_resolution = 768, @@ -78,9 +78,14 @@ images, path_images = model( images[1] ``` -**📖 News:** +**📖 New Update Details:** -🔥 Version 0.5.0: New Update Details +🔥 Version 0.5.1: + +- After generation, PIL images are now returned along with sublists containing the seeds, image paths, and metadata with the parameters used in generation. `[pil_image], [seed, image_path, metadata]` +- The use of `image_previews=True` has been improved, and now preview images can be obtained during the generation steps using a generator. For more details, refer to the Colab notebook. + +🔥 Version 0.5.0: - Fix LoRA SDXL compatibility. - Latent upscaler and variants. @@ -90,7 +95,7 @@ images[1] - ControlNet "lineart_anime" task accessible and able to load a model different from the "lineart" task. - ControlNet Tile and Recolor for SD1.5 and SDXL ("tile" replaces the previous task called "sdxl_tile_realistic"). -🔥 Version 0.4.0: New Update Details +🔥 Version 0.4.0: - IP Adapter with the variants FaceID and Instant-Style - New samplers diff --git a/pyproject.toml b/pyproject.toml index 048e57c..21e33c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "stablepy" -version = "0.5.0" +version = "0.5.1" description = "A tool for easy use of stable diffusion" authors = ["Roger Condori(R3gm) "] readme = "README.md" diff --git a/stablepy/__version__.py b/stablepy/__version__.py index 3d18726..dd9b22c 100644 --- a/stablepy/__version__.py +++ b/stablepy/__version__.py @@ -1 +1 @@ -__version__ = "0.5.0" +__version__ = "0.5.1" diff --git a/stablepy_demo.ipynb b/stablepy_demo.ipynb index 677d6bc..b2b8492 100644 --- a/stablepy_demo.ipynb +++ b/stablepy_demo.ipynb @@ -3,8 +3,8 @@ { "cell_type": "markdown", "metadata": { - "id": "view-in-github", - "colab_type": "text" + "colab_type": "text", + "id": "view-in-github" }, "source": [ "\"Open" @@ -36,7 +36,7 @@ }, "outputs": [], "source": [ - "!pip install stablepy==0.5.0 -q" + "!pip install stablepy==0.5.1 -q" ] }, { @@ -309,26 +309,26 @@ }, { "cell_type": "markdown", + "metadata": { + "id": "V0-kKkqzbLwa" + }, "source": [ "The upscaler_model_path can be used with different ESRGAN models and can also be used with Lanczos, Nearest, or the variants of latent upscaler.\n", "Example: `upscaler_model_path=\"Latent (bicubic)\",`" - ], - "metadata": { - "id": "V0-kKkqzbLwa" - } + ] }, { "cell_type": "code", + "execution_count": null, + "metadata": { + "id": "Pc6cjdVfeOWM" + }, + "outputs": [], "source": [ "from stablepy import LATENT_UPSCALERS\n", "\n", "list(LATENT_UPSCALERS)" - ], - "metadata": { - "id": "Pc6cjdVfeOWM" - }, - "execution_count": null, - "outputs": [] + ] }, { "cell_type": "markdown", @@ -438,8 +438,8 @@ "|canny|\"None\" \"Canny\"|\n", "|mlsd|\"None\" \"MLSD\"|\n", "| openpose | \"None\" \"Openpose\" |\n", - "|scribble|\"None\" \"HED\" \"Pidinet\"|\n", - "|softedge|\"None\" \"HED\" \"Pidinet\" \"HED safe\" \"Pidinet safe\"|\n", + "|scribble|\"None\" \"HED\" \"PidiNet\"|\n", + "|softedge|\"None\" \"HED\" \"PidiNet\" \"HED safe\" \"PidiNet safe\"|\n", "|segmentation|\"None\" \"UPerNet\"|\n", "|depth|\"None\" \"DPT\" \"Midas\"|\n", "|normalbae|\"None\" \"NormalBae\"|\n", @@ -1062,6 +1062,9 @@ }, { "cell_type": "markdown", + "metadata": { + "id": "bF-15bKGT9W6" + }, "source": [ "- You can also use multiple images with a single IP adapter as follows by placing them in a list:\n", "\n", @@ -1073,10 +1076,7 @@ " ip_adapter_mode = [\"original\"],\n", "```\n", "\n" - ], - "metadata": { - "id": "bF-15bKGT9W6" - } + ] }, { "cell_type": "markdown", @@ -1201,6 +1201,7 @@ "model.load_pipe(\n", " base_model_id = repo,\n", " task_name = \"pattern\",\n", + " retain_task_model_in_cache=False,\n", ")\n", "\n", "images, image_list = model(\n", @@ -1215,6 +1216,92 @@ " display(image)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Displaying preview images during generation steps" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "model.load_pipe(\n", + " base_model_id = repo,\n", + " task_name = \"txt2img\",\n", + " retain_task_model_in_cache=False,\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "By setting `image_previews=True`, an iterable generator object for image previews will be created." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "stream = model(\n", + " prompt = \"a cat\",\n", + " negative_prompt = \"worst quality\",\n", + " sampler=\"DPM++ 2M SDE Lu\",\n", + " img_width = 768,\n", + " img_height = 768,\n", + " image_previews=True,\n", + ")\n", + "\n", + "# Iterate over the generator object to get each value\n", + "for img, info_img in stream:\n", + " display(img[0])\n", + " if info_img[1]:\n", + " print(info_img)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Config the stream parameters\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "model.stream_config(\n", + " concurrency=2,\n", + " latent_resize_by=1,\n", + " vae_decoding=False,\n", + ")" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "- **concurrency**: `int`\n", + " - **Default**: 5\n", + " - **Description**: Controls how often the preview images are generated and displayed in relation to the steps. For example, a value of 2 displays an image every 2 steps.\n", + "\n", + "- **latent_resize_by**: `int`\n", + " - **Default**: 8\n", + " - **Description**: Controls the scaling size of the latent images. A value of 1 is useful for achieving high performance.\n", + "\n", + "- **vae_decoding**: `bool`\n", + " - **Default**: `False`\n", + " - **Description**: Use the VAE to decode the preview images. If set to `True`, it may negatively impact performance." + ] + }, { "cell_type": "markdown", "metadata": { @@ -1279,8 +1366,8 @@ "accelerator": "GPU", "colab": { "gpuType": "T4", - "provenance": [], - "include_colab_link": true + "include_colab_link": true, + "provenance": [] }, "kernelspec": { "display_name": "Python 3", @@ -1292,4 +1379,4 @@ }, "nbformat": 4, "nbformat_minor": 0 -} \ No newline at end of file +}