How to Install and Run Auraflow Image Generator Locally

ayush7614

Ayush kumar

Posted on September 13, 2024

How to Install and Run Auraflow Image Generator Locally

AuraFlow is an open-source flow-based generation model, a powerful approach used in machine learning to explicitly model probability distributions. Unlike some other generative models, which might rely on complex architectures or adversarial training, redefining the possibilities of text-to-image synthesis.

Key Features of Auraflow
👉 Open Source
👉Advanced Neural Architecture
👉User-Friendly Interface
👉User-Friendly Interface

Model inputs and outputs

AuraFlow can generate highly detailed and photorealistic images from text prompts. The model is perfect at capturing intricate textures, colors, and lighting in its outputs. It can produce a wide range of subjects, from close-up portraits to complex scenes, with impressive quality and realism.

Inputs

Prompt: Natural language description of the desired image, which the model uses to generate the corresponding visual output.

Outputs

Image: The generated image that corresponds to the provided text prompt. The model produces high-quality pixel images.
Image description
The versatility of AuraFlow makes it a valuable tool for various applications. Artists and designers can create unique and visually bold artworks using the model. Educators can incorporate the generated images into their teaching materials, enhancing the learning experience. In the entertainment and media industries, AuraFlow can be used to create high-quality visual content for animation, graphic novels, and other multimedia productions.

Head-to-head with Stable Diffusion

When evaluating AuraFlow's capabilities, comparing it with well-established models like Stable Diffusion 3 and Stable Diffusion XL is natural. Extensive testing using complex and varied prompts has revealed both strengths and areas for improvement in AuraFlow's performance:

👉AuraFlow often generates images with more detailed and realistic textures compared to its counterparts
👉It can struggle with maintaining coherence and accuracy in intricate compositions or scenes with multiple elements
👉AuraFlow shows promising results in specific domains, such as landscapes and portraits, but may fall short in others, like abstract or surreal imagery.

These findings suggest that while AuraFlow has excellent potential, it still has room for refinement and enhancement as it evolves.

Step-by-Step Process to Install and Run Auraflow Image Generator Locally

For the purpose of this tutorial, we will use a GPU-powered Virtual Machine offered by NodeShift; however, you can replicate the same steps with any other cloud provider of your choice. NodeShift offers the most affordable Virtual Machines at a scale that meets GDPR, SOC2, and ISO27001 requirements.

Step 1: Sign Up and Set Up a NodeShift Cloud Account

Visit the NodeShift Platform and create an account. Once you've signed up, log into your account.

Follow the account setup process and provide the necessary details and information.
Image description

Step 2: Create a GPU Node (Virtual Machine)

GPU Nodes are NodeShift's GPU Virtual Machines, on-demand resources equipped with diverse GPUs ranging from H100s to A100s. These GPU-powered VMs provide enhanced environmental control, allowing configuration adjustments for GPUs, CPUs, RAM, and Storage based on specific requirements.
Image description

Navigate to the menu on the left side. Select the GPU Nodes option, create a GPU Node in the Dashboard, click the Create GPU Node button, and create your first Virtual Machine deployment.

Step 3: Select a Model, Region, and Storage

In the "GPU Nodes" tab, select a GPU Model and Storage according to your needs and the geographical region where you want to launch your model.

Image description

We will use 1x RTX A6000 GPU for this tutorial to achieve the fastest performance. However, you can choose a more affordable GPU with less VRAM if that better suits your requirements.

Step 4: Select Authentication Method

There are two authentication methods available: Password and SSH Key. SSH keys are a more secure option. To create them, please refer to our official documentation.

Image description

Step 5: Choose an Image

Next, you will need to choose an image for your Virtual Machine. We will deploy the Auraflow Image Generator on an NVIDIA Cuda Virtual Machine. This proprietary, closed-source parallel computing platform will allow you to install Auraflow Image Generator on your GPU Node.

Image description

After choosing the image, click the 'Create' button, and your Virtual Machine will be deployed.

Step 6: Virtual Machine Successfully Deployed

You will get visual confirmation that your node is up and running.

Image description

Step 7: Connect to GPUs using SSH

NodeShift GPUs can be connected to and controlled through a terminal using the SSH key provided during GPU creation.

Once your GPU Node deployment is successfully created and has reached the 'RUNNING' status, you can navigate to the page of your GPU Deployment Instance. Then, click the 'Connect' button in the top right corner.

Image description

Now open your terminal and paste the proxy SSH IP or direct SSH IP.
Image description

Next, If you want to check the GPU details, run the command below:

nvidia-smi

Image description

