-
Notifications
You must be signed in to change notification settings - Fork 4
Morpheus Admin webUI
WebUI to handle the model management for the Morpheus Project
Morpheus-admin is a WebUI that allows you to manage all related models used in Morpheus. It allows you to register, edit, disable, and remove a Generative AI model. This can also be done using morpheus CLI but morpheus-admin offers a more user-friendly interface. Unlike CLI, morpheus-admin uses a Firebase authentication interface so that only admin users can administer the models.
morpheus-admin is a client running as a microservice, connected to other existing microservices in morpheus:
The morpheus-admin service uses the morpheus API to register, update or delete model information in S3 and the database. The S3 bucket is used only in production (in a Kubernetes cluster). When you run morpheus in other environment, models are stored in a local volume in path /mnt/
When you want to register a new model, morpheus-server checks if this model was downloaded before. The morpheus-server API downloads the models into a temporary folder specified in secrets.env
. This folder is set as tmp
by default and it can be found inside morpheus-server.
If you are running in the production environment, the model is downloaded in the internal storage of the container/pod of morpheus-server in the same folder tmp
. Once the model is downloaded, it is uploaded to the S3 bucket and then the model information is registered in the database. However, to clean up the pod's internal storage, the downloaded model files are deleted from the pod's disk. In other cases, the model is just downloaded and stored inside a docker volume.
In morpheus-admin, create a .env.local
file with the following environment variables:
# API CONFIG
NEXT_PUBLIC_API_URL=http://localhost:8001
The morpheus-admin web UI is a service in docker-compose, so it is built and run together with morpheus:
docker compose build
docker compose up
When morpheus runs for the first time, an admin user is created with default credentials which can be set in the secrets.env
file of morpheus-server or morpheus-data
# ----------------------------------------------- #
# Admin defaults
# ----------------------------------------------- #
ADMIN_EMAIL="[email protected]"
ADMIN_PASSWORD="morpheusAdmin"
With these credentials, you can log in to morpheus-admin:
Before registering a model, it is important to note what information needs to be registered. In general, we can use the information found in the README of the model on the HuggingFace page, but you can customize it. As with the CLI, to register a model, the following information must be passed in:
-
name
. This is the name of the model that appears in the morpheus interface -
description
. Information about what the model does -
source
. Is the name under which the model is registered with HuggingFace. It is important to specify it well since this parameter is the one used to download the model from its respective repository. -
kind
. It is used to specify the nature of the model. Its values can bediffusion, controlnet, prompt
. This is because morpheus handles generative models, controlnet models and uses a magicprompt model. -
is_active
. To specify whether the model can be used or not -
url_docs
. Url with the documentation or information of the model. Usually, it is the URL of huggingface -
categories
. This is related to the functionalities of a model. They can betext2img, img2img, pix2pix, inpainting, upscaling, processing, controlnet
. -
extra_params
. This field is used to add additional information about a model. It is used in particular for controlnet models to specify their functionality.
For example:
name: "Stable Diffusion XL"
description: "SDXL 1.0: A Leap Forward in AI Image Generation"
source: "stabilityai/stable-diffusion-xl-base-1.0"
kind: "diffusion"
is_active: true
url_docs: "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0"
categories:
- name: "text2img"
- name: "img2img"
- name: "inpainting"
name: "Stable Diffusion v1.5"
description: "Stable Diffusion is a latent text-to-image diffusion model capable of generating photo-realistic images given any text input. he Stable-Diffusion-v1-5 checkpoint was initialized with the weights of the Stable-Diffusion-v1-2 checkpoint and subsequently fine-tuned on 595k steps at resolution 512x512 on 'laion-aesthetics v2 5+' and 10% dropping of the text-conditioning to improve classifier-free guidance sampling."
source: "runwayml/stable-diffusion-v1-5"
kind: "diffusion"
is_active: true
url_docs: "https://huggingface.co/runwayml/stable-diffusion-v1-5"
categories:
- name: "text2img"
- name: "img2img"
- name: "controlnet"
name: "Canny edges"
description: "ControlNet is a neural network structure to control diffusion models by adding extra conditions. This checkpoint corresponds to the ControlNet conditioned on Canny edges."
source: "lllyasviel/sd-controlnet-canny"
kind: "controlnet"
is_active: true
url_docs: "https://huggingface.co/lllyasviel/sd-controlnet-canny"
categories:
- name: "controlnet"
- name: "processing"
extra_params:
type: "canny"
By default, when morpheus runs for the first time, it registers the metadata of some default models in a database. Therefore, you will see a table populated with some models.
If the model files are not downloaded, morpheus will automatically download them when used.
To create a new model you need to click on the "Add Model" button and a form will appear:
Every field in the form is the same as it was shown in the previous section. For selecting a category or a kind, you need to click over those fields and you will see a dropdown with those options:
The extra_params
field, is a tuple of key-value where you can add additional information to the model. You can add or remove parameters as you wish or require. Also, if you want to use the model you are registering, you need to activate the model. By default, it comes as deactivated:
Keep in mind that, when you click on the submit button, the model registration will take some time as it will start downloading the model files in case they are not already downloaded. Additionally, if you are running in production (k8s cluster + S3 bucket), the model will be uploaded to the bucket and then the downloaded files in the container/pod will be deleted.
To update a model, simply click on "Edit" and this will open the form with the fields filled in:
For a diffusion model
For a controlnet model
In case you want to disable the model, if you are running morpheus in production, it will update the information in the database but also remove the model from S3, to optimize storage. That is, by deactivating the model, you will only keep its metadata in the database. Therefore, if you activate it again, the model will be downloaded again and the files will be uploaded to the S3 bucket. If you are running morpheus with docket compose, this operation will also update the information in the database
To delete a model, just click on "remove" and this will delete all information of the model on disk, S3, and database.