Skip to content

Getting Started

To get started, simply install it through pip [] using one of the options below.

For PyTorch [] with CUDA (recommended):

Bash
1
pip install torch torchvision velora --extra-index-url https://download.pytorch.org/whl/cu126

Or, for PyTorch [] with CPU only:

Bash
1
pip install torch torchvision velora

Example Usage

Here's a simple example:

Python
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from velora.models import NeuroFlow, NeuroFlowCT
from velora.utils import set_device

# Setup PyTorch device
device = set_device()

# For continuous tasks
model = NeuroFlowCT(
    "InvertedPendulum-v5",
    20,  # actor neurons 
    128,  # critic neurons
    device=device,
    seed=64,  # remove for automatic generation
)

# For discrete tasks
model = NeuroFlow(
    "CartPole-v1",
    20,  # actor neurons 
    128,  # critic neurons
    device=device,
)

# Train the model using a batch size of 64
model.train(64, n_episodes=50, display_count=10)

This code should work 'as is'.

Currently, the framework only supports Gymnasium [] environments and is planned to expand to PettingZoo [] for Multi-agent (MARL) tasks, with updated adaptations of CybORG [] environments.

API Structure

The frameworks API is designed to be simple and intuitive. We've broken into two main categories: core and extras.

Core

The primary building blocks you'll use regularly.

Python
1
2
from velora.models import [algorithm]
from velora.callbacks import [callback]

Extras

Utility methods that you may use occasionally.

Python
1
2
from velora.gym import [method]
from velora.utils import [method]

Next Steps