agicommies / synthia

Commune's synthetic data generation subnet
MIT No Attribution
11 stars 5 forks source link

Synthia

Welcome to the Synthia subnet, a bleeding-edge initiative to accelerate the open-source AI space. Our mission is to harness the power of Commune's decentralized incentive markets to produce a continuous stream of synthetic training data with verified quality at scale.

Table of Contents

Overview

Synthia is utilizing the state-of-the-art Anthropic Claude3 API to generate open-ended high-quality and diverse synthetic in-depth explanations of subjects picked from the Opus latent space based on varying esotericity, with varying target-audience, level of detail and abstraction at scale.

While any model or API can theoretically mine in the subnet, the validation is designed to target Claude3-level quality, due to its substantially superior ability to generate the desired synthetic data. Hence, we advise mining with the Claude3 API, although support for OpenAI's API is available.

Motivation

In the rapidly evolving world of artificial intelligence, synthetic data has emerged as a crucial component in the training of advanced models. By utilizing the state-of-the-art Anthropic Claude3 API, we can generate open-ended subject-unconstrained high-quality and diverse synthetic in-depth explanations.

Major AI labs have already recognized the potential of synthetic data and are actively utilizing it to enhance their models. However, access to such data remains limited for the broader open-source community. The Synthia subnet aims to change that.

By harnessing the power of Commune's decentralized crypto-economic incentives, we aim to create the largest reliably high-quality synthetic intelligence dataset in the world that will serve as a catalyst for innovation in the Open-Source AI space.

Join us on this important journey as we distill the Closed-Source intelligence right into the hands of the Open-Source Community!

Resources

Installation

Make sure you are on the latest CommuneX version.

pip install communex --upgrade

Setup your environment

With Docker

Operating with docker

Manually, on Ubuntu 22.04

With Nix

Running A Miner

  1. Get an API key from Anthropic.

  2. Create a file named config.env in the env/ folder with the following contents (you can also see the env/config.env.sample as an example):

    ANTHROPIC_API_KEY="<your-anthropic-api-key>"
    OPENROUTER_API_KEY="<your-openrouter-api-key>"
    ANTHROPIC_MODEL=claude-3-opus-20240229
    ANTHROPIC_MAX_TOKENS=1000
    ANTHROPIC_TEMPERATURE=0.5

    Alternatively, you can set up those values as enviroment variables. Note that you just need to provide the key to the provider that you're going to use

  3. Serve the miner:

    Make sure to be located in the root of synthia repository

    cd synthia

    Proceed with running the miner:

    python3 -m synthia.miner.cli <your_commune_key> --ip 0.0.0.0 [--port]

    Alternatively, if you want to run a openrouter miner:

    python3 -m synthia.miner.cli <your_commune_key> --ip 0.0.0.0 [--port] --provider openrouter

    The ip is passed as 0.0.0.0 to accept outside connections, since the default, 127.0.0.1 accepts only local connections. Synthia has the netuid 3. Key is a name of your commune wallet/key. If you don't have a wallet, generate one by running

    comx key create <name>

    Note: you need to keep this process alive, running in the background. Some options are tmux, pm2 or nohup.

    Example using pm2

    pm2 start "comx module serve synthia.miner.anthropic.AnthropicModule <key> --subnets-whitelist <synthia netuid> --ip 0.0.0.0" --name <name>
  4. Finally register the module on the Synthia subnet:

    comx module register <name> <your_commune_key> --ip <your-ip-address> --port <port> --netuid <synthia netuid>  

Note

Running A Validator

  1. Get an API key from Anthropic.

  2. Gen an API key for embeddings from OpenAi

  3. Create a file named config.env in the env/ folder with the following contents (you can also see the env/config.env.sample as an example):

    ANTHROPIC_API_KEY="<your-anthropic-claude-api-key>"
    OPENROUTER_API_KEY="<your-openrouter-api-key>"
    ANTHROPIC_MODEL=claude-3-opus-20240229
    ANTHROPIC_MAX_TOKENS=1000
    ANTHROPIC_TEMPERATURE=0.5
    OPENAI_API_KEY="<your-openai-api-key>"

    Alternatively, you can set up those values as enviroment variables.

  4. Register the validator

    Note that you are required to register the validator first, this is because the validator has to be on the network in order to set weights. You can do this by running the following command:

    comx module register <name> <your_commune_key> --netuid <synthia netuid>

    The current synthia netuid is 3.

  5. Serve the validator

    python3 -m synthia.cli <your_commune_key> [--call-timeout <seconds>] [--provider <provider_name>]

    The default value of the --call-timeout parameter is 65 seconds. You can pass --provider openrouter to run using openrouter provider

    Note: you need to keep this process alive, running in the background. Some options are tmux, pm2 or nohup.

Hardware Requirements

Minimum Requirements

Recommended Requirements

If you want to run up to ~10+ miners / validators

Launcher Script

Eden has provided a new bash script that will walk you through the process of launching a validator or miner for a simpler and streamlined process.

Using the launcher

Allow commands to be executed by the script: chmod +x scripts/launch.sh

Run the launcher: bash scripts/launch.sh

Just follow the prompts after that.

What it does

The launch script will prompt you step by step through the process of launching a validator or miner or both and execute the required commands without having to know details about the CLI.

launcher

Be aware that the launcher does execute commands that make changes on the block chain including balance transfers and module registration. Be sure you know what you'd like to do before using this tool as some actions cannot be undone. This tool is provided free of charge as is and with no warranty or guarantee. Use at your own risk.

Video tutorial

Video tutorial