Skip to content

Commit

Permalink
pcore_ds running
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoreilly committed Dec 17, 2024
1 parent 5417e46 commit 657fe5f
Show file tree
Hide file tree
Showing 8 changed files with 839 additions and 850 deletions.
142 changes: 77 additions & 65 deletions examples/pcore_ds/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,141 +4,153 @@

package main

// EnvConfig has config params for environment
// note: only adding fields for key Env params that matter for both Network and Env
// other params are set via the Env map data mechanism.
// EnvConfig has config params for environment.
type EnvConfig struct {

// env parameters -- can set any field/subfield on Env struct, using standard TOML formatting
// Env parameters: can set any field/subfield on Env struct,
// using standard TOML formatting.
Env map[string]any

// sequence length.
// SeqLen is the sequence length.
SeqLen int `default:"3"`

// number of distinct actions represented: determines the difficulty
// NActions is the number of distinct actions represented: determines the difficulty
// of learning in terms of the size of the space that must be searched.
// effective size = NActions ^ SeqLen
// 4 ^ 3 = 64 or 7 ^2 = 49 are reliably solved
NActions int `default:"4"`

// gain on the softmax for choosing actions: lower values are more noisy; 2 > 3+ > 1>
// ActSoftMaxGain is the gain on the softmax for choosing actions:
// lower values are more noisy; 2 > 3+ > 1>.
ActSoftMaxGain float32 `default:"2"`
}

// ParamConfig has config parameters related to sim params
// ParamConfig has config parameters related to sim params.
type ParamConfig struct {
// If true, perform automated parameter tweaking for parameters marked Hypers Tweak = log,incr, or [vals]
// Tweak means to perform automated parameter tweaking for
// parameters marked Hypers Tweak = log,incr, or [vals].
Tweak bool

// for Tweak, if true, first run a baseline with current default params
// Baseline for Tweak, if true, first run a baseline with current default params.
Baseline bool

// for Tweak, if true, only print what would be done, don't run
// DryRun for Tweak, if true, only print what would be done, don't run.
DryRun bool

// network parameters
Network map[string]any

// Extra Param Sheet name(s) to use (space separated if multiple) -- must be valid name as listed in compiled-in params or loaded params
// Sheet is the extra params sheet name(s) to use (space separated
// if multiple). Must be valid name as listed in compiled-in params
// or loaded params.
Sheet string

// extra tag to add to file names and logs saved from this run
// Tag is an extra tag to add to file names and logs saved from this run.
Tag string

// user note -- describe the run params etc -- like a git commit message for the run
// Note is additional info to describe the run params etc,
// like a git commit message for the run.
Note string

// Name of the JSON file to input saved parameters from.
File string `nest:"+"`

// Save a snapshot of all current param and config settings in a directory named params_<datestamp> (or _good if Good is true), then quit -- useful for comparing to later changes and seeing multiple views of current params
// SaveAll will save a snapshot of all current param and config settings
// in a directory named params_<datestamp> (or _good if Good is true),
// then quit. Useful for comparing to later changes and seeing multiple
// views of current params.
SaveAll bool `nest:"+"`

// for SaveAll, save to params_good for a known good params state. This can be done prior to making a new release after all tests are passing -- add results to git to provide a full diff record of all params over time.
// Good is for SaveAll, save to params_good for a known good params state.
// This can be done prior to making a new release after all tests are passing.
// Add results to git to provide a full diff record of all params over level.
Good bool `nest:"+"`
}

