## Base class for configuration templates
-- set ns = namespace()
-- from 'inc/formatting.jinja' import h1, h2, h3
-- filter trim()


-- block base_directories
    ## At a minimum, this block is expected to define:
    ## -- set ns.forgather_dir = ...
    -- include "base_directories.yaml"
<< endblock base_directories


-- block resource_directories
    ## The directory where models are stored
    -- set ns.models_dir = ns.models_dir | default(joinpath(project_dir, 'output_models'))

    ## Project-specific model source code directory
    -- set ns.project_model_src_dir = ns.project_model_src_dir | default(joinpath(project_dir, 'model_src'))
    
    ## Shared model source directory for custom models
    -- set ns.model_src_dir = ns.model_src_dir | default(joinpath(ns.forgather_dir, 'model_src'))

    ## The directory in which custom tokenizers are stored
    -- set ns.tokenizers_dir = ns.tokenizers_dir | default(joinpath(ns.forgather_dir, 'tokenizers'))

    ## The directory in which datasets are stored
    -- set ns.datasets_dir = ns.datasets_dir | default(joinpath(ns.forgather_dir, 'datasets'))
<< endblock resource_directories


-- block config_metadata
    -- set ns.config_name = "Undefined"
    -- set ns.config_description = "Undefined"
    -- set ns.config_class = "type"
<< endblock config_metadata


-- block globals
## For variables computed from above data
<< endblock globals


-- endfilter ## filter trim() setup
== h1(ns.config_name)
-- filter trim()
-- block header
# {{ utcisotime() }}
# Description: {{ ns.config_description }}
# Project Dir: {{ abspath(project_dir) }}
# Current Working Dir: "{{ getcwd() }}"
# Forgather Config Dir: "{{ abspath(forgather_config_dir()) }}"

<< endblock header
-- endfilter


== h2('Config Vars')

-- filter trim()
-- block variable_listing
# ns.forgather_dir: "{{ abspath(ns.forgather_dir) }}"
# ns.models_dir: "{{ abspath(ns.models_dir) }}"
# ns.project_model_src_dir: "{{ abspath(ns.project_model_src_dir) }}"
# ns.tokenizers_dir: "{{ abspath(ns.tokenizers_dir) }}"
# ns.datasets_dir: "{{ abspath(ns.datasets_dir) }}"
<< endblock variable_listing
-- endfilter


-- filter trim()
-- block main_body required
## Main Body
<< endblock main_body
-- endfilter


== h3('Dynamic Args')
-- filter trim()
-- block dynamic_args
## A list of dynamic arguments for CLI tools
dynamic_args: !dlist
    null: ~
<< endblock dynamic_args
-- endfilter


== h1('Configuration Output')
-- filter trim()
-- block config_output
    -- filter trim()
    -- block meta_output
meta: &meta_output !dict:@meta
    config_name: "{{ ns.config_name }}"
    config_description: "{{ ns.config_description }}"
    config_class: "{{ ns.config_class }}"
    project_dir: "{{ project_dir }}"
    workspace_root: "{{ workspace_root }}"
    forgather_dir: "{{ ns.forgather_dir }}"
    models_dir: "{{ ns.models_dir }}"
    tokenizers_dir: "{{ ns.tokenizers_dir }}"
    datasets_dir: "{{ ns.datasets_dir }}"
    << endblock meta_output
    -- endfilter


    -- filter trim()
    -- block main_output required
## Fill in definition of what the main output should be
## main: !singleton:foo ...
    << endblock main_output
    -- endfilter


    -- filter trim()
    -- block auxiliary_outputs
## Optional additional ouput targets
    << endblock auxiliary_outputs
    -- endfilter
<< endblock config_output
-- endfilter
