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.

A Daemon is personal to an OSAIS authenticated user. It acts as a CPU/GPU service provider for AIs. Any AI launched by a Daemon will pay this same Daemon for the use of CPU/GPU.

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].

Generate your Daemon Token and Secret

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

Access your private Daemon Token and Secret

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.

An OSAIS Daemon is a docker image. It can be downloaded from the Docker repo yeepeekoo/public:ai_daemon

The Daemon allows to process AI for free to you, and to pay you processing coming from others. It is therefore essential to set it correctly to receive credits.

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.

Accessing your Daemon running on a specific machine

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.

A running Daemon UI

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

When running a Daemon for the first time on a machine, it will download the AI PING for validating the machine and checking minimum machine capabilities.

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!].

The PING AI does not do much, other than sending you back the same image. But it is a good test AI, to check that all works as it should, without having to configure more complex settings, or having to credit your account with $$$.

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.

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.

AI GFPGAN was started and is ready to use

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