Skip to content

jeblad/heuristic-reasoning-agent

Repository files navigation

pyhera

stability-experimental GitHub issues

Heuristic Reasoning Agent (PyHERA) with Python at host, and CUDA at device with PyCUDA as integration layer, or OpenCL at device with PyOpenCL as integration layer.

There are separate subrepositories for each of the models.

Requirements

  • python 3.7+
  • poetry
  • cliff

Poetry has a minimum requirement of 3.7 for python. Models will typically have a requirement of either pycuda or pyopencl.

Developer notes

For those unfamiliar with poetry, it's a virtual environment and package manager. For development of this project pyenv is used as a layer on top of virtualenv. (Pyenv is installed by following this example or this with homebrew which follows the readme. Pyenv-virtualenv is installed by following the readme.)

Create a general environment for developments

pyenv virtualenv 3.7.0 pyhera # or some higher version

Create the directory, move into it, and activate the environment. The repo is recreated by cloning, optionally recursively to add the documentation. Lastly add the dependencies.

mkdir heuristic-reasoning-agent
cd heuristic-reasoning-agent
pyenv local pyhera
git clone https://github.com/jeblad/heuristic-reasoning-agent.git . # without docs
poetry init

Usage

The managing software creates and runs an agent continuously. The inputs (sensory data) are injected on the dendrites artificial synapses, and the outputs (motor data) are extracted from axons.

Primary commands

It should be enough to clone the repo, then cd into the folder, and then build a software agent with

hera build --family abraxas --layout standard --type <type>

given the existence of a model named pyhera-model-abraxas with a layout called standard. The model with the layout will be instantiated as a named type, written out as a file. That type (or file) can then be instantiated as an agent (that is installed) on the system, either explicitly by calling install, or implicitly by attempting to run the instance by calling up. The agent is a child instance of the type. Training will make the agents diverge from a common starting point.

hera install --callsign <callsign> <file>
hera up --callsign <callsign> <file>

The file from instantiation of a model can be repurposed to create an army of agents. All of them should have different identifiers, otherwise it will be difficult to control them individually. Usually the identifier will be a generated psaudo random uuid, but on the basis of hashed type and callsign.

A running agent can then be stopped with down and an identifier

hera down --identifier <uuid or callsign or type>

A stopped instance can be restarted with another up given the correct identifier

hera up --identifier <uuid or callsign or type>

A stopped instance can also be destroyed with destroy

hera destroy --identifier <uuid or callsign or type>

The named type or callsign may not be unique, and may activate or deactivate several agents.