AI+D
Project |

Zoomaker - Friendly house keeping for your AI model zoo and related resources

The image depicts a stylized, cartoonish depiction of a cat with human features, wearing a detective hat and holding a magnifying glass. There are colorful, puzzle-like pieces floating around in the background.

Zoomaker is a command-line tool for maintaining project related “AI model zoos” in a friendly way.

👉 Zoomaker Github Repository

Motivation

Teaching AI is hard, not alone because of the complexity of the topic, but also because of the complexity of the tools. I’m running for instance a course on Designing Prompts, which uses Automatic1111 (think of an UI for Stable Diffusion) to make image generation accessible for the students. This is a great combination, but it’s also a very complex combination. From installing the right version of Python, to installing the right version of Automatic1111, to installing the right version of the models, to installing the right version of the datasets of the Automatic1111 extension … to how to actually start everything on the server in the terminal. It is simply too much to ask from the students, and is in addition no longer manually feasible.

However this dependency hell complexity is also know in other domains. For instance in the web development world, where tools like npm are used to manage the dependencies.

So my idea was really simple, what if something like npm install would exist for creative AI projects which depend heavily on manifold resources? It turned out to be relatively easy to build such a tool, and to be very useful for my students and courses.

Zoomaker Features

Zoomaker offers a range of features designed to manage and use models, embeddings, git repositories and downloads. Its main attributes include a centralized configuration through the zoo.yaml file, ensuring a single source of truth for all resources. It allows users to precisely track and freeze versions of the resources, ensuring consistency and reliability in their projects. Zoomaker also optimizes bandwidth usage by caching models locally, avoiding repeated downloads. This was a must, as a typical project with Stable Diffusion can easily require 100GB of models. Hence, it manages disk space efficiently by using symlinks for larger files, while duplicating smaller files under 5MB, streamlining the installation process and optimizing overall resource management.

Installation

Zoomaker is a Python command-line tool, which can be installed with pip install zoomaker.

zoo.yaml Example

Here is an example of a zoo.yaml file, which is used to configure all resources for a project. It is a simple YAML file, which can be edited by hand. It defines the name of the project, the version, the description, the author, and the resources. The resources are defined as a list of resources, which can be of type “git”, “huggingface” or “download”. Each resource has a name, a source, a type, a install path and an optional revision. The “scripts” section defines a list of scripts, which can be run with zoomaker run <script-name>.

name: my-automatic1111-model-zoo
version: 1.0
description: Lorem ipsum
author: your name

resources:
  image_generator:
    - name: automatic1111
      src: https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
      type: git
      revision: 22bcc7be428c94e9408f589966c2040187245d81
      install_to: ./

  models:
    - name: v2-1_768-ema-pruned
      src: stabilityai/stable-diffusion-2-1/v2-1_768-ema-pruned.safetensors
      type: huggingface
      install_to: ./stable-diffusion-webui/models/Stable-diffusion/

scripts:
  start_webui: |
    conda activate automatic1111
    cd /home/$(whoami)/stable-diffusion-webui/
    ./webui.sh --theme dark --xformers --no-half

To install the resources, simply run zoomaker install in the same directory as the zoo.yaml file. This will install all resources, in this case it will install Automatic1111 and the model to the stable-diffusion-webui folder. To start the webui, simply run zoomaker run start_webui. This will run the commands defined in the “start_webui” script. Done :)

See the Zoomaker Readme on Github for more examples and full reference of the structure of the file.

Conclusion

In conclusion, Zoomaker proved for me to be an indispensable tool for streamlining the management of AI models and resources in creative and educational AI projects. Its project centric design, embodied in the zoo.yaml file, and the embracing the model zoo metaphor, offers a user-friendly approach to handling complex dependencies. By simplifying the installation process, optimizing resource management, and enhancing overall project consistency, zoomaker addresses the challenges faced in AI education and development. It empowers students and practitioners in the realm of AI project management, making the dependency hell of AI projects more accessible and manageable for a broader audience.