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
-
Use
excore init
in your command line to initialize your workspace.- Enter your workspace name(default to current folder name)
- Enter your source code path(
src
in this case, need relative path)
If you already define
Registry
in yoursrc/__init__.py
, it will automatically set all the Registry names asPrimaryFields
. Otherwise You can enter thePrimaryFields
,ExCore
will automatically generate the definition insrc/__init__.py
according to your inputs. -
Edit registries field in
.excore.toml
. Then runexcore update
to generate some fields in config. -
Run
excore auto-register
to register all modules insrc
. -
[Optional] Run
exocre config-extension
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.