dlk package
Subpackages
- dlk.core package
- Subpackages
- Submodules
- dlk.core.base_module module
- Module contents
- dlk.data package
- Subpackages
- dlk.data.datamodules package
- dlk.data.postprocessors package
- dlk.data.processors package
- dlk.data.subprocessors package
- Submodules
- dlk.data.subprocessors.char_gather module
- dlk.data.subprocessors.fast_tokenizer module
- dlk.data.subprocessors.load module
- dlk.data.subprocessors.save module
- dlk.data.subprocessors.seq_lab_firstpiece_relable module
- dlk.data.subprocessors.seq_lab_loader module
- dlk.data.subprocessors.seq_lab_relabel module
- dlk.data.subprocessors.token2charid module
- dlk.data.subprocessors.token2id module
- dlk.data.subprocessors.token_embedding module
- dlk.data.subprocessors.token_gather module
- dlk.data.subprocessors.token_norm module
- dlk.data.subprocessors.txt_cls_loader module
- dlk.data.subprocessors.txt_reg_loader module
- Module contents
- Module contents
- Subpackages
- dlk.managers package
- dlk.utils package
Submodules
dlk.online module
dlk.predict module
- class dlk.predict.Predict(config: Union[str, dict], checkpoint: str)[source]
Bases:
object
- Config Example:
>>> { >>> "_focus": { >>> }, >>> "_link": {}, >>> "_search": {}, >>> "config": { >>> "save_dir": "*@*", # must be provided >>> "data_path": "*@*", # must be provided >>> }, >>> "task": { >>> "_name": task_name >>> ... >>> } >>> }
- get_data(config)[source]
get the data decided by config
- Parameters
config – {“config”: {“data_path”: ‘..’}}
- Returns
loaded data
- get_datamodule(config, data)[source]
get the datamodule decided by config, and fit the data to datamodule
- Parameters
config – {“task”: {“datamodule”: ‘..’}}
data – {“train”: ‘..’, ‘valid’: ‘..’, ..}
- Returns
datamodule
- get_imodel(config, data)[source]
get the imodel decided by config
- Parameters
config – {“task”: {“imodel”: ‘..’}}
data – {“train”: ‘..’, ‘valid’: ‘..’, ..}
- Returns
imodel
- get_manager(config, name)[source]
get the tranin/predict manager decided by config
- Parameters
config – {“task”: {“manager”: ‘..’}, “config”: {“save_dir”}}
name – the predict progress name
- Returns
manager
dlk.process module
dlk.train module
- class dlk.train.Train(config: Union[str, Dict], ckpt: str = '')[source]
Bases:
object
Trainer
- Config Example:
>>> { >>> "_focus": { >>> }, >>> "_link": {}, >>> "_search": {}, >>> "config": { >>> "save_dir": "*@*", # must be provided >>> "data_path": "*@*", # must be provided >>> }, >>> "task": { >>> "_name": task_name >>> ... >>> } >>> }
- dump_config(config: Dict, name: str)[source]
dump the config and change the log file path to config[‘config’][‘save_dir’]+name
- Parameters
config – {“config”: {“save_dir”: ‘..’}}
name – config name
- Returns
None
- get_data(config)[source]
get the data decided by config
- Parameters
config – {“config”: {“data_path”: ‘..’}}
- Returns
loaded data
- get_datamodule(config, data)[source]
get the datamodule decided by config, and fit the data to datamodule
- Parameters
config – {“task”: {“datamodule”: ‘..’}}
data – {“train”: ‘..’, ‘valid’: ‘..’, ..}
- Returns
datamodule
- get_imodel(config, data)[source]
get the imodel decided by config, and inject the origin test and valid data
- Parameters
config – {“task”: {“imodel”: ‘..’}}
data – {“train”: ‘..’, ‘valid’: ‘..’, ..}
- Returns
imodel