How to use AI locally on a PC?

One of the most exciting aspects of delving into a new technology is getting hands-on and truly immersing oneself in the experience. In the past, we’ve explored LLMs and self-trained models for feature extraction, along with pre-trained models. A recurring theme in every 2023 blog post is the automatic creation of images using Midjourney or other AI tools. However, these tools typically operate within a cloud system. The resulting images can range from realistic to artistic, depending on the model employed.

How to start?

Finding a starting point is no easy feat. So far, I’ve tested Automatic1111, ComfyUI, Gradio and InvokeAI as user interfaces. Each has its pros and cons, even varying in computational speed.

For me, InvokeAI stands out as the simplest and most user-friendly solution currently available. The installation is quick and straightforward, and the user-friendliness holds up well under different conditions.

1.Requirements for using InvokeAI

InvokeAI is compatible with Linux, Windows, and Mac. Linux users have the option to utilize Nvidia-based cards (with CUDA support) or AMD cards (with ROCm driver).

Automatic Installer: Ideal for Beginners

This script takes care of installing all the necessary third-party libraries and InvokeAI itself. It includes a “Developer Console” for debugging and accessing experimental features. Our focus here will be on the automatic installer.

Manual Installation: For Experienced Users and Developers

Refer to InvokeAI’s installation page: https://invoke-ai.github.io/InvokeAI/installation/INSTALLATION/#manual-installation

System Requirements

Your system should have one of the following:

  • a Nvidia-based graphics card with at least 4 GB VRAM OR
  • an AMD-based graphics card with at least 4 GB VRAM (Linux only) OR
  • an Apple computer with an M1 chip

SDXL 1.0 Specifications & Requirements:

  • a Nvidia-based graphics card with 8 GB or more VRAM
  • an AMD-based graphics card with 16 GB or more VRAM (Linux only)
  • an Apple computer with an M1 chip

Memory and Storage

Minimum requirements are:

  • at least 12 GB of RAM (Random Access Memory)
  • a minimum of 18 GB of free disk space for the machine learning model, Python, and its dependencies.

2. Installation

10 Steps Guide for the Automatic Installer (Ideal for First-time Users)

  1. Navigate to the end of the Latest Release Page.
  2. Select and download the .zip file that corresponds to your operating system (Windows, macOS, or Linux).
  3. After downloading, extract the file.
  4. For Windows users: Double-click on the install.bat script. For macOS: Open a terminal, drag the install.sh file from the Finder to the terminal, and press Enter. For Linux: Execute the install.sh script.
  5. During the installation, you’ll be prompted to choose a directory for InvokeAI and its image files for image generation. Choose a location with at least 15 GB of free disk space, more if you plan to add additional models.
  6. Wait patiently while the installer sets up everything. After installation, a script will launch to configure InvokeAI and select initial models for image generation.
  7. Locate the installation directory of InvokeAI (note that this is not the same as where you unpacked the zip file!). By default, this is ~/invokeai on Linux/Mac and C:\Users\YourName\invokeai on Windows. In this directory, you’ll find startup scripts named invoke.sh and invoke.bat.
  8. To start on Windows, double-click on the invoke.bat file. On macOS and Linux, open a terminal, drag the invoke.sh file into the terminal, and press Enter.
  9. Once the software is running, press 2 to open the “browser-based user interface,” press Enter, and give Stable Diffusion a few minutes to start.
  10. Then, in your web browser, navigate to http://localhost:9090.

3. The Models

Using the right models is crucial to your success in image generation. The easiest approach is to find a so-called “pre-trained” model, where the additional learning steps in SDXL are already integrated. For our example here, I suggest using the Realvis 3.0 SDXL Baked from https://civitai.com/. This model is trained for photorealism and will deliver excellent results if you use the right prompts. Another secret for great results is the so-called “Refiner.” This additional step adds the final 10% of quality to your results. I’m using the “stable-diffusion-xl-refiner-1-0″.

Installing this model is quite straightforward; you just need to paste the link into the Import Models dialog in InvokeAI.

4. Runtime and the fun begins

Let’s have some fun and use some real good prompts.

Prompt:

Hyper-realistic full-body image of a captivating female cybernetic android that will overtake the world with a wide, genuine smile and deep, piercing blue eyes. She boasts a bold blond buzzcut hairstyle and sophisticated dark makeup, highlighting her perfect skin. The image is taken in white plastic clothes and in a futuristic spaceship with warm, soft light, capturing her face and shoulders and emphasizing fine details like the texture of her skin and the subtle shine in her eyes. The photograph, styled as a high-fashion portrait, conveys a blend of natural beauty and contemporary style, ideal for a high-quality magazine cover.

Style:

comic style, 8k, agfa vista, photographic, high quality, realistic face

Negative Prompt:

