Petals Tensor Introduction

The current structure of Petals Tensor requires one node per directory due to the storage structure. To run multiple nodes on one server, create a directory per node. We plan to update the later versions to allow multiple nodes per directory.

Getting Started

Before running a server, ensure you have enough balance in your wallet to become a peer based on the minimum required stake (this can be queried when running Update Network Config). You can create an account and use the faucet here. Read the documentation in Consensus and Emissions to understand how emissions are generated and how a model peer is eligible to receive them.

Ensure to use a permanent public IP. On hosts such as AWS, they have a feature called Elastic IPs that can attach a permanent IP to your server.

  1. run git clone

  2. Create an .env file in the root directory and add your mnemonic phrase to the PHRASE variable. If you don't have an account, create an account.

    • Example: PHRASE="mnemonic phrase here"

  3. Ensure INITIAL_PEERS within the src/petals_tensor/ file are currently active peers if needed.

  4. Update src/petals_tensor/health/ MODEL to the model you're hosting if needed.

  5. Update src/petals_tensor/substrate/ DEV_URL to a live validator IP and port if needed.

    • Example: "DEV_URL = ws://"

  6. CD into the directory with cd petals_tensor into the root folder (not the src/petals_tensor).

  7. Install the repository with python -m pip install .


After completing all of the steps, you may need to run python -m pip install . again.

See Steps


Steps to connect to Hypertensor and begin generating incentives

Note: These steps will eventually be combined into one step as development continues. In total, the following will require three CLIs.

  1. Update Network Config

    • You must update these initially. Afterward, network configuration parameters will automatically update if they are updated within the blockchain using Hypertensor blockchain event subscriptions.

    • We plan to remove this step and integrate it into the Run Server command in later versions.

  2. Run Server

    • This starts your AI model node.

    • Ensure to use a terminal multiplexer so it continues running after the CLI is exited.

    • By this point, you must have completed Getting Started. By running this command, your data will be stored and used for future commands and consensus.

  3. Add Model Validator

    • Ensure the peer is fully connected to the DHT, the model is fully loaded, and the node is connected as a Direct peer.

    • Using a second CLI, begin interfacing with the blockchain by adding your model peer data and staking.

  4. Subscribe: Run python src/petals_tensor/substrate/

    • Subscribing to the blockchain sets the peer consensus mechanism into action. It will query data and generate scores for each peers and submit consensus to the blockchain per epoch.

    • This function runs indefinitely. Similar to running a blockchain validator, it's best to run this using a terminal multiplexer like tmux.

    • This should be done in the same CLI you ran the Add Model Validator command. Ensure to use a terminal multiplexer so it continues running after the CLI is exited.

Helpful Tips

NVIDIA CUDA Installation Guides

This is useful if using a remote server and installing drivers from scratch. This is all of the information for installing and configuring the driver.

Install PyTorch

Ensure to use a combination of libraries that work well together.

Ensure your GPU is available

When in the Petals Tensor directory, before running Petals Tensor, make sure the following outputs True:

python -c "import torch; print(torch.cuda.is_available())"


ConnectionRefusedError: [Errno 111] Connection refused

  • This error is likely due to the substrate configuration URL, which cannot connect to the blockchain. Go to substrate/ and make sure the SubstrateConfig class URL is correct.


  • This happens since Windows doesn't allocate much RAM to WSL by default, so the server gets OOM-killed. To increase the memory limit, go to C:/Users/Username and create the .wslconfig with this content:

  • To create a .wslconfig file, open your File Explorer, and type and enter %UserProfile% to go to your profile directory in Windows and follow the directions above.

    • The file must not be a txt file. Ensure to create the file using Nano or your preferred IDE software.

(ValidationError('local time must be within 3 seconds  of others(local: 1715996770.09176, peer: 1715996773.26346)')  
  • This happens due to WSL precision errors.

  • Run sudo ntpdate


Running peer-to-peer servers allows others to identify your IP address. If this is a concern, it is recommended to use a VPN, proxy, or other means to hide your IP address.


The current implementation for Petals Tensor is meant to be used as one repository to one server and is not meant for a swarm. To run multiple servers, you will need one repository per directory to successfully interface with Hypertensor.

Health Monitor (Not live)

Last updated