Step 8: Install Miniconda & Packages

After completing the steps above, install Miniconda.

Miniconda is a free minimal installer for conda. It allows the management and installation of Python packages.

We highly recommend installing Python using Miniconda. Miniconda comes with Python and a small number of essential packages. Additional packages can be installed using the package management systems Mamba or Conda.

For Linux/macOS:

Download the Miniconda installer script:

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

For Windows:

Download the Windows Miniconda installer from the official website.
Run the installer and follow the installation prompts.

Image description

Run the installer script:

bash Miniconda3-latest-Linux-x86_64.sh
Image description

Image description

After Installing Miniconda, you will see the following message:

Thank you for installing Miniconda 3! This means Miniconda is installed in your working directory or on your operating system.
Check the screenshot below for proof:

Image description

Step 9: Activate Conda and perform a version check

After the installation process, activate Conda using the following command:

conda init
source ~/.bashrc

Also, check the version of Conda using the following command:

conda --version

Image description

Step 10: Create and activate your environment

After this, run the following command to create and activate a new environment:

conda create -n auraflow python=3.11 -y && conda activate auraflow

  • conda create: This is the command to create a new environment.
  • -n auraflow: The -n flag specifies the name of the environment you want to create. Here auraflow is the name of the environment you're creating. You can name it anything of your choice.
  • python=3.11: This is the version of Python that you want to install in the new environment.
  • -y: This flag automatically answers "yes" to all prompts during the creation process, so the environment is created without asking for further confirmation.

&& conda activate auraflow

  • &&: The && (logical AND) operator indicates whether both operands are true. It allows the following command (conda activate auraflow) to run only if the previous command (conda create -n auraflow python=3.11 -y) was successful.
  • conda activate auraflow: This activates the newly created environment named "flux," making it the active environment for Python and packages.

Image description

Image description

Step 11: Install Transformers and other packages

Run the following command to Install packages and requirements:

pip install transformers accelerate protobuf sentencepiece

Image description

Step 12: Install Torchvision

Torchvision is a library for Computer Vision that goes hand in hand with PyTorch. It has utilities for efficient Image and Video transformations, some commonly used pre-trained models, and some datasets ( torchvision does not come bundled withPyTorch, you will have to install it separately. )

Run the following command to Install Torchvision:

pip install torchvision

Image description

Step 13: Install diffusers

Diffusers are the go-to library for state-of-the-art pre-trained diffusion models for generating images, audio, and even 3D structures of molecules. Whether you're looking for a simple inference solution or want to train your diffusion model. Diffusers is a modular toolbox that supports both.

Run the following command to install diffusers:

pip install git+https://github.com/huggingface/diffusers.git

Image description

Step 14: Install Jupyter Notebook

Run the following command to install Jupyter Notebook:

conda install jupyter -y
pip uninstall charset_normalizer -y
pip install charset_normalizer
jupyter notebook

Image description

Step 15: Allow root to bypass

Here, running as root is not recommended. Use --allow-root to bypass.

Run the following command to allow the root to bypass:

jupyter notebook --allow-root

Now, you can check the screenshot below for proof. When you run the command, it will give the following output: To access the server, open this file in the browser or copy and paste one of these URLs:

Image description

Open your preferred browser, copy the localhost address, and paste it into the browser. This will open the Jupyter Notebook.

Step 16: Import packages in Python Jupyter Notebook

Run the following command to import packages in the Python Jupyter Notebook:

from diffusers import AuraFlowPipeline
import torch

Image description

Step 17: Loading a model and pipeline

Run the following command to load a model and pipeline:

pipeline = AuraFlowPipeline.from_pretrained(
"fal/AuraFlow",
torch_dtype=torch.float16
).to("cuda")

Image description

Step 18: Generate an image based on a given prompt

Run the following command to generate an image based on a given prompt.

image = pipeline(
prompt="A Running Horse.",
height=1024,
width=1024,
num_inference_steps=50,
generator=torch.Generator().manual_seed(666),
guidance_scale=3.5,
).images[0]

Change the prompts according to your choice.

Image description

Image description

Conclusion

In this guide, we've walked through setting up and running the Auraflow Image Generator on a GPU-powered virtual machine. With Auraflow, you now have the tools to create stunning, high-quality images, whether for commercial projects or personal exploration. By following these steps, you have the power of advanced AI image generation while enjoying the flexibility and efficiency that Auraflow offers.

For more information about NodeShift:

Website
Docs
LinkedIn
X
Discord
daily.dev

💖 💪 🙅 🚩
ayush7614
Ayush kumar

Posted on September 13, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related