(worst quality, low resolution, minimal details, oversaturated or undersaturated colors, overexposed or underexposed lighting, grayscale, black and white, poor photography techniques:1.4), (any watermarks, signatures, text fonts, usernames, errors, logos, words, letters, digits, autographs, trademarks, names:1.2), (blurry or grainy textures), grotesque, unsightly features, asymmetry, malformed or mutilated elements, poorly lit areas, bad shadowing, drafts, cropped or out of frame subjects, censored parts, jpeg artifacts, out of focus areas, glitches, duplicates, (airbrushed, cartoonish, anime-style, semi-realistic, CGI, rendered, digital art, manga, amateurish effects:1.3), (3D models, 3D game scenes, 3D characters:1.1), (incorrect anatomy, disproportionate body parts, facial distortions, imperfect teeth, awkward limbs:1.3)

Use the DPM++ SDE Karras sampler, 4-10 steps, and CFG Scale 1-2.5.

Final Conclusion

Generating images on a local computer is no longer a challenge these days. It’s quite easily accessible and reproducible on almost any computer with a powerful graphics card. In essence, it would work on any other computer, but unfortunately, the wait times would be considerably long. Thus, it’s only enjoyable on systems where there’s a certain level of hardware support.

About the Author

Matthias

As the CEO of onexip with over 20 years of experience in the software industry, Matthias brings expertise in AI, audio and video technologies, as well as high-performance software architecture.

He is always up to date with the latest technology, loves to learn new things, and challenges himself. As a futurist, skeptic, and practical-thinking leader, he consistently aims to deliver quality and added value.

Frequently ask questions:

What steps are required to use AI locally?

Text

What are the prerequisites for installing InvokeAI?

To use AI locally, you first need the right software and corresponding models. You can choose between automatic installation and manual installation, depending on your knowledge and preferences.

How to install InvokeAI using the automatic installer?

Installing with the automatic installer is straightforward: download the appropriate file for your operating system, extract it, and run the installation script. During installation, you will be prompted to choose a location and make further settings.

Which models are recommended for image generation?

The right models are crucial for image generation. It is recommended to use “pre-trained” models that are already trained for photorealism. An example of this is the Realvis 3.0 SDXL Baked model. Additionally, a “refiner” can be used to enhance the quality of the results.

How to use the installed models in InvokeAI?

Using the installed models is done through the InvokeAI user interface. After installation, you can select the models and enter appropriate prompts to achieve the desired results.

Related Articles

AI-Powered UX/UI Optimization and Personalization

Today, digital user experiences are a key factor in the success or failure of digital products. Those who understand their users and actively respond to their behavior gain trust, engagement—and revenue. With our AI-powered UX/UI optimization and personalization...

“Intelligent Edge” – AI at the Source

In an increasingly connected world, intelligent systems at the network’s edge – the so-called "Edge" – are gaining rapid importance. The "Intelligent Edge" Implementation Service by Onexip GmbH brings artificial intelligence directly to where data is generated: on...

Revolutionary Vision: Highly performant integration of industrial cameras in Electron apps? A practical report.

Learn how to seamlessly integrate powerful industrial cameras into Electron applications. Martin Spindler shares practical insights on how he efficiently realised image processing with the Baumer VLU-02M camera in Electron. From using C++ for fast data processing to implementing IPC mechanisms for stable image output, this article shows how you can combine high-performance image processing with flexible web-based frameworks. Discover the potential for innovative applications and solutions in industrial image processing with Electron.

Software Timing Troubles? Log Your Way to Success!

The Shock of the Year 2022: ChatGPT takes the stage and raises the question of whether AI will dominate software development. Our journey through the emotional rollercoaster of psychological phases, from denial to acceptance, is illuminated in this post by CEO Matthias. Learn how we dealt with the challenge and discover the answer we found to the crucial question. A glimpse into our journey, where we got our hands dirty and developed our own AI model.

The German Angst from a CEO perspective: What AI is not!

The Shock of the Year 2022: ChatGPT takes the stage and raises the question of whether AI will dominate software development. Our journey through the emotional rollercoaster of psychological phases, from denial to acceptance, is illuminated in this post by CEO Matthias. Learn how we dealt with the challenge and discover the answer we found to the crucial question. A glimpse into our journey, where we got our hands dirty and developed our own AI model.

The German angst from a CEO perspective: will AI take over Software Development?

The Shock of the Year 2022: ChatGPT takes the stage and raises the question of whether AI will dominate software development. Our journey through the emotional rollercoaster of psychological phases, from denial to acceptance, is illuminated in this post by CEO Matthias. Learn how we dealt with the challenge and discover the answer we found to the crucial question. A glimpse into our journey, where we got our hands dirty and developed our own AI model.

IONIC 101: Code your own grocery list app with ease.

Learn about developing an app with Ionic and Angular, seamlessly extending to iOS and Android. Explore benefits like Dependency Injection, service management, and Capacitor API integration for native features. Transition effortlessly from web to mobile development with our guidance, creating a versatile app across platforms.