Create Stunning Art Images with Dolly Mini on Your Computer

Create Stunning Art Images with Dolly Mini on Your Computer

Table of Contents:

  1. Introduction
  2. Installing the Program
  3. Creating a New File
  4. Generating Images with Dolly Mini
  5. Saving and Viewing the Images
  6. testing the Model with Different Prompts
  7. Running the Model on CPU
  8. Comparing Results on GPU and CPU
  9. Conclusion

Introduction

In this Tutorial, we will explore how to use Dolly Mini, a program or library that allows you to generate images on your computer. We will cover the installation process, creating a new file, generating images with Dolly Mini, saving and viewing the images, testing the model with different prompts, and running the model on CPU. Let's get started!

Installing the Program

Before we begin, we need to install the Dolly Mini program or library. To do this, you will need PyTorch installed on your computer. If you don't have PyTorch installed, don't worry - we'll show you how. Simply follow the steps below:

  1. Open the command Prompt on your computer.
  2. Install Python by entering the command: pip install python.
  3. Go to the PyTorch website and download the stable version suitable for your operating system.
  4. Once downloaded, open the terminal prompt with admin privileges and run the command: pip install <path/to/pytorch.whl>.
  5. Verify that PyTorch is successfully installed by running the command: import torch in Python.

With PyTorch installed, we can now proceed to install Dolly Mini.

Creating a New File

Now that we have installed the necessary programs, let's create a new file where we can write our code. We will be using Gianni as our default code editor for Python. Follow the steps below to create a new file:

  1. Open Gianni on your computer.
  2. Create a new file and save it as "tutorials_mean_dolly_run.py".
  3. Import the required libraries by adding the following code at the beginning of the file:
    import torch
    from mean_dolly import MeanDolly
  4. Set the directory where you want to save the generated images by adding the following code:
    models_root = "<path/to/models>"
  5. Instantiate the model by adding the following code:
    model = MeanDolly(models_root=models_root, d_type=torch.float32, device='cuda')
  6. Create a loop to enter multiple prompts by adding the following code:
    while True:
    prompt = str(input("Enter an image prompt: "))
    ...

Generating Images with Dolly Mini

To generate images with Dolly Mini, we need to call the generate_image method of the model. Add the following code inside the loop to generate images:

image = model.generate_image(text=prompt, seed=0, grid_size=3, seamless=False, temperature=1.0)

Here, we are setting the text prompt, seed, GRID size, seamless flag, and temperature for image generation.

Saving and Viewing the Images

To save the generated images to your disk, you need to create a folder named "images". Add the following code to create the folder:

import os

if not os.path.exists("images"):
    os.makedirs("images")

To save the image, add the following code inside the loop:

image.save(f"images/{prompt}.png")

To view the generated images, you can open the "images" folder on your computer and check the saved images.

Testing the Model with Different Prompts

You can test the model by entering different prompts. Here are some examples:

  1. "A cat wearing glasses walking towards someone"
  2. "A dog holding a coin"
  3. "A broken car in 60s Los Angeles"
  4. "An image of Jupiter in high detail taken by the James Webb telescope"

Feel free to try different prompts and see the output generated by Dolly Mini.

Running the Model on CPU

If you don't have a GPU or want to test the model on CPU, you can modify the code to use the CPU device instead. Replace the following line of code:

model = MeanDolly(models_root=models_root, d_type=torch.float32, device='cuda')

with:

model = MeanDolly(models_root=models_root, d_type=torch.float32, device='cpu')

Keep in mind that running the model on CPU may take significantly longer than on GPU.

Comparing Results on GPU and CPU

It is interesting to compare the results obtained by running the model on the GPU and the CPU. The GPU generally provides faster image generation, while the CPU may take a longer time. You can experiment with different prompts and see the differences in image quality and generation time.

Conclusion

In this tutorial, we have learned how to install and use Dolly Mini to generate images on our computer. We covered the installation process, creating a new file, generating and saving images, testing the model with different prompts, running the model on CPU, and comparing the results on GPU and CPU. Now you can explore the possibilities of Dolly Mini and create unique images using text prompts. Have fun experimenting with Dolly Mini!


Highlights:

  • Learn how to install and use Dolly Mini for image generation.
  • Generate images with text prompts using Dolly Mini.
  • Save and view the generated images on your computer.
  • Test the model with different prompts to see the output variations.
  • Compare the results obtained on GPU and CPU devices.

FAQ:

Q: Can I use Dolly Mini without a GPU? A: Yes, you can run Dolly Mini on CPU, but it may take longer to generate images compared to using a GPU.

Q: How can I view the generated images? A: The generated images are saved in the "images" folder. You can open this folder on your computer to view the images.

Q: Can I modify the model's settings? A: Yes, you can modify various parameters such as grid size, temperature, and seamless flag to experiment and achieve different results.

Resources:

Most people like

Find AI tools in Toolify

Join TOOLIFY to find the ai tools

Get started

Sign Up
App rating
4.9
AI Tools
20k+
Trusted Users
5000+
No complicated
No difficulty
Free forever
Browse More Content