Skip to main content

workspace

Why we need workspace

In order to cooperate with the config system, LazyRegistry and other generated caches, we need workspace to control the project.

Initialize workspace

Assume you have a project with the structure:

├── test.py
├── train.py
├── configs/
├── LICENSE
├── src
│   ├── __init__.py
│   ├── datasets/
│   ├── hooks/
│   ├── losses/
│   ├── lr_schedulers/
│   ├── metrics/
│   └── models/
├── pyproject.toml
├── tests/
├── tools/
└── xxx.py

  1. Use excore init in your command line to initialize your workspace.

    1. Enter your workspace name(default to current folder name)
    2. Enter your source code path(src in this case, need ralative path)

    If you already define Registry in your src/__init__.py, it will automatically set all the Registry names as PrimaryFields. Otherwise You can enter the PrimaryFields, ExCore will automatically generate the definition in src/__init__.py according to your inputs.

  2. Edit registries field in .excore.toml. Then run excore update to generate some fields in config.

  3. Run excore auto-register to register all modules in src.

  4. [Optional] Run exocre config-extention to support editing features.

workspace config fields

Workspace config format is like:

name = "xxx"
src_dir = "xxx"
registries = [
"*Model",
"*Data: TrainData, TestData",
"*Backbone",
"Head",
"Hook",
"*Loss",
"*LRSche",
"*Optimizer",
"Transform",
"module",
]
primary_fields = [
"Model",
"TrainData",
"TestData",
"Backbone",
"Loss",
"LRSche",
"Optimizer",
]

[primary_to_registry]
TrainData = "Data"
TestData = "Data"

[json_schema_fields]
Data = ["TrainData", "TestData"]
isolated_fields = ["Model", "Backbone", "Loss", "LRSche", "Optimizer"]

* denotes the name is one of PrimaryFields. : is used to generate primary_fields, primary_to_registry and json_schema_fields.

json_schema_fields is used for generating json schema.