// RunConfig has config parameters related to running the sim
// RunConfig has config parameters related to running the sim.
type RunConfig struct {

// use the GPU for computation -- generally faster even for small models if NData ~16
// GPU uses the GPU for computation; only for testing in this model -- not faster.
GPU bool `default:"true"`

// number of data-parallel items to process in parallel per trial -- works (and is significantly faster) for both CPU and GPU. Results in an effective mini-batch of learning.
// NData is the number of data-parallel items to process in parallel per trial.
// Is significantly faster for both CPU and GPU. Results in an effective
// mini-batch of learning.
NData int `default:"16" min:"1"`

// number of parallel threads for CPU computation -- 0 = use default
// NThreads is the number of parallel threads for CPU computation;
// 0 = use default.
NThreads int `default:"0"`

// number of cycles per Theta phase (trial) -- 300 needed for motor action gating
ThetaCycles int `default:"300"`

// starting run number -- determines the random seed -- runs counts from there -- can do all runs in parallel by launching separate jobs with each run, runs = 1
// Run is the _starting_ run number, which determines the random seed.
// NRuns counts up from there. Can do all runs in parallel by launching
// separate jobs with each starting Run, NRuns = 1.
Run int `default:"0"`

// total number of runs to do when running Train
NRuns int `default:"10" min:"1"`
// Runs is the total number of runs to do when running Train, starting from Run.
Runs int `default:"1" min:"1"`

// total number of epochs per run -- can take as many as 50 epochs
NEpochs int `default:"100"`
// Epochs is the total number of epochs per run.
Epochs int `default:"30"`

// total number of trials per epoch. Should be an even multiple of NData.
NTrials int `default:"128"`
// Trials is the total number of trials per epoch.
// Should be an even multiple of NData.
Trials int `default:"128"`

// Cycles is the total number of cycles per trial: at least 200.
Cycles int `default:"200"`

// PlusCycles is the total number of plus-phase cycles per trial. For Cycles=300, use 100.
PlusCycles int `default:"50"`
}

// LogConfig has config parameters related to logging data
// LogConfig has config parameters related to logging data.
type LogConfig struct {

// if true, save final weights after each run
// SaveWeights will save final weights after each run.
SaveWeights bool

// if true, save train epoch log to file, as .epc.tsv typically
Epoch bool `default:"true" nest:"+"`

// if true, save run log to file, as .run.tsv typically
Run bool `default:"true" nest:"+"`
// Train has the list of Train mode levels to save log files for.
Train []string `default:"['Run', 'Epoch']" nest:"+"`

// if true, save expt log to file, as .expt.tsv typically
Expt bool `default:"true" nest:"+"`
// Test has the list of Test mode levels to save log files for.
Test []string `nest:"+"`

// if true, save train trial log to file, as .trl.tsv typically. May be large.
Trial bool `default:"false" nest:"+"`
// Testing activates testing mode: records detailed data for Go CI tests
// (not the same as running test mode on network, via Looper).
Testing bool
}

// if true, save testing epoch log to file, as .tst_epc.tsv typically. In general it is better to copy testing items over to the training epoch log and record there.
TestEpoch bool `default:"false" nest:"+"`
// Config has the overall Sim configuration options.
type Config struct {

// if true, save testing trial log to file, as .tst_trl.tsv typically. May be large.
TestTrial bool `default:"false" nest:"+"`
// Name is the short name of the sim.
Name string `display:"-" default:"PCoreDS"`

// if true, save network activation etc data from testing trials, for later viewing in netview
NetData bool
// Title is the longer title of the sim.
Title string `display:"-" default:"Pallidal Core (PGe) Dorsal Striatum"`

// activates testing mode -- records detailed data for Go CI tests (not the same as running test mode on network, via Looper)
Testing bool
}
// URL is a link to the online README or other documentation for this sim.
URL string `display:"-" default:"https://github.com/emer/axon/blob/main/examples/pcore_ds/README.md"`

// Config is a standard Sim config -- use as a starting point.
type Config struct {
// Doc is brief documentation of the sim.
Doc string `display:"-" default:"This project simulates the Dorsal Basal Ganglia, starting with the Dorsal Striatum, centered on the Pallidum Core (GPe) areas that drive Go vs. No selection of motor actions."`

// specify include files here, and after configuration, it contains list of include files added
// Includes has a list of additional config files to include.
// After configuration, it contains list of include files added.
Includes []string

// open the GUI -- does not automatically run -- if false, then runs automatically and quits
// GUI means open the GUI. Otherwise it runs automatically and quits,
// saving results to log files.
GUI bool `default:"true"`

// log debugging information
// Debug reports debugging information.
Debug bool

// environment configuration options
// Env has environment configuration options.
Env EnvConfig `display:"add-fields"`

// parameter related configuration options
// Params has parameter related configuration options.
Params ParamConfig `display:"add-fields"`

// sim running related configuration options
// Run has sim running related configuration options.
Run RunConfig `display:"add-fields"`

// data logging related configuration options
// Log has data logging related configuration options.
Log LogConfig `display:"add-fields"`
}

Expand Down
128 changes: 128 additions & 0 deletions examples/pcore_ds/enumgen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 657fe5f

Please sign in to comment.