Installing a Daemon
The link between AIs and OSAIS.
In itself, a Daemon does not require GPU processing power. It is not an AI, but a gateway between OpenSourceAIs.com and the various AIs which will run on the same machine where the Daemon is installed.
1/ Setting-up a Daemon
1.1/ Create your Daemon in OSAIS
Before you can run a Daemon on a machine, you need to create it in your profile on the OpenSourceAIs dashboard. Go to your [Profile], and then select the tab [AI Settings].

A button [Create a Daemon] will appear. If you click it, it will instantly create a Daemon and associate it to your user profile.

You may need to regenerate a secret and copy it to your clipboard.
Get the Daemon Token and Secrets, you will need them when running the Daemon on your machine.
1.2/ Download the OSAIS Daemon on your machine
We shall consider that you have configured properly wsl and docker, as per the earlier step.
For running each of the commands below, make sure you are in the wsl subsystem, on the Ubuntu OS.
An OSAIS Daemon is a docker image. It can be downloaded from the Docker repo yeepeekoo/public:ai_daemon
1.3/ Run the Daemon
We chose to make the Daemon run on port 3333. In general, you will need a good internet connection, and a good GPU processing power, or you may be unable to run certain AIs on the machine.
To run your Daemon on your machine, go in a wsl session in terminal, and run the following command (insert your token and secret in the command line):
1.4/ Test that the Daemon is running properly
You can check that your Daemon is running OK by checking that it is here and by checking its logs.
Here is a typical log for a running Daemon, after 1 minute of execution.
1.5/ Access the Daemon
The first lines of the LOG file above contain the address of the Daemon (here is our example, https://ai-shirt-noon-address.trycloudflare.com/). You can enter this URL in a browser and directly access your Daemon.
You can also access your Daemon in private mode (as an authenticated user) by refreshing the [AI Settings] page of your [Profile] in OSAIS. If the Daemon is running, you will see a green button with the name of the machine. Click this button to access the Daemon.

The Damon itself has a basic User Interface, which shows all AIs currently running on the machine, and those not yet running, but which can be woken up. The UI also shows basic stats for the running AIs, including warmup time, transaction execution time, and transaction cost. Note that all AIs can be started or stopped via this UI.
AIs will also be automatically shutdown if they are not used for 15 minutes.

2/ Testing a first AI
The Daemon alone does not do much, apart from securing a CPU/GPU infrastructure for AIs.
2.1/ AI PING
The AI Ping does not need a GPU to work (which is not the case of most AIs, who request GPU power). It is a good test AI for validating that the configuration is setup correctly. It is always downloaded on the machine as part of the strict minimal requirement for running an AI on the OSAIS infrastructure.
You can always check that the AI Ping is running properly, by also checking its log.
When running properly, the logs will show something like this:
The AI Ping has notified both OSAIS and the Daemon the of its presence, which you can see in the logs.
2.2/ Testing the AI PING
Go in the AI Marketplace, select the AI PING

Click [Use this AI!] to run a test. It will bring a UI to upload an image. Upload an image of your choice, then click [Generate!].

When you click, generate, OpenSourceAIs will use your own Daemon to find a machine (you may have setup your daemon on several machines, this is OK) to generate the image. You can check it in the logs on the dashboard, but it will also appear in the logs of the AI and of the Daemon itself.
Now you are setup to use the CPU computing power of your machine for free. There is one more step to go through for using the GPU.
2.3/ Pre-loading Docker images
2.4/ Adding a GPU-based AI
Most AIs, at least the most useful ones, require a GPU to process input.
As an example, we will install the AI GFPGAN, which is an image enhancer and restoration AI. We will proceed mostly as we did with the AI PING, but this time, we will configure AI GFPGAN.
Although you may let the Daemon download docker images, some images are quite heavy (20 GB or more), which would be annoying for an end-user to wait for a full download.
Therefore, it is recommended to download the image manually before the Daemon will make use of it for the first time, otherwise you may have to wait several minutes before the Daemon gets a readiness signal for the AI.
Go to your wsl terminal, and pull the docker image
Alternatively, instead of a docker command in terminal, you can start the AI, for example here GFPGAN, from the UI of the Daemon (as shown above). The first run will take (a lot) longer than the expected warmup time if the docker image is not on the machine and requires a full download, but after this, the next AI start will run as per the expected warmup time.
As with Ping, let's check that it is properly running. A docker logs ai_gfpgan will show something like this:
The GFPAN AI is ready to work. You can also check it in the Daemon UI page, you will see another AI linked to your Daemon.

2.5/ Other AIs
To run other AIs, proceed in the same manner, by pre-downloading the image on the machine, and then running the AI either via the Daemon UI, or the OSAIS UI.
3/ Other useful considerations
3.1/ Launching the Daemon
The Daemon is clearing all AI docker instances at start-up, and then runs the AI PING for test and minimal capability requirement purposes. Therefore any AI instance running on the machine before a Daemon re-start, will be terminated.
3.2 Shutting down AIs
The Daemon is configured to shutdown any AI which is idle for 15 minutes. This helps keep the machine resources available and at minimum, whilst the Daemon is running but no AI is yet required.
3.3 / Stopping the Daemon
The Daemon can be stopped from the machin by running the following commands:
3.4/ Stopping an AI
It is not recommended to stop an AI by running a docker stop <ai_name> command. This would desynchronise the Daemon, OSAIS, and the AI for a few seconds or minutes. If you want to shutdown an AI manually, go to the Daemon UI page, and press the red button [Stop AI]. It will close the AI via the Daemon itself, and notify OSAIS immediately.
Last updated